Explorar o código

加锁避免同时交卷

Michael Wang %!s(int64=6) %!d(string=hai) anos
pai
achega
60626acc23
Modificáronse 1 ficheiros con 7 adicións e 0 borrados
  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() {