zhangjie 2 年之前
父節點
當前提交
b0e5e73e1f

+ 3 - 1
src/features/examwork/ActivityManagement/ActivityAudioDialog.vue

@@ -144,7 +144,9 @@ export default {
 
       this.$nextTick(() => {
         this.$refs.modalFormComp.clearValidate();
-        this.$refs.UploadFileView.setAttachmentName("");
+        this.$refs.UploadFileView.setAttachmentName(
+          this.instance.attachmentName || ""
+        );
       });
     },
     openDialog() {

+ 14 - 4
src/features/examwork/ActivityManagement/ActivityManagement.vue

@@ -145,12 +145,22 @@ export default {
       selectedActivity: {},
     };
   },
-  async created() {
-    const examInfo = window.sessionStorage.getItem("examInfo");
-    this.examInfo = examInfo ? JSON.parse(examInfo) : null;
-    this.searchForm();
+  // created() {
+  //   this.initData();
+  // },
+  beforeRouteEnter(to, from, next) {
+    if (from.name === "ExamManagement") {
+      next((vm) => vm.$nextTick(() => vm.initData()));
+    } else {
+      next();
+    }
   },
   methods: {
+    initData() {
+      const examInfo = window.sessionStorage.getItem("examInfo");
+      this.examInfo = examInfo ? JSON.parse(examInfo) : null;
+      this.searchForm();
+    },
     async searchForm() {
       const res = await searchActivities({
         examId: this.examId,

+ 32 - 14
src/features/invigilation/RealtimeMonitoring/RealtimeMonitoring.vue

@@ -352,6 +352,7 @@ import {
   MONITOR_STATUS_TYPE,
 } from "@/constant/constants";
 import { mapState, mapMutations, mapActions } from "vuex";
+import { Notification } from "element-ui";
 
 export default {
   name: "RealtimeMonitoring",
@@ -390,6 +391,7 @@ export default {
       hasNewWarning: false,
       loopRunning: false,
       loopSetTs: [],
+      noticeLoopSetTs: [],
       communicationCount: 0,
       curExamBatch: {},
       curViewingAngle: {},
@@ -588,11 +590,11 @@ export default {
     },
     async fetchWarningNotice() {
       if (!this.filter.examId) return;
-      let noticeCaches = {};
+      this.cleartNoticeLoopSetTs();
       const showAlert = async (item) => {
         return new Promise((resolve) => {
-          setTimeout(() => {
-            this.$notify({
+          let st = setTimeout(() => {
+            let notifyIns = this.$notify({
               duration: 5 * 1000,
               dangerouslyUseHTMLString: true,
               customClass: "msg-monitor-magbox",
@@ -606,20 +608,39 @@ export default {
                 </div>
               `,
             });
-            resolve();
-          }, 200);
+            resolve(notifyIns);
+          }, 500);
+          this.noticeLoopSetTs.push(st);
         });
       };
+      Notification.closeAll();
+
+      let noticeCaches = {},
+        noticeList = [];
+      const maxNoticeCount = 3;
 
       const res = await invigilationWarningMessage(this.filter.examId);
-      for (let i = 0, len = res.data.data.length; i < len; i++) {
-        const item = res.data.data[i];
+      const dataList = res.data.data.slice(-16);
+      for (let i = 0, len = dataList.length; i < len; i++) {
+        const item = dataList[i];
         const stdKey = item.examRecordId;
         if (!noticeCaches[stdKey]) {
-          noticeCaches[stdKey] = item;
-          await showAlert(item);
+          if (noticeList.length > maxNoticeCount) {
+            const prevStdKey = noticeList.shift();
+            noticeCaches[prevStdKey].close();
+          }
+          noticeCaches[stdKey] = await showAlert(item);
+          noticeList.push(stdKey);
         }
       }
+      if (noticeList.length > maxNoticeCount) {
+        const prevStdKey = noticeList.shift();
+        noticeCaches[prevStdKey].close();
+      }
+    },
+    cleartNoticeLoopSetTs() {
+      this.noticeLoopSetTs.forEach((t) => clearTimeout(t));
+      this.noticeLoopSetTs = [];
     },
     handleSelectionChange(val) {
       console.log(val);
@@ -704,11 +725,6 @@ export default {
       }
     },
   },
-  beforeDestroy() {
-    this.loopRunning = false;
-    this.clearLoopSetTs();
-    delete window.inviligateWarning;
-  },
   beforeRouteEnter(to, from, next) {
     next((vm) => {
       if (["WarningDetail", "VideoCommunication"].includes(from.name)) {
@@ -725,7 +741,9 @@ export default {
     this.pageType = "0";
     this.loopRunning = false;
     this.clearLoopSetTs();
+    this.cleartNoticeLoopSetTs();
     delete window.inviligateWarning;
+    Notification.closeAll();
     next();
   },
 };