瀏覽代碼

fix: 修改前端样式以及解决学生详情页参加状态的bug

yhd12345 4 年之前
父節點
當前提交
4617a065ca

+ 1 - 1
src/router/index.js

@@ -127,7 +127,7 @@ const routes = [
     component: () =>import("../views/ExamPage/evalExamPage/teacherExamDetails")
   },
   {
-    path: "/evalExam/:examId/student/details",
+    path: "/evalExam/student/details",
     name: "student-examDetails",
     component: () =>import("../views/ExamPage/evalExamPage/studentExamDetails")
   },

+ 2 - 2
src/views/CoursePage/tabs/TaskTab.vue

@@ -544,8 +544,9 @@ export default {
         } else {
           _this.$router.push({
             name: "student-examDetails",
-            params: {
+            query: {
               examId: task["examId"],
+              isJoined: task["isJoined"]
             }
           });
         }
@@ -716,7 +717,6 @@ export default {
       ).catch(_err => {
         ElMessage.error("创建Eval评测失败");
       });
-
     }
   },
 };

+ 4 - 3
src/views/ExamPage/evalExamPage/EditExam.vue

@@ -1,6 +1,6 @@
 <template>
   <el-row v-if="!showQuestionList" :gutter="20" type="flex" justify="space-between">
-    <el-col :span="24" class="box">
+    <el-col :span="20" class="box">
       <el-card class="box-card" v-if="examInfo">
         <template #header>
           <div class="card-header" v-if="paperQuestionsSet" style="font-size: 20px">
@@ -31,7 +31,7 @@
         </el-row>
       </el-card>
     </el-col>
-    <el-col v-if="!paperQuestionsSet" :span="24" class="box">
+    <el-col v-if="!paperQuestionsSet" :span="20" class="box">
       <el-card class="box-card">
         <span style="font-size: 20px">样卷选择</span>
         <el-divider></el-divider>
@@ -63,7 +63,7 @@
         </el-tabs>
       </el-card>
     </el-col>
-    <el-col v-else :span="24" class="box">
+    <el-col v-else :span="20" class="box">
       <el-card class="box-card">
         <template #header>
           <div class="card-header">
