Michael Wang 5 жил өмнө
parent
commit
d76fe4dec8

+ 5 - 1
src/features/OnlineExam/Examing/TextQuestionView.vue

@@ -303,6 +303,9 @@ export default {
   created() {
     this.fetchQRCode();
   },
+  beforeDestroy() {
+    clearTimeout(this.fetchQRCodeTimeout);
+  },
   methods: {
     ...mapMutations(["updateExamQuestion"]),
     ...mapGetters(["examShouldShowAnswer"]),
@@ -377,7 +380,8 @@ export default {
         const transferFileType =
           this.examQuestion.answerType === "SINGLE_AUDIO" ? "AUDIO" : "PIC";
         if (!getQRCode(this.examQuestion.order, transferFileType)) {
-          setTimeout(() => {
+          clearTimeout(this.fetchQRCodeTimeout);
+          this.fetchQRCodeTimeout = setTimeout(() => {
             this.fetchQRCode();
           }, 3000);
         }