소스 검색

修复心跳时间被重复获取

Michael Wang 6 년 전
부모
커밋
edab530e48
2개의 변경된 파일15개의 추가작업 그리고 3개의 파일을 삭제
  1. 14 2
      src/features/OnlineExam/Examing/ExamingEnd.vue
  2. 1 1
      src/features/OnlineExam/Examing/RemainTime.vue

+ 14 - 2
src/features/OnlineExam/Examing/ExamingEnd.vue

@@ -37,7 +37,7 @@
 <script>
 <script>
 import { mapState as globalMapState } from "vuex";
 import { mapState as globalMapState } from "vuex";
 import { createNamespacedHelpers } from "vuex";
 import { createNamespacedHelpers } from "vuex";
-const { mapState } = createNamespacedHelpers("examingHomeModule");
+const { mapState, mapMutations } = createNamespacedHelpers("examingHomeModule");
 
 
 export default {
 export default {
   data() {
   data() {
@@ -75,11 +75,23 @@ export default {
     //   .map(q => q.groupScore)
     //   .map(q => q.groupScore)
     //   .reduce((p, c) => p + c);
     //   .reduce((p, c) => p + c);
   },
   },
+  beforeDestroy() {
+    this.updateExamState({
+      exam: null,
+      paperStruct: null,
+      examQuestionList: null
+    });
+    this.updateExamResult({
+      examResult: null
+    });
+  },
   computed: {
   computed: {
     ...globalMapState(["user"]),
     ...globalMapState(["user"]),
     ...mapState(["exam", "examResult", "paperStruct"])
     ...mapState(["exam", "examResult", "paperStruct"])
   },
   },
-  methods: {}
+  methods: {
+    ...mapMutations(["updateExamState", "updateExamResult"])
+  }
 };
 };
 </script>
 </script>
 
 

+ 1 - 1
src/features/OnlineExam/Examing/RemainTime.vue

@@ -44,7 +44,7 @@ export default {
       } else {
       } else {
         this.heartbeatErrorNum++;
         this.heartbeatErrorNum++;
         if (this.heartbeatErrorNum >= 10) {
         if (this.heartbeatErrorNum >= 10) {
-          // 心跳异常5次则退出考试
+          // 心跳异常10次则退出考试
           this.$Modal.error({
           this.$Modal.error({
             title: "网络连接异常",
             title: "网络连接异常",
             content: "退出考试",
             content: "退出考试",