@@ -291,6 +291,7 @@ export default {
   /*overflow-y: auto;*/
   display: flex;
   flex-direction: column;
+  margin-left: 150px;
 }
 
 .el-card {

+ 3 - 2
src/views/ExamPage/evalExamPage/QuestionList.vue

@@ -1,6 +1,6 @@
 <template>
   <el-row :gutter="20" type="flex" justify="space-between">
-    <el-col :span="24" class="box">
+    <el-col :span="20" class="box">
       <el-card class="box-card">
         <span style="font-size: 20px">已选题目</span>
         <el-divider></el-divider>
@@ -35,7 +35,7 @@
         </el-row>
       </el-card>
     </el-col>
-    <el-col :span="24" class="box">
+    <el-col :span="20" class="box">
       <el-card class="box-card">
         <span style="font-size: 20px">试题列表</span>
         <el-divider></el-divider>
@@ -240,6 +240,7 @@ export default {
   /*overflow-y: auto;*/
   display: flex;
   flex-direction: column;
+  margin-left: 150px;
 }
 
 .el-card {

+ 21 - 28
src/views/ExamPage/evalExamPage/studentExamDetails.vue

@@ -1,6 +1,6 @@
 <template>
   <el-row>
-    <el-col :span="24" class="box">
+    <el-col :span="20" class="box">
       <el-card class="box-card" v-if="this.examInfo">
         <span>评测详情</span>
         <el-divider></el-divider>
@@ -21,29 +21,29 @@
             <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.examInfo.isJoined && (state === '未开始' || state === '进行中')"
-                :disabled="this.examInfo.isJoined"
+                v-if="!this.isJoined && (state === '未开始' || state === '进行中')"
+                :disabled="this.isJoined"
                 type="primary"
                 style="float: right"
                 @click="onJoinExam">
               报名参加
             </el-button>
             <el-button
-                v-if="this.examInfo.isJoined && state === '未开始'"
-                :disabled="this.examInfo.isJoined"
+                v-if="this.isJoined && state === '未开始'"
+                :disabled="this.isJoined"
                 type="primary"
                 style="float: right">
               等待加入
             </el-button>
             <el-button
-                v-if="this.examInfo.isJoined && state === '进行中' && !this.examInfo.isFinished"
+                v-if="this.isJoined && state === '进行中' && !this.examInfo.isFinished"
                 type="success"
                 style="float: right"
                 @click="onStartExam">
               开始评测
             </el-button>
             <el-button
-                v-if="this.examInfo.isJoined && (state === '已结束' || this.examInfo.isFinished)"
+                v-if="this.isJoined && (state === '已结束' || this.examInfo.isFinished)"
                 style="float: right"
                 @click="onOpenResult">
               结果报告
@@ -110,6 +110,7 @@ export default {
       examInfo: [],
       courseInfo: [],
       examId: 0,
+      isJoined: false,
       state: "",
       inputInviteCode: false,
       examQuestionsNum: 0,
@@ -120,8 +121,8 @@ export default {
     };
   },
   created() {
-    this.examId=this.$route.params.examId;
-    // this.examId = 84;
+    this.examId=this.$route.query.examId;
+    this.isJoined=this.$route.query.isJoined;
     this.$apis.getExamById(this.examId).then(_res => {
       this.examInfo = _res.data.data.result;
       this.examInfo.skills = this.examInfo.skills.toString();
@@ -131,26 +132,12 @@ export default {
           this.examInfo.endTime
       );
       this.$apis.getExamSubmitRecordsByUserId(this.examId).then(({ data }) => {
-        console.log(data.data.result);
         this.examInfo.isFinished = !!data.data.result.find((val) => !val.message);
       });
-      console.log(this.examInfo);
     });
   },
 
   mounted() {
-    this.$apis.getExamListByCurrentStudent().then(_res =>{
-      console.log(_res);
-      this.examList=_res.data.data.result.examVOList;
-      this.totalNum = _res.data.data.result.totalNum;
-      const that = this;
-      this.examList.forEach(function (exam){
-        if(exam.examId === that.examInfo.examId){
-          that.examInfo.isJoined = true;
-        }
-      });
-    });
-    console.log(this.examInfo);
   },
 
   updated() {
@@ -195,12 +182,12 @@ export default {
       if (this.examInfo.isPublic) {
         const examId = this.examInfo.examId ?? 0;
         this.$apis.joinPublicExam(examId).then(() => {
+          this.isJoined = true;
+          console.log(this.examInfo);
           ElMessage({
             message: "加入考试成功",
             type: "success",
           });
-          this.examInfo.isJoined = true;
-          console.log(this.examInfo);
         });
       } else {
         this.inputInviteCode = true;
@@ -214,12 +201,12 @@ export default {
       this.$apis.joinExamByInviteCode(inviteCode, examId)
           .then(() => {
             this.inputInviteCode = false;
+            this.isJoined = true;
+            console.log(this.examInfo);
             ElMessage({
               message: "加入考试成功",
               type: "success",
             });
-            this.examInfo.isJoined = true;
-            console.log(this.examInfo);
           })
           .catch(() => {
           })
@@ -244,5 +231,11 @@ export default {
 </script>
 
 <style scoped>
-
+.box {
+  height: 80%;
+  /*overflow-y: auto;*/
+  display: flex;
+  flex-direction: column;
+  margin-left: 150px;
+}
 </style>

+ 4 - 3
src/views/ExamPage/evalExamPage/teacherExamDetails.vue

@@ -1,6 +1,6 @@
 <template>
   <el-row v-if="!showQuestionList" :gutter="20" type="flex" justify="space-between">
-    <el-col :span="24" class="box">
+    <el-col :span="20" class="box">
       <el-card class="box-card" v-if="this.examInfo">
         <template #header>
           <div class="card-header" style="font-size: 20px">
@@ -40,7 +40,7 @@
         </el-row>
       </el-card>
     </el-col>
-    <el-col :span="24" class="box">
+    <el-col :span="20" class="box">
       <el-card class="box-card">
         <template #header>
           <div class="card-header">
@@ -85,7 +85,7 @@
         <div v-else v-loading="loading"></div>
       </el-card>
     </el-col>
-    <el-col :span="24" class="box">
+    <el-col :span="20" class="box">
       <el-card class="box-card">
         <span style="font-size: 20px">评测名单</span>
         <el-table :data="joinedUsers" style="width: 100%">
@@ -230,6 +230,7 @@ export default {
   /*overflow-y: auto;*/
   display: flex;
   flex-direction: column;
+  margin-left: 150px;
 }
 
 .el-card {