Forráskód Böngészése

超出断点续考自动交卷

Michael Wang 6 éve
szülő
commit
f991fd44b5

+ 27 - 0
src/features/Login/Login.vue

@@ -332,6 +332,33 @@ export default {
         const examingRes = (await this.$http.get(
           "/api/ecs_oe_student/examControl/checkExamInProgress"
         )).data;
+        if (examingRes.isExceed) {
+          // 超出断点续考次数的逻辑,仅此block
+          this.$Spin.show({
+            render: () => {
+              return (
+                <div style="font-size: 24px">
+                  `超出最大断点续考次数(${examingRes.maxInterruptNum}
+                  ),正在自动交卷...`
+                </div>
+              );
+            }
+          });
+          const res = await this.$http.get(
+            "/api/ecs_oe_student/examControl/endExam"
+          );
+          if (res.status === 200) {
+            this.$router.replace({
+              path: `/online-exam/exam/${examingRes.examId}/examRecordData/${
+                examingRes.examRecordDataId
+              }/end`
+            });
+            this.$Spin.hide();
+          } else {
+            this.$Message.error("交卷失败");
+          }
+          return;
+        }
         if (examingRes) {
           this.$Spin.show({
             render: () => {

+ 29 - 0
src/features/OnlineExam/OnlineExamList.vue

@@ -112,6 +112,35 @@ export default {
         const examingRes = (await this.$http.get(
           "/api/ecs_oe_student/examControl/checkExamInProgress"
         )).data;
+
+        if (examingRes.isExceed) {
+          // 超出断点续考次数的逻辑,仅此block
+          this.$Spin.show({
+            render: () => {
+              return (
+                <div style="font-size: 24px">
+                  `超出最大断点续考次数(${examingRes.maxInterruptNum}
+                  ),正在自动交卷...`
+                </div>
+              );
+            }
+          });
+          const res = await this.$http.get(
+            "/api/ecs_oe_student/examControl/endExam"
+          );
+          if (res.status === 200) {
+            this.$router.replace({
+              path: `/online-exam/exam/${examingRes.examId}/examRecordData/${
+                examingRes.examRecordDataId
+              }/end`
+            });
+            this.$Spin.hide();
+          } else {
+            this.$Message.error("交卷失败");
+          }
+          return;
+        }
+
         if (examingRes) {
           window._hmt.push([
             "_trackEvent",

+ 29 - 0
src/features/OnlinePractice/OnlinePracticeList.vue

@@ -88,6 +88,35 @@ export default {
         const examingRes = (await this.$http.get(
           "/api/ecs_oe_student/examControl/checkExamInProgress"
         )).data;
+
+        if (examingRes.isExceed) {
+          // 超出断点续考次数的逻辑,仅此block
+          this.$Spin.show({
+            render: () => {
+              return (
+                <div style="font-size: 24px">
+                  `超出最大断点续考次数(${examingRes.maxInterruptNum}
+                  ),正在自动交卷...`
+                </div>
+              );
+            }
+          });
+          const res = await this.$http.get(
+            "/api/ecs_oe_student/examControl/endExam"
+          );
+          if (res.status === 200) {
+            this.$router.replace({
+              path: `/online-exam/exam/${examingRes.examId}/examRecordData/${
+                examingRes.examRecordDataId
+              }/end`
+            });
+            this.$Spin.hide();
+          } else {
+            this.$Message.error("交卷失败");
+          }
+          return;
+        }
+
         if (examingRes) {
           this.$Spin.show({
             render: () => {