Forráskód Böngészése

clearTimeout多余的活体检测提示

Michael Wang 6 éve
szülő
commit
9235ff4d0f
1 módosított fájl, 4 hozzáadás és 2 törlés
  1. 4 2
      src/features/OnlineExam/Examing/ExamingHome.vue

+ 4 - 2
src/features/OnlineExam/Examing/ExamingHome.vue

@@ -56,11 +56,11 @@ export default {
       process.env.NODE_ENV === "production" &&
       /^\d+$/.test(this.$route.query.faceVerifyMinute)
     ) {
-      setTimeout(() => {
+      this.faceIdMsgTimeout = setTimeout(() => {
         this.toggleSnapNow();
         this.$Message.info("30秒后开始活体检测");
       }, this.$route.query.faceVerifyMinute * 60 * 1000 - 30 * 1000); // 活体检测提醒
-      setTimeout(() => {
+      this.faceIdDivTimeout = setTimeout(() => {
         this.showFaceId = true;
       }, this.$route.query.faceVerifyMinute * 60 * 1000); // 定时做活体检测
       // }, 1 * 1000); // 定时做活体检测
@@ -114,6 +114,8 @@ export default {
   beforeDestroy() {
     clearInterval(this.submitInterval);
     clearInterval(this.snapInterval);
+    clearTimeout(this.faceIdMsgTimeout);
+    clearTimeout(this.faceIdDivTimeout);
   },
   // beforeRouteUpdate(to, from, next) {
   //   this.updateQuestion(next);