|
@@ -436,7 +436,7 @@ export default {
|
|
};
|
|
};
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
- ...mapState("invigilation", ["liveDomains"]),
|
|
|
|
|
|
+ ...mapState("invigilation", ["liveDomains", "warningMessageTimeCaches"]),
|
|
isFullScreen() {
|
|
isFullScreen() {
|
|
return this.$store.state.isFullScreen;
|
|
return this.$store.state.isFullScreen;
|
|
},
|
|
},
|
|
@@ -453,7 +453,10 @@ export default {
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
...mapActions("invigilation", ["updateDetailIds"]),
|
|
...mapActions("invigilation", ["updateDetailIds"]),
|
|
- ...mapMutations("invigilation", ["setDetailIds"]),
|
|
|
|
|
|
+ ...mapMutations("invigilation", [
|
|
|
|
+ "setDetailIds",
|
|
|
|
+ "setWarningMessageTimeCaches",
|
|
|
|
+ ]),
|
|
clearLoopSetTs() {
|
|
clearLoopSetTs() {
|
|
if (!this.loopSetTs.length) return;
|
|
if (!this.loopSetTs.length) return;
|
|
this.loopSetTs.forEach((sett) => {
|
|
this.loopSetTs.forEach((sett) => {
|
|
@@ -621,6 +624,31 @@ export default {
|
|
});
|
|
});
|
|
this.communicationCount = res.data.data.count || 0;
|
|
this.communicationCount = res.data.data.count || 0;
|
|
},
|
|
},
|
|
|
|
+ getValidWarningList(data) {
|
|
|
|
+ let dataList = [];
|
|
|
|
+ const maxCount = 16;
|
|
|
|
+ const maxCacheTime = 5 * 60 * 1000;
|
|
|
|
+ const warningMessageTimeCaches = { ...this.warningMessageTimeCaches };
|
|
|
|
+ for (let i = 0; i < data.length; i++) {
|
|
|
|
+ const item = data[i];
|
|
|
|
+ const stdKey = item.examRecordId;
|
|
|
|
+ const nowTime = Date.now();
|
|
|
|
+
|
|
|
|
+ if (warningMessageTimeCaches[stdKey]) {
|
|
|
|
+ if (nowTime - warningMessageTimeCaches[stdKey] > maxCacheTime) {
|
|
|
|
+ dataList.push(item);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ warningMessageTimeCaches[stdKey] = nowTime;
|
|
|
|
+ dataList.push(item);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (dataList.length >= maxCount) {
|
|
|
|
+ this.setWarningMessageTimeCaches(warningMessageTimeCaches);
|
|
|
|
+ return dataList;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
async fetchWarningNotice() {
|
|
async fetchWarningNotice() {
|
|
if (!this.filter.examId) return;
|
|
if (!this.filter.examId) return;
|
|
this.cleartNoticeLoopSetTs();
|
|
this.cleartNoticeLoopSetTs();
|
|
@@ -653,7 +681,7 @@ export default {
|
|
const maxNoticeCount = 3;
|
|
const maxNoticeCount = 3;
|
|
|
|
|
|
const res = await invigilationWarningMessage(this.filter.examId);
|
|
const res = await invigilationWarningMessage(this.filter.examId);
|
|
- const dataList = res.data.data.slice(-16);
|
|
|
|
|
|
+ const dataList = this.getValidWarningList(res.data.data);
|
|
for (let i = 0, len = dataList.length; i < len; i++) {
|
|
for (let i = 0, len = dataList.length; i < len; i++) {
|
|
const item = dataList[i];
|
|
const item = dataList[i];
|
|
const stdKey = item.examRecordId;
|
|
const stdKey = item.examRecordId;
|
|
@@ -741,6 +769,7 @@ export default {
|
|
},
|
|
},
|
|
},
|
|
},
|
|
beforeDestroy() {
|
|
beforeDestroy() {
|
|
|
|
+ this.setWarningMessageTimeCaches = {};
|
|
delete window.inviligateWarning;
|
|
delete window.inviligateWarning;
|
|
},
|
|
},
|
|
beforeRouteEnter(to, from, next) {
|
|
beforeRouteEnter(to, from, next) {
|