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