Răsfoiți Sursa

fix retry snap photo upload

Michael Wang 5 ani în urmă
părinte
comite
813bda561f
1 a modificat fișierele cu 6 adăugiri și 3 ștergeri
  1. 6 3
      src/components/FaceRecognition/FaceRecognition.vue

+ 6 - 3
src/components/FaceRecognition/FaceRecognition.vue

@@ -73,6 +73,8 @@ export default {
     this.$refs.video.srcObject.getTracks().forEach(function(track) {
       track.stop();
     });
+    clearTimeout(this.retrySnapTimeout);
+    clearTimeout(this.showSnapResultTimeout);
   },
   methods: {
     ...mapMutations(["toggleSnapNow", "decreaseSnapCount"]),
@@ -164,8 +166,9 @@ export default {
           "定时抓拍流程失败",
           (this.lastSnapTime ? "(非初次抓拍)" : "") + "将再次抓拍",
         ]);
-        this.lastSnapTime = null;
-        this.toggleSnapNow();
+        this.retrySnapTimeout = setTimeout(() => {
+          this.toggleSnapNow();
+        }, 60 * 1000);
       } finally {
         this.videoStartPlay();
         this.decreaseSnapCount();
@@ -444,7 +447,7 @@ export default {
             });
           }
         } else {
-          setTimeout(
+          this.showSnapResultTimeout = setTimeout(
             this.showSnapResult.bind(this, fileName, examRecordDataId),
             30 * 1000
           );