|
|
@@ -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>
|