Преглед на файлове

Merge remote-tracking branch 'origin/seec' into seec

mjh преди 3 години
родител
ревизия
99a7477dbc
променени са 2 файла, в които са добавени 59 реда и са изтрити 32 реда
  1. 4 2
      src/views/CoderPage/ExamDetail.vue
  2. 55 30
      src/views/EvalPage/teacherExamDetails.vue

+ 4 - 2
src/views/CoderPage/ExamDetail.vue

@@ -296,7 +296,7 @@
             <el-table-column prop="score" label="成绩" width="200"/>
             <el-table-column label="操作" width="200">
               <template #default="scope">
-                <el-button type="text" @click="jumpToCodemirror" disabled>源码</el-button>
+                <el-button type="text" @click="jumpToCodemirror(scope.row.owner)">源码</el-button>
                 |
                 <el-button type="text" @click="jumpToResultDetail(scope.row.id)">详情</el-button>
               </template>
@@ -752,7 +752,9 @@ export default {
       window.open(`https://coder.seec.seecoder.cn/api/file/result/${examId}/detailed`);
     },
     //查看提交代码
-    jumpToCodemirror() {
+    jumpToCodemirror(user) {
+      let nextURL = `https://ide.seec.seecoder.cn/?examId=${this.exam.id}&studentId=${user.id}&id_token=${this.$store.state.user.token}`;
+      window.open(nextURL);
     },
     //跳转到具体结果信息页
     jumpToResultDetail(resultId) {

+ 55 - 30
src/views/EvalPage/teacherExamDetails.vue

@@ -70,6 +70,7 @@
                 v-if="!fetching"
                 type="primary"
                 style="float: right"
+                :disabled="this.examState==='FINISHED'"
                 @click="showQuestionList = true"
             >
               调整试题
@@ -89,9 +90,9 @@
       <el-card class="box-card">
         <span style="font-size: 20px">评测名单</span>
         <el-table :data="joinedUsers" style="width: 100%">
-          <el-table-column type="index" width="50"/>
-          <el-table-column prop="name" label="用户名" width="180"/>
-          <el-table-column prop="email" label="邮箱" width="180"/>
+          <el-table-column type="index" width="100"/>
+          <el-table-column prop="name" label="用户名" width="360"/>
+          <el-table-column prop="email" label="邮箱" width="360"/>
           <el-table-column prop="score" label="成绩"/>
         </el-table>
       </el-card>
@@ -111,6 +112,7 @@
 <script>
 import examQuestionsInfo from "@/views/EvalPage/ExamQuestionsInfo.vue";
 import questionList from "@/views/EvalPage/QuestionList.vue";
+import dayjs from "dayjs";
 
 export default {
   name: "teacherExamDetails",
@@ -130,12 +132,34 @@ export default {
       showQuestionInfo: true,
       showQuestionList: false,
       examQuestionAndScore: {},
+      examState: ""
     };
   },
   computed: {
 
   },
 
+
+  created() {
+    this.examId = this.$route.params.examId;
+    // const examId = 47;
+    console.log(this.examId);
+    this.$apis.getExamById(this.examId).then(_res => {
+      this.examInfo = _res.data.data.result;
+      console.log(this.examInfo);
+      this.examInfo.skills = this.examInfo.skills.toString();
+      this.examState=this.computeExamStateText(this.examInfo.startTime,this.examInfo.endTime);
+      console.log(this.examState);
+
+
+    });
+  },
+  mounted() {
+    this.getExamQuestions();
+    this.getExamJoiners();
+  },
+
+
   methods: {
     onClickHideButton() {
       this.showQuestionInfo = false;
@@ -187,39 +211,40 @@ export default {
               }
             });
           });
-    }
-  },
-
-  created() {
-    this.examId = this.$route.params.examId;
-    // const examId = 47;
-    console.log(this.examId);
-    this.$apis.getExamById(this.examId).then(_res => {
-      this.examInfo = _res.data.data.result;
-      console.log(this.examInfo);
-      this.examInfo.skills = this.examInfo.skills.toString();
-    });
-  },
-  mounted() {
-    this.getExamQuestions();
+    },
 
-    this.$apis.getExamJoinedUsers(this.examId).then(_res => {
-      this.joinedUsers = _res.data.data.result;
-      this.$apis.getAllReportByExamId(this.examId).then(res => {
-        const that = this;
-        this.joinedUsers.forEach((user) => {
-          res.data.data.result.forEach((report) => {
-            if (report.userId === user.id) {
-              that.$set(user, "score", report.score);
-              //todo 注意是否有用
-            }
+    getExamJoiners(){
+      this.$apis.getExamJoinedUsers(this.examId).then(_res => {
+        this.joinedUsers = _res.data.data.result;
+        this.$apis.getAllReportByExamId(this.examId).then(res => {
+          this.joinedUsers.forEach((user) => {
+            res.data.data.result.forEach((report) => {
+              if (report.userId === user.id) {
+                user["score"]=report.score;
+              }
+            });
           });
         });
       });
-    });
-  },
+    },
+
 
+    computeExamStateText(startTime, endTime) {
+      const TIME_FORMAT = "YYYY-MM-DD HH:mm:ss";
+      const now = dayjs();
+      const formattedStartTime = dayjs(startTime, TIME_FORMAT);
+      const formattedEndTime = dayjs(endTime, TIME_FORMAT);
 
+      if (formattedEndTime < now) {
+        return "FINISHED";
+      }
+      if (formattedStartTime > now) {
+        return "NOT_STARTED";
+      }
+      return "RUNNING";
+    },
+
+  },
 
 };
 </script>