ソースを参照

考试结束界面

Michael Wang 6 年 前
コミット
6a9adde6c0

+ 29 - 13
src/features/OnlineExam/Examing/ExamingEnd.vue

@@ -2,7 +2,11 @@
 
   <div class="container" v-if="afterExamRemark">
     <div class="instructions">
-      <h1 class="">考试说明</h1>
+      <div><img :src="this.user.photoPath" alt=""></div>
+      <h1 class="">考试已结束</h1>
+      <div v-if="showObjectScore && !examResult.isWarn">客观分: {{examResult.objectiveScore}}</div>
+      <div v-if="examResult.isWarn">成绩待审核</div>
+      <h1 class="">考后说明: </h1>
       <div class="" style="text-align: left;  padding-bottom: 20px">
         <p v-html="afterExamRemark"></p>
       </div>
@@ -13,13 +17,10 @@
     </div>
 
     <div class="exam-detail">
-      <h3 class="">科目:</h3>
+      <h3 class="">科目:{{exam.name}}</h3>
       <br>
-      <h4 class="">试卷概览(总分:)</h4>
+      <h4 class="">试卷总分:{{paperTotalScore}}</h4>
       <br>
-      <div>
-        <img style="width:100%; padding-top: 40px;" src="../good-wish.png" />
-      </div>
     </div>
 
   </div>
@@ -30,25 +31,40 @@
 </template>
 
 <script>
+import { mapState as globalMapState } from "vuex";
+import { createNamespacedHelpers } from "vuex";
+const { mapState } = createNamespacedHelpers("examingHomeModule");
+
 export default {
   data() {
     return {
       afterExamRemark: null,
-      startInfo: null,
-      paperStruct: null,
-      remainTime: 120
+      showObjectScore: null,
+      paperTotalScore: null
     };
   },
   async mounted() {
-    const exam = await this.$http.get(
+    const afterExamRemark = await this.$http.get(
       "/api/ecs_exam_work/exam/examOrgProperty/" +
         this.$route.params.examId +
         `/AFTER_EXAM_REMARK`
     );
-    this.afterExamRemark = exam.data || "";
+    this.afterExamRemark = afterExamRemark.data || "";
+    const showObjectScore = await this.$http.get(
+      "/api/ecs_exam_work/exam/examOrgProperty/" +
+        this.$route.params.examId +
+        `/IS_OBJ_SCORE_VIEW`
+    );
+    this.showObjectScore = showObjectScore.data || false;
+
+    this.paperTotalScore = this.paperStruct.defaultPaper.questionGroupList
+      .map(q => q.groupScore)
+      .reduce((p, c) => p + c);
+  },
+  computed: {
+    ...globalMapState(["user"]),
+    ...mapState(["exam", "examResult", "paperStruct"])
   },
-  beforeDestroy() {},
-  computed: {},
   methods: {}
 };
 </script>

+ 6 - 1
src/features/OnlineExam/Examing/ExamingHome.vue

@@ -71,7 +71,7 @@ export default {
   //   this.updateQuestion(next);
   // },
   methods: {
-    ...mapMutations(["updateExamState", "toggleSnapNow"]),
+    ...mapMutations(["updateExamState", "toggleSnapNow", "updateExamResult"]),
     async initData() {
       const exam = await this.$http.get(
         "/api/ecs_exam_work/exam/" + this.$route.params.examId
@@ -156,6 +156,11 @@ export default {
           "/api/ecs_oe_student/examControl/endExam"
         );
         if (res.status === 200) {
+          this.updateExamResult({
+            examRecordDataId: res.data.examRecordDataId,
+            isWarn: res.data.isWarn,
+            objectiveScore: res.data.objectiveScore
+          });
           this.$router.push({
             path: `/online-exam/exam/${
               this.$route.params.examId

+ 1 - 1
src/features/OnlineExam/Examing/MultipleQuestionView.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="question-view">
+  <div v-if="examQuestion.questionType === 'MULTIPLE_CHOICE'" class="question-view">
     <question-body :questionBody="question.body" :examQuestionId="examQuestion.id"></question-body>
     <div class="ops">
       <div class="stu-answer"> {{oldIndexToABCD}}</div>

+ 1 - 1
src/features/OnlineExam/Examing/SingleQuestionView.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="question-view">
+  <div v-if="examQuestion.questionType === 'SINGLE_CHOICE'" class="question-view">
     <question-body :questionBody="questionBody" :examQuestionId="examQuestion.id"></question-body>
     <div class="ops">
       <div class="stu-answer">{{oldIndexToABCD}}</div>

+ 1 - 5
src/features/OnlineExam/OnlineExamFaceCheckModal.vue

@@ -52,12 +52,8 @@ export default {
       this.$Message.error("没有底照");
       return;
     }
-    // FIXME: 以后api返回的是绝对路径
-    if (this.userPhoto.startsWith("http") === false) {
-      this.userPhoto = this.userPhoto;
-    }
 
-    // // FIXME: 将faceEnable和faceCheck放到global的state中
+    // FIXME: 将faceEnable和faceCheck放到global的state中
     // this.faceEnable = sysRes.data.faceEnable; // 模拟练习?
     // this.faceCheck = sysRes.data.faceCheck; // 考试
   },

+ 5 - 5
src/features/OnlineExam/OnlineExamResultList.vue

@@ -10,12 +10,12 @@
           <td>客观分</td>
         </tr>
 
-        <tr v-for="(course, index) in results" :key="index">
+        <tr v-for="(result, index) in results" :key="index">
           <td>{{ index + 1 }}</td>
-          <td>{{ course.startTime }}</td>
-          <td>{{ course.endTime }}</td>
-          <td v-if="course.isAuditing">审核中</td>
-          <td v-else>{{ course.objectiveScore }}</td>
+          <td>{{ result.startTime }}</td>
+          <td>{{ result.endTime }}</td>
+          <td v-if="result.isAuditing">审核中</td>
+          <td v-else>{{ result.objectiveScore }}</td>
         </tr>
 
         <tr v-if="loading">

+ 4 - 5
src/features/login/Login.vue

@@ -115,10 +115,6 @@ export default {
           // FIXME: 根据域名来确定domain
           domain: process.env.VUE_APP_LOGIN_DOMAIN
         });
-        // const student = (await this.$http.get(
-        //   "/api/ecs_core/student/getStudentInfoBySession"
-        // )).data;
-        // console.log(student);
         let data = response.data;
         if (data.token) {
           this.errorInfo = "";
@@ -126,7 +122,10 @@ export default {
           window.localStorage.setItem("token", data.token);
           window.localStorage.setItem("key", data.key);
 
-          this.$store.state.user = { ...data };
+          const student = (await this.$http.get(
+            "/api/ecs_core/student/getStudentInfoBySession"
+          )).data;
+          this.$store.state.user = { ...data, ...student };
           this.$router.push("/online-exam");
         } else {
           this.errorInfo = data.desc;

+ 3 - 0
src/store.js

@@ -36,6 +36,9 @@ const examingHomeModule = {
     updateExamState(state, payload) {
       state = Object.assign(state, payload);
     },
+    updateExamResult(state, payload) {
+      state = Object.assign(state, { examResult: payload });
+    },
     updateQuestionFilter(state, type) {
       state.questionFilterType = type;
     },