浏览代码

修复 交卷后算分逻辑

Michael Wang 5 年之前
父节点
当前提交
64e3979d8d
共有 2 个文件被更改,包括 35 次插入20 次删除
  1. 34 19
      src/features/OnlineExam/Examing/ExamingEnd.vue
  2. 1 1
      vue.config.js

+ 34 - 19
src/features/OnlineExam/Examing/ExamingEnd.vue

@@ -3,18 +3,22 @@
     <div class="instructions">
       <h1 class="">考试已结束</h1>
       <div><img class="user-avatar" :src="user.photoPath" alt="无底照" /></div>
-      <div class="qm-big-text score-text" v-if="!examResult">
+      <div
+        class="qm-big-text score-text"
+        v-if="!examResult && getResultTimes <= 10"
+      >
         考试结果计算中...
       </div>
       <div
         class="qm-big-text score-text"
+        style="font-size: 20px;"
         v-if="!examResult && getResultTimes > 10"
       >
         后台繁忙,请稍后在待考列表中查看客观题得分。
       </div>
       <div
         class="qm-big-text score-text"
-        v-if="showObjectScore && !examResult.isWarn"
+        v-if="showObjectScore && (examResult && !examResult.isWarn)"
       >
         客观题得分:
         <span style="color: red">{{ examResult.objectiveScore }}</span>
@@ -31,12 +35,17 @@
         客观题正确率:
         <span style="color: red">{{ examResult.objectiveAccuracy }}%</span>
       </div>
-      <div class="qm-big-text score-text" v-if="examResult.isWarn">
+      <div
+        class="qm-big-text score-text"
+        v-if="examResult && examResult.isWarn"
+      >
         客观题得分: 成绩待审核
       </div>
-      <h1 v-if="examResult.isWarn" style="text-align: left;">违纪提示:</h1>
+      <h1 v-if="examResult && examResult.isWarn" style="text-align: left;">
+        违纪提示:
+      </h1>
       <div
-        v-if="examResult.isWarn"
+        v-if="examResult && examResult.isWarn"
         class=""
         style="text-align: left;  padding-bottom: 20px"
       >
@@ -52,8 +61,8 @@
         to="/online-exam"
         style="display: inline-block; width: 100%;"
       >
-        返回主页</router-link
-      >
+        返回主页
+      </router-link>
     </div>
   </div>
 
@@ -94,9 +103,13 @@ export default {
             examRecordDataId
         )).data;
 
-        if (examResult === undefined || examResult === null) {
+        if (
+          examResult === undefined ||
+          examResult === null ||
+          examResult === ""
+        ) {
           this.waitingNumber++;
-          setTimeout(() => f(), 3000);
+          this.timeout = setTimeout(() => f(), 3000);
           return;
         }
         window._hmt.push([
@@ -106,9 +119,18 @@ export default {
           "等待次数=" + this.waitingNumber,
         ]);
         this.examResult = examResult;
+
+        if (this.examResult.isWarn) {
+          const cheatingRemark = await this.$http.get(
+            "/api/ecs_exam_work/exam/examOrgPropertyFromCache4StudentSession/" +
+              examId +
+              `/CHEATING_REMARK`
+          );
+          this.cheatingRemark = cheatingRemark.data.CHEATING_REMARK || "";
+        }
       } catch (error) {
         this.waitingNumber++;
-        setTimeout(() => f(), 3000);
+        this.timeout = setTimeout(() => f(), 3000);
       }
     };
     await f();
@@ -141,15 +163,6 @@ export default {
         (showObjectScore.data.IS_OBJ_SCORE_VIEW &&
           JSON.parse(showObjectScore.data.IS_OBJ_SCORE_VIEW)) ||
         false;
-
-      if (this.examResult.isWarn) {
-        const cheatingRemark = await this.$http.get(
-          "/api/ecs_exam_work/exam/examOrgPropertyFromCache4StudentSession/" +
-            examId +
-            `/CHEATING_REMARK`
-        );
-        this.cheatingRemark = cheatingRemark.data.CHEATING_REMARK || "";
-      }
     } catch (error) {
       this.$Message.error({
         content: "获取考试设置错误,请在待考列表查看成绩!",
@@ -162,6 +175,8 @@ export default {
     document.body.style = "";
   },
   beforeDestroy() {
+    clearTimeout(this.timeout);
+
     this.updateExamState({
       exam: null,
       paperStruct: null,

+ 1 - 1
vue.config.js

@@ -154,7 +154,7 @@ module.exports = {
             },
             cacheName: "objective-score-list-cache",
             expiration: {
-              maxAgeSeconds: 5 * 60,
+              maxAgeSeconds: 1 * 60,
             },
           },
         },