瀏覽代碼

断点续考 网络连接错误处理,去除 Spin

Michael Wang 5 年之前
父節點
當前提交
84f7af6751
共有 2 個文件被更改,包括 15 次插入9 次删除
  1. 13 8
      src/features/OnlineExam/OnlineExamList.vue
  2. 2 1
      src/mixins/mixins.js

+ 13 - 8
src/features/OnlineExam/OnlineExamList.vue

@@ -132,15 +132,20 @@ export default {
       this.spinShow = true;
       this.processingMessage = "正在检测断点续考信息...";
 
-      const alreadyInExam = await this.checkExamInProgress();
-      if (alreadyInExam) {
+      try {
+        const alreadyInExam = await this.checkExamInProgress();
+        if (alreadyInExam) {
+          this.spinShow = false;
+          window._hmt.push([
+            "_trackEvent",
+            "在线考试列表页面",
+            "断点续考",
+            "进入",
+          ]);
+          return;
+        }
+      } catch (error) {
         this.spinShow = false;
-        window._hmt.push([
-          "_trackEvent",
-          "在线考试列表页面",
-          "断点续考",
-          "进入",
-        ]);
         return;
       }
 

+ 2 - 1
src/mixins/mixins.js

@@ -79,11 +79,11 @@ Vue.mixin({
           const res = await this.$http.get(
             "/api/ecs_oe_student/examControl/endExam"
           );
+          this.$Spin.hide();
           if (res.status === 200) {
             this.$router.replace({
               path: `/online-exam/exam/${examingRes.examId}/examRecordData/${examingRes.examRecordDataId}/end`,
             });
-            this.$Spin.hide();
           } else {
             window._hmt.push(["_trackEvent", "断点续考处理异常", "交卷失败"]);
             this.$Message.error({
@@ -113,6 +113,7 @@ Vue.mixin({
           return true;
         }
       } catch (error) {
+        this.$Spin.hide();
         window._hmt.push(["_trackEvent", "断点续考处理异常"]);
         this.$Message.error({
           content: "断点续考处理异常",