瀏覽代碼

加锁避免同时交卷

Michael Wang 6 年之前
父節點
當前提交
60626acc23
共有 1 個文件被更改,包括 7 次插入0 次删除
  1. 7 0
      src/features/OnlineExam/Examing/ExamingHome.vue

+ 7 - 0
src/features/OnlineExam/Examing/ExamingHome.vue

@@ -276,6 +276,11 @@ export default {
         setTimeout(() => this.realSubmitPaperStep2(), 300);
         return;
       }
+      if (this.submitLock) {
+        return;
+      } else {
+        this.submitLock = true;
+      }
       try {
         const res = await this.$http.get(
           "/api/ecs_oe_student/examControl/endExam"
@@ -294,9 +299,11 @@ export default {
         } else {
           this.$Message.error("交卷失败");
         }
+        this.submitLock = false;
       } catch (e) {
         console.log(e);
       }
+      this.submitLock = false;
       this.$Spin.hide();
     },
     examQuestion() {