浏览代码

考后说明:违纪提示

Michael Wang 5 年之前
父节点
当前提交
1b0319940a
共有 1 个文件被更改,包括 96 次插入118 次删除
  1. 96 118
      src/features/OnlineExam/Examing/ExamingEnd.vue

+ 96 - 118
src/features/OnlineExam/Examing/ExamingEnd.vue

@@ -1,55 +1,51 @@
 <template>
-  <div v-if="afterExamRemark !== null" id="exam-end" class="container">
+  <div v-if="!!!loading" id="exam-end" class="container">
     <div class="instructions">
       <h1 class="">考试已结束</h1>
       <div><img class="user-avatar" :src="user.photoPath" alt="无底照" /></div>
-      <div
-        v-if="!examResult && getResultTimes <= 10"
-        class="qm-big-text score-text"
-      >
-        考试结果计算中...
-      </div>
-      <div
-        v-if="!examResult && getResultTimes > 10"
-        class="qm-big-text score-text"
-        style="font-size: 20px;"
-      >
-        请稍后在待考列表中查看客观题得分。
-      </div>
-      <div
-        v-if="showObjectScore && (examResult && !examResult.isWarn)"
-        class="qm-big-text score-text"
-      >
-        客观题得分:
-        <span style="color: red">{{ examResult.objectiveScore }}</span>
-      </div>
-      <div
-        v-if="
-          exam &&
-            exam.examType !== 'ONLINE' &&
-            showObjectScore &&
-            (examResult && !examResult.isWarn)
-        "
-        class="qm-big-text score-text"
-      >
-        客观题正确率:
-        <span style="color: red">{{ examResult.objectiveAccuracy }}%</span>
-      </div>
-      <div
-        v-if="examResult && examResult.isWarn"
-        class="qm-big-text score-text"
-      >
-        客观题得分: 成绩待审核
-      </div>
-      <h1 v-if="examResult && examResult.isWarn" style="text-align: left;">
-        违纪提示:
-      </h1>
-      <div
-        v-if="examResult && examResult.isWarn"
-        class=""
-        style="text-align: left;  padding-bottom: 20px"
-      >
-        <p v-html="cheatingRemark"></p>
+      <div v-if="showObjectScore">
+        <div
+          v-if="!examResult && getResultTimes <= 10"
+          class="qm-big-text score-text"
+        >
+          考试结果计算中...
+        </div>
+        <div
+          v-if="!examResult && getResultTimes > 10"
+          class="qm-big-text score-text"
+          style="font-size: 20px;"
+        >
+          请稍后在待考列表中查看客观题得分。
+        </div>
+        <div v-if="examResult">
+          <div v-if="!examResult.isWarn" class="qm-big-text score-text">
+            客观题得分:
+            <span style="color: red">{{ examResult.objectiveScore }}</span>
+          </div>
+          <div
+            v-if="exam.examType !== 'ONLINE' && !examResult.isWarn"
+            class="qm-big-text score-text"
+          >
+            客观题正确率:
+            <span style="color: red">{{ examResult.objectiveAccuracy }}%</span>
+          </div>
+          <div v-if="examResult.isWarn" class="qm-big-text score-text">
+            客观题得分: 成绩待审核
+          </div>
+          <h1
+            v-if="showCheatingRemark && examResult.isWarn"
+            style="text-align: left;"
+          >
+            违纪提示:
+          </h1>
+          <div
+            v-if="showCheatingRemark && examResult.isWarn"
+            class=""
+            style="text-align: left;  padding-bottom: 20px"
+          >
+            <p v-html="cheatingRemark"></p>
+          </div>
+        </div>
       </div>
       <h1 style="text-align: left;">考后说明:</h1>
       <div style="text-align: left;  padding-bottom: 20px">
