Bladeren bron

feature_20260330_拜访连拍速度优化

zhujindu 1 week geleden
bovenliggende
commit
5969bf7954
2 gewijzigde bestanden met toevoegingen van 7 en 14 verwijderingen
  1. 1 1
      src/components/deleteUploadImgTaskPhoto.vue
  2. 6 13
      src/views/deviceWithin/taskPhotoTaking.vue

+ 1 - 1
src/components/deleteUploadImgTaskPhoto.vue

@@ -224,8 +224,8 @@ export default {
             };
           }),
         );
+        this.isUploadImg = false;
         this.$nextTick(() => {
-          this.isUploadImg = false;
           this.syncUpload(localIds);
         });
       } else {

+ 6 - 13
src/views/deviceWithin/taskPhotoTaking.vue

@@ -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 = {