|
@@ -55,6 +55,12 @@ export default {
|
|
beforeRouteEnter(to, from, next) {
|
|
beforeRouteEnter(to, from, next) {
|
|
next(vm => {
|
|
next(vm => {
|
|
vm.previousUrl = from.path;
|
|
vm.previousUrl = from.path;
|
|
|
|
+ if (
|
|
|
|
+ from.path.includes("/online-homework") ||
|
|
|
|
+ from.path.includes("/online-exam")
|
|
|
|
+ ) {
|
|
|
|
+ vm.getData();
|
|
|
|
+ }
|
|
});
|
|
});
|
|
},
|
|
},
|
|
beforeMount() {
|
|
beforeMount() {
|
|
@@ -114,74 +120,78 @@ export default {
|
|
async mounted() {
|
|
async mounted() {
|
|
window._hmt.push(["_trackEvent", "在线考试列表页面", "进入页面"]);
|
|
window._hmt.push(["_trackEvent", "在线考试列表页面", "进入页面"]);
|
|
|
|
|
|
- let examListRes;
|
|
|
|
- for (let i = 0; i < 4; i++) {
|
|
|
|
- let url;
|
|
|
|
- if (this.examType === "ONLINE") {
|
|
|
|
- url = "/api/ecs_oe_admin/examControl/queryExamList";
|
|
|
|
- } else if (this.examType === "ONLINE_HOMEWORK") {
|
|
|
|
- url = "/api/ecs_oe_admin/examControl/queryHomeworkList";
|
|
|
|
- }
|
|
|
|
- examListRes = await this.$http.get(url);
|
|
|
|
- if (examListRes.status === 503) {
|
|
|
|
- await new Promise(resolve => setTimeout(() => resolve(), 2000));
|
|
|
|
- continue;
|
|
|
|
- } else if (examListRes.status === 200) {
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (examListRes.status !== 200) {
|
|
|
|
- window._hmt.push([
|
|
|
|
- "_trackEvent",
|
|
|
|
- "待考列表获取失败",
|
|
|
|
- "调用待考列表获取接口超过失败次数",
|
|
|
|
- ]);
|
|
|
|
- this.$Message.error({
|
|
|
|
- content: "服务器繁忙(503)!请稍后重试。",
|
|
|
|
- duration: 15,
|
|
|
|
- closable: true,
|
|
|
|
- });
|
|
|
|
- return;
|
|
|
|
- } else {
|
|
|
|
- this.courses = examListRes.data;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- try {
|
|
|
|
- const noticeRes = (await this.$http.get(
|
|
|
|
- "/api/ecs_exam_work/notice/getUserNoticeList?" +
|
|
|
|
- this.user.id +
|
|
|
|
- this.siteMessagesTimeStamp
|
|
|
|
- )).data;
|
|
|
|
- // const noticeRes = [
|
|
|
|
- // {
|
|
|
|
- // content: "<div>公告<img src='./svgs/sms-read.svg' /></div>",
|
|
|
|
- // hasRead: true,
|
|
|
|
- // id: 0,
|
|
|
|
- // publishTime: "2019-07-08T11:23:34.646Z",
|
|
|
|
- // publisher: "string",
|
|
|
|
- // title: "string",
|
|
|
|
- // },
|
|
|
|
- // ];
|
|
|
|
- // noticeRes.forEach(
|
|
|
|
- // v =>
|
|
|
|
- // (v.publishTime = moment(v.publishTime).format("YYYY-MM-DD hh:mm:ss"))
|
|
|
|
- // );
|
|
|
|
- this.updateSiteMessages(noticeRes);
|
|
|
|
- } catch (error) {
|
|
|
|
- console.log(error);
|
|
|
|
- this.$Message.error({
|
|
|
|
- content: "获取公告通知异常",
|
|
|
|
- duration: 15,
|
|
|
|
- closable: true,
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
|
|
+ await this.getData();
|
|
},
|
|
},
|
|
beforeDestroy() {
|
|
beforeDestroy() {
|
|
clearInterval(this.interval);
|
|
clearInterval(this.interval);
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
...mapMutations(["updateSiteMessages"]),
|
|
...mapMutations(["updateSiteMessages"]),
|
|
|
|
+ async getData() {
|
|
|
|
+ this.courses = [];
|
|
|
|
+ let examListRes;
|
|
|
|
+ for (let i = 0; i < 4; i++) {
|
|
|
|
+ let url;
|
|
|
|
+ if (this.examType === "ONLINE") {
|
|
|
|
+ url = "/api/ecs_oe_admin/examControl/queryExamList";
|
|
|
|
+ } else if (this.examType === "ONLINE_HOMEWORK") {
|
|
|
|
+ url = "/api/ecs_oe_admin/examControl/queryHomeworkList";
|
|
|
|
+ }
|
|
|
|
+ examListRes = await this.$http.get(url);
|
|
|
|
+ if (examListRes.status === 503) {
|
|
|
|
+ await new Promise(resolve => setTimeout(() => resolve(), 2000));
|
|
|
|
+ continue;
|
|
|
|
+ } else if (examListRes.status === 200) {
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (examListRes.status !== 200) {
|
|
|
|
+ window._hmt.push([
|
|
|
|
+ "_trackEvent",
|
|
|
|
+ "待考列表获取失败",
|
|
|
|
+ "调用待考列表获取接口超过失败次数",
|
|
|
|
+ ]);
|
|
|
|
+ this.$Message.error({
|
|
|
|
+ content: "服务器繁忙(503)!请稍后重试。",
|
|
|
|
+ duration: 15,
|
|
|
|
+ closable: true,
|
|
|
|
+ });
|
|
|
|
+ return;
|
|
|
|
+ } else {
|
|
|
|
+ this.courses = examListRes.data;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ const noticeRes = (await this.$http.get(
|
|
|
|
+ "/api/ecs_exam_work/notice/getUserNoticeList?" +
|
|
|
|
+ this.user.id +
|
|
|
|
+ this.siteMessagesTimeStamp
|
|
|
|
+ )).data;
|
|
|
|
+ // const noticeRes = [
|
|
|
|
+ // {
|
|
|
|
+ // content: "<div>公告<img src='./svgs/sms-read.svg' /></div>",
|
|
|
|
+ // hasRead: true,
|
|
|
|
+ // id: 0,
|
|
|
|
+ // publishTime: "2019-07-08T11:23:34.646Z",
|
|
|
|
+ // publisher: "string",
|
|
|
|
+ // title: "string",
|
|
|
|
+ // },
|
|
|
|
+ // ];
|
|
|
|
+ // noticeRes.forEach(
|
|
|
|
+ // v =>
|
|
|
|
+ // (v.publishTime = moment(v.publishTime).format("YYYY-MM-DD hh:mm:ss"))
|
|
|
|
+ // );
|
|
|
|
+ this.updateSiteMessages(noticeRes);
|
|
|
|
+ } catch (error) {
|
|
|
|
+ console.log(error);
|
|
|
|
+ this.$Message.error({
|
|
|
|
+ content: "获取公告通知异常",
|
|
|
|
+ duration: 15,
|
|
|
|
+ closable: true,
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ },
|
|
},
|
|
},
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|