zhangjie преди 2 години
родител
ревизия
394d89d099

+ 2 - 0
src/constant/constants.js

@@ -156,10 +156,12 @@ if (process.env.VUE_APP_SELF_DEFINE_DOMAIN === "true") {
 if (!domain) domain = window.location.hostname.split(".")[0];
 export const ORG_CODE = domain;
 
+// 注意:组件命名按照驼峰形式,其他方式命名会导致缓存失败
 // [routeNameShouldKeepAlive, [whenReturedFromThisRoute]]
 export const keepAliveRoutesPairs = [
   ["ExamManagement", ["ExamEdit"]],
   ["InvigilationDetail", ["WarningDetail", "InvigilationWarningDetail"]],
   ["WarningManage", ["WarningDetail", "InvigilationWarningDetail"]],
   ["OnlinePatrol", ["PatrolExamDetail", "PatrolWarningDetail"]],
+  ["RealtimeMonitoring", ["WarningDetail", "VideoCommunication"]],
 ];

+ 17 - 1
src/features/invigilation/RealtimeMonitoring/RealtimeMonitoring.vue

@@ -351,7 +351,7 @@ import {
 import { mapState, mapMutations, mapActions } from "vuex";
 
 export default {
-  name: "realtime-monitoring",
+  name: "RealtimeMonitoring",
   components: {
     ExamBatchDialog,
     RightOrWrong,
@@ -666,6 +666,22 @@ export default {
     this.clearLoopSetTs();
     delete window.inviligateWarning;
   },
+  beforeRouteEnter(to, from, next) {
+    next((vm) => {
+      if (["WarningDetail", "VideoCommunication"].includes(from.name)) {
+        if (vm.curExamBatch.isExaming) {
+          vm.loopRunning = true;
+          vm.timerUpdatePage();
+        }
+      }
+    });
+  },
+  beforeRouteLeave(to, from, next) {
+    this.loopRunning = false;
+    this.clearLoopSetTs();
+    delete window.inviligateWarning;
+    next();
+  },
 };
 </script>
 

+ 1 - 1
src/features/invigilation/RealtimeMonitoring/VideoCommunication.vue

@@ -79,7 +79,7 @@ import { formatDate, timeNumberToText } from "@/utils/utils";
 import timeMixin from "../../../mixins/timeMixin";
 
 export default {
-  name: "video-communication",
+  name: "VideoCommunication",
   mixins: [timeMixin],
   data() {
     return {

+ 1 - 1
src/features/invigilation/RealtimeMonitoring/WarningDetail.vue

@@ -331,7 +331,7 @@ const domEmpty = (dom) => {
 };
 
 export default {
-  name: "warning-detail",
+  name: "WarningDetail",
   components: {
     FlvMedia,
     StudentBreachDialog,