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