zhangjie 1 年之前
父節點
當前提交
ed46950825
共有 2 個文件被更改,包括 26 次插入17 次删除
  1. 25 4
      src/store/modules/invigilation.js
  2. 1 13
      src/views/Layout/Layout.vue

+ 25 - 4
src/store/modules/invigilation.js

@@ -70,16 +70,37 @@ const mutations = {
 };
 
 const actions = {
-  async fetchRealtimeMonitoringCount({ commit }, datas) {
-    const res = await invigilateCount(datas);
+  async fetchRealtimeMonitoringCount({ state, commit }, datas) {
+    if (
+      !state.cacheExamActivity.examId ||
+      !state.cacheExamActivity.examActivityId
+    )
+      return;
+    const res = await invigilateCount({ ...datas, ...state.cacheExamActivity });
     commit("setRealtimeMonitoring", res.data.data.length);
   },
   async fetchWarningManageCount({ commit }, datas) {
-    const res = await invigilationWarningCount(datas);
+    if (
+      !state.cacheExamActivity.examId ||
+      !state.cacheExamActivity.examActivityId
+    )
+      return;
+    const res = await invigilationWarningCount({
+      ...datas,
+      ...state.cacheExamActivity,
+    });
     commit("setWarningManage", res.data.data.count);
   },
   async fetchReexamPendingCount({ commit }, datas) {
-    const res = await reexamPendingCount(datas);
+    if (
+      !state.cacheExamActivity.examId ||
+      !state.cacheExamActivity.examActivityId
+    )
+      return;
+    const res = await reexamPendingCount({
+      ...datas,
+      ...state.cacheExamActivity,
+    });
     commit("setReexamPending", res.data.data.count);
   },
   // 上一页,下一页 ------->

+ 1 - 13
src/views/Layout/Layout.vue

@@ -155,22 +155,10 @@ export default {
       this.clearLoopSetTs();
       if (!this.loopRunning) return;
 
-      if (
-        !this.cacheExamActivity.examId ||
-        !this.cacheExamActivity.examActivityId
-      ) {
-        this.loopSetTs.push(
-          setTimeout(() => {
-            this.timerUpdatePage();
-          }, 10 * 1000)
-        );
-      }
-
       const user = this.$store.state.user;
-      let datas = user.roleCodes.includes("INVIGILATE")
+      const datas = user.roleCodes.includes("INVIGILATE")
         ? { userId: user.id }
         : {};
-      datas = { ...datas, ...this.cacheExamActivity };
 
       const fetchAll = this.loopFuncList.map((item) => item.call(this, datas));
       await Promise.all(fetchAll).catch(() => {});