chenxiong 3 年之前
父節點
當前提交
5d65dd7991

+ 4 - 0
src/pages/mock-countdown/index.vue

@@ -59,6 +59,7 @@ export default {
       eachExamId: 0,
       subscribeId: 0,
       mockName: "",
+      examEndTime: 0,
     };
   },
   computed: {},
@@ -69,6 +70,7 @@ export default {
     this.examId = this.$route.query.examId;
     this.timeLimit = +this.$route.query.limit || 0;
     this.start = +this.$route.query.start;
+    this.examEndTime = this.$route.query.examEndTime;
     this.end = this.timeLimit * 60 + this.start;
     this.timer = setInterval(() => {
       this.timeText = this.getDuring();
@@ -113,6 +115,8 @@ export default {
             examId: this.examId,
             eachExamId: this.eachExamId,
             subscribeId: this.subscribeId,
+            examEndTime: this.examEndTime,
+            examStartTime: this.start,
           },
         });
       } else {

+ 41 - 30
src/pages/mock-exam/index.vue

@@ -955,7 +955,7 @@
 import Footer from "@/components/footer/index";
 import Header from "@/components/header/index";
 import ToolBar from "@/components/toolbar/index";
-import { mapMutations } from "vuex";
+import { mapMutations, mapGetters, mapActions } from "vuex";
 export default {
   name: "BankExplain",
   components: {
@@ -963,6 +963,9 @@ export default {
     Header,
     ToolBar,
   },
+  computed: {
+    ...mapGetters(["sysTime"]),
+  },
   data() {
     return {
       recordId: 0,
@@ -1020,13 +1023,19 @@ export default {
       postTimer: null,
       subscribeId: 0,
       isAutoSubmit: false,
+      examEndTime: 0,
+      examStartTime: 0,
     };
   },
   async mounted() {
+    this.examStartTime = this.$route.query.examStartTime;
+    this.examEndTime = this.$route.query.examEndTime;
     this.examId = this.$route.query.examId;
     this.eachExamId = this.$route.query.eachExamId;
     this.subscribeId = this.$route.query.subscribeId || "";
+    this.allTimes = this.examEndTime - this.examStartTime || "";
 
+    await this.setSystemTime();
     await this.bankExam();
     this.goodsQuestionList();
   },
@@ -1134,6 +1143,7 @@ export default {
   },
   methods: {
     ...mapMutations(["setExamResult"]),
+    ...mapActions(["setSystemTime"]),
     mockSubscribeEdit() {
       this.$request
         .mockSubscribeEdit({
@@ -1214,35 +1224,36 @@ export default {
             });
             return;
           }
-          this.allTimes = res.data[0].answerTime * 60;
-          this.lastTime = res.data[0].answerTime && res.data[0].answerTime * 60;
-
-          //考试时间到了自动交卷
-          if (this.lastTime) {
-            this.timer = setInterval(() => {
-              if (this.lastTime <= 0) {
-                clearInterval(this.timer);
-                this.$confirm(`考试时间已到,系统将自动交卷`, "提示", {
-                  confirmButtonText: "立即交卷",
-                  closeOnClickModal: false,
-                  showCancelButton: false,
-                  closeOnPressEscape: false,
-                  distinguishCancelAndClose: false,
-                  showClose: false,
-                });
-                this.isAutoSubmit = true;
-
-                setTimeout(() => {
-                  try {
-                    this.$msgbox.close();
-                  } catch (err) {}
-                  this.examSubmit();
-                }, 3000);
-                return;
-              }
-              this.lastTime--;
-            }, 1000);
-          } else {
+
+          if (this.subscribeId) {
+            this.lastTime = this.examEndTime - this.sysTime;
+            //考试时间到了自动交卷
+            if (this.lastTime) {
+              this.timer = setInterval(() => {
+                if (this.lastTime <= 0) {
+                  clearInterval(this.timer);
+                  this.$confirm(`考试时间已到,系统将自动交卷`, "提示", {
+                    confirmButtonText: "立即交卷",
+                    closeOnClickModal: false,
+                    showCancelButton: false,
+                    closeOnPressEscape: false,
+                    distinguishCancelAndClose: false,
+                    showClose: false,
+                  });
+                  this.isAutoSubmit = true;
+
+                  setTimeout(() => {
+                    try {
+                      this.$msgbox.close();
+                    } catch (err) {}
+                    this.examSubmit();
+                  }, 3000);
+                  return;
+                }
+                this.lastTime--;
+              }, 1000);
+            } else {
+            }
           }
 
           res.data.forEach((item, index) => {

+ 1 - 1
src/pages/person-center/my-classhour/index/index.vue

@@ -343,7 +343,7 @@ export default {
     this.getcourseperiodlistGoods();
   },
   methods: {
-    ...mapActions(["setSystemTime"]),
+    ...mapActions(["setSystemTime", "setSystemTime"]),
     appBeforeAddress(item) {
       console.log(this.$refs.exercisesModal);
       this.$refs.exercisesModal.showModal(item);

+ 5 - 0
src/pages/person-center/my-mock/index.vue

@@ -799,6 +799,11 @@ export default {
           limit: item.timeLimit,
           examId: item.examId,
           eachExamId: item.eachExamId,
+          examEndTime: this.$tools.TimeTotimestamp(
+            this.$tools.timestampToTime(item.applySiteExamTime) +
+              " " +
+              item.applySiteEndTime
+          ),
           subscribeId: item.subscribeId,
         },
       });