linxuxiang 4 settimane fa
parent
commit
0ccb50787f
1 ha cambiato i file con 8 aggiunte e 0 eliminazioni
  1. 8 0
      src/utils/trainWs.ts

+ 8 - 0
src/utils/trainWs.ts

@@ -180,6 +180,7 @@ export function useWs() {
       }
       //状态变更
       if (e.cmd === 'set_exam_state') {
+        getClearExamStateTimer();
         let index = examStateList.findIndex((item: any) => {
           return item.examId == e.exam_id;
         });
@@ -639,6 +640,13 @@ export function useWs() {
         timerManager[key] = null;
       }
     }
+    getClearExamStateTimer();
+  }
+
+  /**
+   * 清空状态更新定时任务
+   */
+  function getClearExamStateTimer() {
 		for(let i = 0;i<examStateList.length;i++){
 			if (examStateList[i].hasOwnProperty('timer1')) {
 				clearInterval(examStateList[i].timer1);