|
|
@@ -235,22 +235,15 @@ export default {
|
|
|
this.taskPhotoRecognitionResult = item.taskPhotoRecognitionResult;
|
|
|
});
|
|
|
},
|
|
|
- waitUploadReady(timeout = 60000, interval = 300) {
|
|
|
- return new Promise((resolve, reject) => {
|
|
|
- const start = Date.now();
|
|
|
- const check = () => {
|
|
|
+ waitUploadReady(interval = 1000) {
|
|
|
+ return new Promise((resolve) => {
|
|
|
+ const intervalId = setInterval(() => {
|
|
|
const taskPhoto = this.$refs.taskPhoto && this.$refs.taskPhoto[0];
|
|
|
if (taskPhoto && taskPhoto.isUploadImg) {
|
|
|
+ clearInterval(intervalId);
|
|
|
resolve();
|
|
|
- return;
|
|
|
}
|
|
|
- if (Date.now() - start >= timeout) {
|
|
|
- reject(new Error('图片上传超时,请稍后再试'));
|
|
|
- return;
|
|
|
- }
|
|
|
- setTimeout(check, interval);
|
|
|
- };
|
|
|
- check();
|
|
|
+ }, interval);
|
|
|
});
|
|
|
},
|
|
|
async onSubmit() {
|
|
|
@@ -258,7 +251,7 @@ export default {
|
|
|
try {
|
|
|
const taskPhoto = this.$refs.taskPhoto && this.$refs.taskPhoto[0];
|
|
|
if (taskPhoto && !taskPhoto.isUploadImg) {
|
|
|
- await this.waitUploadReady(120000, 400);
|
|
|
+ await this.waitUploadReady(1000);
|
|
|
}
|
|
|
|
|
|
let formData = {
|