mjh 3 years ago
parent
commit
478cac0fcc
1 changed files with 38 additions and 38 deletions
  1. 38 38
      src/views/ExamPage/evalExamPage/studentExamDetails.vue

+ 38 - 38
src/views/ExamPage/evalExamPage/studentExamDetails.vue

@@ -21,31 +21,31 @@
             <el-tag class="ml-2" :type="statusToType(state)">{{ state }}</el-tag>
             <el-tag v-if="this.examInfo.isFinished" class="ml-2" type="info">已完成</el-tag>
             <el-button
-                v-if="!this.isJoined && (state === '未开始' || state === '进行中')"
-                :disabled="this.isJoined"
-                type="primary"
-                style="float: right"
-                @click="onJoinExam">
+              v-if="!isJoined && (state === '未开始' || state === '进行中')"
+              :disabled="this.isJoined"
+              type="primary"
+              style="float: right"
+              @click="onJoinExam">
               报名参加
             </el-button>
             <el-button
-                v-if="this.isJoined && state === '未开始'"
-                :disabled="this.isJoined"
-                type="primary"
-                style="float: right">
+              v-if="this.isJoined && state === '未开始'"
+              :disabled="this.isJoined"
+              type="primary"
+              style="float: right">
               等待加入
             </el-button>
             <el-button
-                v-if="this.isJoined && state === '进行中' && !this.examInfo.isFinished"
-                type="success"
-                style="float: right"
-                @click="onStartExam">
+              v-if="this.isJoined && state === '进行中' && !this.examInfo.isFinished"
+              type="success"
+              style="float: right"
+              @click="onStartExam">
               开始评测
             </el-button>
             <el-button
-                v-if="this.isJoined && (state === '已结束' || this.examInfo.isFinished)"
-                style="float: right"
-                @click="onOpenResult">
+              v-if="this.isJoined && (state === '已结束' || this.examInfo.isFinished)"
+              style="float: right"
+              @click="onOpenResult">
               结果报告
             </el-button>
           </div>
@@ -56,7 +56,7 @@
             所属课程: {{ this.courseInfo.name }}
           </el-col>
           <el-col :span="12">
-            监考:{{ this.examInfo.antiCheating ? '是' : '否' }}
+            监考:{{ this.examInfo.antiCheating ? "是" : "否" }}
           </el-col>
         </el-row>
         <el-row>
@@ -121,17 +121,17 @@ export default {
     };
   },
   created() {
-    this.examId=this.$route.query.examId;
-    this.isJoined=this.$route.query.isJoined;
+    this.examId = this.$route.query.examId;
+    this.isJoined = this.$route.query.isJoined === "true";
     this.$apis.getExamById(this.examId).then(_res => {
       this.examInfo = _res.data.data.result;
       this.examInfo.skills = this.examInfo.skills.toString();
       this.courseInfo = this.examInfo.course;
       this.state = this.computeExamStateText(
-          this.examInfo.startTime,
-          this.examInfo.endTime
+        this.examInfo.startTime,
+        this.examInfo.endTime
       );
-      this.$apis.getExamSubmitRecordsByUserId(this.examId).then(({ data }) => {
+      this.$apis.getExamSubmitRecordsByUserId(this.examId).then(({data}) => {
         this.examInfo.isFinished = !!data.data.result.find((val) => !val.message);
       });
     });
@@ -142,10 +142,10 @@ export default {
 
   updated() {
     this.state = this.computeExamStateText(
-        this.examInfo.startTime,
-        this.examInfo.endTime
+      this.examInfo.startTime,
+      this.examInfo.endTime
     );
-    this.$apis.getExamSubmitRecordsByUserId(this.examId).then(({ data }) => {
+    this.$apis.getExamSubmitRecordsByUserId(this.examId).then(({data}) => {
       console.log(data.data.result);
       this.examInfo.isFinished = !!data.data.result.find((val) => !val.message);
     });
@@ -199,20 +199,20 @@ export default {
       const examId = this.examInfo.examId ?? 0;
       const inviteCode = this.inviteCode;
       this.$apis.joinExamByInviteCode(inviteCode, examId)
-          .then(() => {
-            this.inputInviteCode = false;
-            this.isJoined = true;
-            console.log(this.examInfo);
-            ElMessage({
-              message: "加入考试成功",
-              type: "success",
-            });
-          })
-          .catch(() => {
-          })
-          .finally(() => {
-            this.inviteCode = "";
+        .then(() => {
+          this.inputInviteCode = false;
+          this.isJoined = true;
+          console.log(this.examInfo);
+          ElMessage({
+            message: "加入考试成功",
+            type: "success",
           });
+        })
+        .catch(() => {
+        })
+        .finally(() => {
+          this.inviteCode = "";
+        });
     },
 
     onStartExam() {