@@ -79,10 +75,12 @@ export default {
   name: "ExamingEnd",
   data() {
     return {
+      loading: true,
       exam: null,
       afterExamRemark: null,
-      showObjectScore: null,
       cheatingRemark: null,
+      showObjectScore: null,
+      showCheatingRemark: null,
       examResult: null,
       getResultTimes: 0,
     };
@@ -108,57 +106,12 @@ export default {
     window._hmt.push(["_trackEvent", "考试结束页面", "进入页面"]);
     const examRecordDataId = this.$route.params.examRecordDataId;
     const examId = this.$route.params.examId;
-    this.waitingNumber = 0;
-    const f = async () => {
-      if (this.$route.name !== "ExamingEnd" || this.waitingNumber > 30) {
-        // 非成绩页,不在查询成绩
-        return;
-      }
-      try {
-        this.getResultTimes = this.getResultTimes + 1;
-        const examResult = (await this.$http.get(
-          "/api/ecs_oe_student/examControl/getEndExamInfo?examRecordDataId=" +
-            examRecordDataId
-        )).data;
-
-        if (
-          examResult === undefined ||
-          examResult === null ||
-          examResult === ""
-        ) {
-          this.waitingNumber++;
-          this.timeout = setTimeout(() => f(), 3000);
-          return;
-        }
-        window._hmt.push([
-          "_trackEvent",
-          "考试结束页面",
-          "等待分数",
-          "等待次数=" + this.waitingNumber,
-        ]);
-        this.examResult = examResult;
-
-        if (this.examResult.isWarn) {
-          const cheatingRemark = await this.$http.get(
-            "/api/ecs_exam_work/exam/getExamPropertyFromCacheByStudentSession/" +
-              examId +
-              `/CHEATING_REMARK`
-          );
-          this.cheatingRemark = cheatingRemark.data.CHEATING_REMARK || "";
-        }
-      } catch (error) {
-        this.waitingNumber++;
-        this.timeout = setTimeout(() => f(), 3000);
-      }
-    };
-    await f();
 
     try {
-      // if (!this.exam) {
+      this.loading = true;
       this.exam = (await this.$http.get(
         "/api/ecs_exam_work/exam/" + examId
       )).data;
-      // }
 
       if (this.exam.examType === "PRACTICE") {
         this.$router.replace(
@@ -166,21 +119,17 @@ export default {
         );
         return;
       }
-      const afterExamRemark = await this.$http.get(
+      const resp = await this.$http.get(
         "/api/ecs_exam_work/exam/getExamPropertyFromCacheByStudentSession/" +
           examId +
-          `/AFTER_EXAM_REMARK`
+          `/AFTER_EXAM_REMARK,IS_OBJ_SCORE_VIEW,SHOW_CHEATING_REMARK,CHEATING_REMARK`
       );
-      this.afterExamRemark = afterExamRemark.data.AFTER_EXAM_REMARK || "";
-      const showObjectScore = await this.$http.get(
-        "/api/ecs_exam_work/exam/getExamPropertyFromCacheByStudentSession/" +
-          examId +
-          `/IS_OBJ_SCORE_VIEW`
-      );
-      this.showObjectScore =
-        (showObjectScore.data.IS_OBJ_SCORE_VIEW &&
-          JSON.parse(showObjectScore.data.IS_OBJ_SCORE_VIEW)) ||
-        false;
+      this.afterExamRemark = resp.data.AFTER_EXAM_REMARK || "";
+      this.cheatingRemark = resp.data.CHEATING_REMARK || "";
+      this.showObjectScore = resp.data.IS_OBJ_SCORE_VIEW === "true";
+      this.showCheatingRemark = resp.data.SHOW_CHEATING_REMARK === "true";
+
+      this.loading = false;
     } catch (error) {
       window._hmt.push([
         "_trackEvent",
@@ -196,6 +145,8 @@ export default {
     }
 
     document.body.style = "";
+
+    await this.getExamResult();
   },
   beforeDestroy() {
     clearTimeout(this.timeout);
@@ -223,6 +174,44 @@ export default {
 
   methods: {
     ...mapMutations(["updateExamState"]),
+    async getExamResult() {
+      const examRecordDataId = this.$route.params.examRecordDataId;
+      this.waitingNumber = 0;
+      const f = async () => {
+        if (this.$route.name !== "ExamingEnd" || this.waitingNumber > 30) {
+          // 非成绩页,不在查询成绩
+          return;
+        }
+        try {
+          this.getResultTimes = this.getResultTimes + 1;
+          const examResult = (await this.$http.get(
+            "/api/ecs_oe_student/examControl/getEndExamInfo?examRecordDataId=" +
+              examRecordDataId
+          )).data;
+
+          if (
+            examResult === undefined ||
+            examResult === null ||
+            examResult === ""
+          ) {
+            this.waitingNumber++;
+            this.timeout = setTimeout(() => f(), 3000);
+            return;
+          }
+          window._hmt.push([
+            "_trackEvent",
+            "考试结束页面",
+            "等待分数",
+            "等待次数=" + this.waitingNumber,
+          ]);
+          this.examResult = examResult;
+        } catch (error) {
+          this.waitingNumber++;
+          this.timeout = setTimeout(() => f(), 3000);
+        }
+      };
+      await f();
+    },
   },
 };
 </script>
@@ -235,10 +224,6 @@ export default {
 }
 
 .instructions {
-  /* display: grid; */
-  /* grid-template-rows: 40px 300px min(100px) 30px minmax(200px, auto) min(100px) min(
-      100px
-    ) min(100px); */
   padding: 40px 20px;
 }
 
@@ -257,13 +242,6 @@ export default {
 .score-text {
   font-size: 40px;
 }
-
-/* .exam-detail {
-  padding: 40px 20px;
-  background-color: #f5f5f5;
-
-  text-align: left;
-} */
 </style>
 
 <style>