瀏覽代碼

日常开发

linxuxiang 4 周之前
父節點
當前提交
0ccb50787f
共有 1 個文件被更改,包括 8 次插入0 次删除
  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);