Sfoglia il codice sorgente

确认交卷延迟,确保脏答案5秒内被提交

Michael Wang 6 anni fa
parent
commit
819ca44069
1 ha cambiato i file con 14 aggiunte e 4 eliminazioni
  1. 14 4
      src/features/OnlineExam/Examing/ExamingHome.vue

+ 14 - 4
src/features/OnlineExam/Examing/ExamingHome.vue

@@ -484,13 +484,16 @@ export default {
         q => q.studentAnswer === null
       ).length;
       const signed = this.examQuestionList.filter(q => q.isSign).length;
+      const showConfirmTime = Date.now();
       this.$Modal.confirm({
         title: "确认交卷",
         content: `<p>已答题目:${answered}</p><p>未答题目:${unanswered}</p><p>标记题目:${signed}</p>`,
-        onOk: this.realSubmitPaper,
+        onOk: () => {
+          this.realSubmitPaper(showConfirmTime);
+        },
       });
     },
-    async realSubmitPaper() {
+    async realSubmitPaper(showConfirmTime = 0) {
       this.$Spin.show({
         render: () => {
           return <div style="font-size: 44px">正在交卷,请耐心等待...</div>;
@@ -500,8 +503,15 @@ export default {
         this.serverLog("debug/S-002001", "交卷前抓拍");
         this.toggleSnapNow();
       }
-      // 确保抓拍指令在交卷前执行
-      setTimeout(() => this.realSubmitPaperStep2(), 1000);
+      // 确保抓拍指令在交卷前执行,同时确保5秒间隔提交答案的指令执行了
+      let delay = 5 - (Date.now() - showConfirmTime) / 1000;
+      if (delay < 0) {
+        // 如果用户已经看确认框超过5秒,或者不是由确认框进来的,不延迟
+        delay = 0;
+      }
+      // 给抓拍照片多一秒处理时间
+      delay = delay + 1;
+      setTimeout(() => this.realSubmitPaperStep2(), delay * 1000);
       this.submitCount = 1;
     },
     async realSubmitPaperStep2() {