考核评估 我的考试 考试页面
This commit is contained in:
parent
5827acd015
commit
2caa0da8c6
@ -1,5 +1,6 @@
|
||||
package com.inspur.examine.vo;
|
||||
|
||||
import com.inspur.common.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@ -44,6 +45,36 @@ public class MyExamVO {
|
||||
*/
|
||||
private String examRules;
|
||||
|
||||
/**
|
||||
* 单选题数量
|
||||
*/
|
||||
private Integer singleChoice;
|
||||
|
||||
/**
|
||||
* 多选题数量
|
||||
*/
|
||||
private Integer multipleChoice;
|
||||
|
||||
/**
|
||||
* 判断题数量
|
||||
*/
|
||||
private Integer judge;
|
||||
|
||||
/**
|
||||
* 单选题分数
|
||||
*/
|
||||
private BigDecimal singleChoiceScore;
|
||||
|
||||
/**
|
||||
* 多选题分数
|
||||
*/
|
||||
private BigDecimal multipleChoiceScore;
|
||||
|
||||
/**
|
||||
* 判断题分数
|
||||
*/
|
||||
private BigDecimal judgeScore;
|
||||
|
||||
/**
|
||||
* 总分数
|
||||
*/
|
||||
|
@ -173,7 +173,14 @@
|
||||
ei.exam_duration AS examDuration,
|
||||
ei.exam_rules AS examRules,
|
||||
ei.total_score AS totalScore,
|
||||
ei.pass_score AS passScore
|
||||
ei.pass_score AS passScore,
|
||||
ei.pass_score AS passScore,
|
||||
ei.single_choice as singleChoice,
|
||||
ei.multiple_choice as multipleChoice,
|
||||
ei.judge as judge,
|
||||
ei.single_choice_score as singleChoiceScore,
|
||||
ei.multiple_choice_score as multipleChoiceScore,
|
||||
ei.judge_score as judgeScore
|
||||
FROM
|
||||
exam_paper_info AS epi
|
||||
LEFT JOIN exam_info AS ei ON epi.exam_id = ei.id
|
||||
@ -219,7 +226,13 @@
|
||||
ei.exam_duration AS examDuration,
|
||||
ei.exam_rules AS examRules,
|
||||
ei.total_score AS totalScore,
|
||||
ei.pass_score AS passScore
|
||||
ei.pass_score AS passScore,
|
||||
ei.single_choice as singleChoice,
|
||||
ei.multiple_choice as multipleChoice,
|
||||
ei.judge as judge,
|
||||
ei.single_choice_score as singleChoiceScore,
|
||||
ei.multiple_choice_score as multipleChoiceScore,
|
||||
ei.judge_score as judgeScore
|
||||
FROM
|
||||
exam_paper_info AS epi
|
||||
LEFT JOIN exam_info AS ei ON epi.exam_id = ei.id
|
||||
|
@ -51,3 +51,20 @@ export function getAttestationList(query) {
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 获取考试信息以及试题
|
||||
export function getHistoryExam(id) {
|
||||
return request({
|
||||
url: '/examine/myExamine/getHistoryExam/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 提交考试
|
||||
export function submitExam(data) {
|
||||
return request({
|
||||
url: '/examine/myExamine/submitExam',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
@ -232,18 +232,121 @@
|
||||
/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
|
||||
<el-dialog :title="answerTitle" :visible.sync="answerOpen" width="1400px" :before-close="beforeCloseAnswerDialog" append-to-body>
|
||||
<h1 style="text-align: center;"><b>{{answerForm.examName}}</b></h1>
|
||||
<h2 style="text-align: center;">考生名称:{{answerForm.examineName}} 考试时长:{{answerForm.examDuration}}分钟</h2>
|
||||
<h2 style="text-align: center;">满分:{{answerForm.totalScore}} 通过分数{{answerForm.passScore}}</h2>
|
||||
<h2 v-if="!answerDisabled" style="text-align: center;">考试倒计时: {{ minutes }}:{{ seconds }}</h2>
|
||||
<h3>考试规则:{{answerForm.examRules}}</h3>
|
||||
<el-card>
|
||||
<div slot="header">
|
||||
<span><i class="el-icon-monitor"></i>单选题(共{{answerForm.singleChoice}}题,每题{{answerForm.singleChoiceScore}}分)</span>
|
||||
</div>
|
||||
<div v-for="singleChoice in answerForm.singleChoiceList">
|
||||
<h3>{{singleChoice.sorted}}、{{singleChoice.questionTitle}}({{answerForm.singleChoiceScore}}分)</h3>
|
||||
<el-radio-group v-model="singleChoice.examineAnswer" style="display: block;line-height:30px" v-for="(item,index) in singleChoice.questionOptionsObject" :key="index">
|
||||
<el-radio :disabled="answerDisabled" :label="item.lable">{{item.title}}</el-radio>
|
||||
</el-radio-group>
|
||||
<div v-if="answerDisabled" style="background-color: rgb(238,245,255)">
|
||||
正确答案:<span style="color: green">{{singleChoice.questionAnswer}}</span>
|
||||
<br>
|
||||
您的答案是:{{ singleChoice.examineAnswer === null || singleChoice.examineAnswer === '' ? "未作答" : singleChoice.examineAnswer }}
|
||||
<div v-if="singleChoice.isSure !== null && singleChoice.isSure !== ''">
|
||||
<span v-if="singleChoice.isSure === '0'" style="color: green">回答正确</span>
|
||||
<span v-if="singleChoice.isSure === '1'" style="color: red">回答错误</span>
|
||||
</div>
|
||||
<span v-if="singleChoice.isSure === '1'">解析:{{singleChoice.questionAnswerAnalysis}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
<el-card>
|
||||
<div slot="header">
|
||||
<span><i class="el-icon-monitor"></i>多选题(共{{answerForm.multipleChoice}}题,每题{{answerForm.multipleChoiceScore}}分)</span>
|
||||
</div>
|
||||
<div v-for="multiChoice in answerForm.multiChoiceList">
|
||||
<h3>{{multiChoice.sorted}}、{{multiChoice.questionTitle}}({{answerForm.multipleChoiceScore}}分)</h3>
|
||||
<el-checkbox-group v-model="multiChoice.examineAnswerList">
|
||||
<el-checkbox
|
||||
:disabled="answerDisabled"
|
||||
style="display: block;line-height:30px"
|
||||
v-for="(item,index) in multiChoice.questionOptionsObject"
|
||||
:key="index"
|
||||
:label="item.lable">{{item.title}}</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
<div v-if="answerDisabled" style="background-color: rgb(238,245,255)">
|
||||
正确答案:<span style="color: green">{{multiChoice.questionAnswer}}</span>
|
||||
<br>
|
||||
您的答案是:{{ multiChoice.examineAnswer === null || multiChoice.examineAnswer === '' ? "未作答" : multiChoice.examineAnswer }}
|
||||
<div v-if="multiChoice.isSure !== null && multiChoice.isSure !== ''">
|
||||
<span v-if="multiChoice.isSure === '0'" style="color: green">回答正确</span>
|
||||
<span v-if="multiChoice.isSure === '1'" style="color: red">回答错误</span>
|
||||
</div>
|
||||
<span v-if="multiChoice.isSure === '1'">解析:{{multiChoice.questionAnswerAnalysis}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
<el-card>
|
||||
<div slot="header">
|
||||
<span><i class="el-icon-monitor"></i>判断题(共{{answerForm.judge}}题,每题{{answerForm.judgeScore}}分)</span>
|
||||
</div>
|
||||
<div v-for="judge in answerForm.judgeList">
|
||||
<h3>{{judge.sorted}}、{{judge.questionTitle}}({{answerForm.judgeScore}}分)</h3>
|
||||
<el-radio-group v-model="judge.examineAnswer" style="width: 100px" v-for="(item,index) in judge.questionOptionsObject" :key="index">
|
||||
<el-radio :disabled="answerDisabled" :label="item.lable">{{item.title}}</el-radio>
|
||||
</el-radio-group>
|
||||
<div v-if="answerDisabled" style="background-color: rgb(238,245,255)">
|
||||
正确答案:<span style="color: green">{{judge.questionAnswer === 'T' ? "正确":"错误"}}</span>
|
||||
<br>
|
||||
您的答案是:{{ judge.examineAnswer === null || judge.examineAnswer === '' ? "未作答" : judge.examineAnswer === 'T' ? "正确":"错误" }}
|
||||
<div v-if="judge.isSure !== null && judge.isSure !== ''">
|
||||
<span v-if="judge.isSure === '0'" style="color: green">回答正确</span>
|
||||
<span v-if="judge.isSure === '1'" style="color: red">回答错误</span>
|
||||
</div>
|
||||
<span v-if="judge.isSure === '1'">解析:{{judge.questionAnswerAnalysis}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button v-if="!answerDisabled" type="primary" @click="submitExam">交 卷</el-button>
|
||||
<el-button v-if="answerDisabled" type="primary" @click="closeAnswerDialog">关 闭</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
|
||||
import { getExamList, generateExam, waitExamList, getExam, getExamHistoryList,getAttestationList} from '@/api/examine/myExamine'
|
||||
import { getExamList, generateExam, waitExamList, getExam, getExamHistoryList,getAttestationList,getHistoryExam,submitExam} from '@/api/examine/myExamine'
|
||||
import { examInfoSelection } from "@/api/examine/examInfo";
|
||||
import { parseTime } from '@/utils/ruoyi'
|
||||
|
||||
export default {
|
||||
name: 'myExamine',
|
||||
dicts: ['exam_type', 'exam_level', 'examine_result'],
|
||||
data() {
|
||||
return {
|
||||
// 初始化倒计时时间(秒)
|
||||
countdownTime: 600,
|
||||
// 倒计时定时器ID
|
||||
intervalId: null,
|
||||
answerDisabled: false,
|
||||
examStart:null,
|
||||
answerForm:{
|
||||
id:null,
|
||||
examName:null,
|
||||
examineName:null,
|
||||
attestationName:null,
|
||||
examDuration:null,
|
||||
examRules:null,
|
||||
totalScore:null,
|
||||
passScore:null,
|
||||
singleChoiceList:[],
|
||||
multiChoiceList:[],
|
||||
judgeList:[]
|
||||
},
|
||||
answerTitle:"",
|
||||
answerOpen:false,
|
||||
activeName: '1',
|
||||
examQueryParams: {
|
||||
pageNum: 1,
|
||||
@ -295,14 +398,121 @@ export default {
|
||||
attestationLoading: false,
|
||||
attestationList: [],
|
||||
attestationTotal: 0,
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
// 计算属性,返回分和秒
|
||||
minutes() {
|
||||
return Math.floor(this.countdownTime / 60).toString().padStart(2, '0');
|
||||
},
|
||||
seconds() {
|
||||
return (this.countdownTime % 60).toString().padStart(2, '0');
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.getExamList()
|
||||
},
|
||||
beforeDestroy() {
|
||||
// 清除间隔调用
|
||||
if (this.intervalId) {
|
||||
clearInterval(this.intervalId);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
//关闭弹窗
|
||||
closeAnswerDialog(){
|
||||
this.answerOpen = false;
|
||||
},
|
||||
//关闭弹窗前
|
||||
beforeCloseAnswerDialog(){
|
||||
if(!this.answerDisabled){
|
||||
this.submitExam();
|
||||
}else {
|
||||
this.answerOpen = false;
|
||||
}
|
||||
},
|
||||
//开始倒计时
|
||||
startCountdown() {
|
||||
this.intervalId = setInterval(() => {
|
||||
if (this.countdownTime > 0) {
|
||||
this.countdownTime--;
|
||||
} else {
|
||||
// 倒计时结束,清除定时器
|
||||
clearInterval(this.intervalId);
|
||||
this.intervalId = null;
|
||||
// 可以添加倒计时结束后的逻辑
|
||||
}
|
||||
}, 1000);
|
||||
},
|
||||
//停止计时器
|
||||
stopCountdown() {
|
||||
// 清除定时器
|
||||
if (this.intervalId) {
|
||||
clearInterval(this.intervalId);
|
||||
this.intervalId = null;
|
||||
}
|
||||
},
|
||||
//交卷
|
||||
submitExam(){
|
||||
this.$confirm('是否确定交卷?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.stopCountdown();
|
||||
const answerList = [];
|
||||
//单选题
|
||||
if (this.answerForm.singleChoiceList.length > 0){
|
||||
this.answerForm.singleChoiceList.forEach(item=>{
|
||||
const data = {
|
||||
id:item.id,
|
||||
examineAnswer:item.examineAnswer
|
||||
};
|
||||
answerList.push(data)
|
||||
})
|
||||
}
|
||||
//判断题
|
||||
if (this.answerForm.judgeList.length > 0){
|
||||
this.answerForm.judgeList.forEach(item=>{
|
||||
const data = {
|
||||
id:item.id,
|
||||
examineAnswer:item.examineAnswer
|
||||
};
|
||||
answerList.push(data)
|
||||
})
|
||||
}
|
||||
//多选题
|
||||
if (this.answerForm.multiChoiceList.length > 0){
|
||||
this.answerForm.multiChoiceList.forEach(item=>{
|
||||
if (item.examineAnswerList !== []){
|
||||
const data = {
|
||||
id:item.id,
|
||||
examineAnswer:item.examineAnswerList.sort().join(",")
|
||||
}
|
||||
answerList.push(data)
|
||||
}else {
|
||||
const data = {
|
||||
id:item.id
|
||||
}
|
||||
answerList.push(data)
|
||||
}
|
||||
})
|
||||
}
|
||||
const submitExamForm = {
|
||||
paperId:this.answerForm.id,
|
||||
examStartTime:this.examStart,
|
||||
examEndTime:parseTime(new Date,"{y}-{m}-{d} {h}:{mi}:{s}"),
|
||||
answerList:answerList
|
||||
};
|
||||
console.log(submitExamForm);
|
||||
submitExam(submitExamForm).then(()=>{
|
||||
this.$modal.msgSuccess("已交卷");
|
||||
this.getPaperList();
|
||||
this.answerOpen = false;
|
||||
this.examStart = null;
|
||||
})
|
||||
})
|
||||
},
|
||||
handleClickTab(tab, event) {
|
||||
console.log(tab.name)
|
||||
if ('1' === tab.name) {
|
||||
@ -367,7 +577,36 @@ export default {
|
||||
},
|
||||
//开始考试
|
||||
handleStartExam(row){
|
||||
|
||||
this.$confirm('开始考试后无法取消, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.answerTitle = "考试中";
|
||||
this.answerDisabled = false;
|
||||
this.examStart = parseTime(new Date,"{y}-{m}-{d} {h}:{mi}:{s}");
|
||||
this.answerForm = {};
|
||||
getExam(row.id).then(res=>{
|
||||
this.answerForm = res;
|
||||
if (this.answerForm != null){
|
||||
this.answerOpen = true;
|
||||
this.countdownTime = this.answerForm.examDuration * 60;
|
||||
this.startCountdown();
|
||||
this.answerForm.singleChoiceList.forEach(item=>{
|
||||
item.questionOptionsObject = JSON.parse(item.questionOptions);
|
||||
});
|
||||
this.answerForm.multiChoiceList.forEach(item=>{
|
||||
item.questionOptionsObject = JSON.parse(item.questionOptions);
|
||||
if (item.examineAnswer === null || item.examineAnswer === ''){
|
||||
this.$set(item, 'examineAnswerList', [])
|
||||
}
|
||||
});
|
||||
this.answerForm.judgeList.forEach(item=>{
|
||||
item.questionOptionsObject = JSON.parse(item.questionOptions);
|
||||
})
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
examHistoryHandleQuery() {
|
||||
@ -389,9 +628,31 @@ export default {
|
||||
});
|
||||
},
|
||||
handleShowExam(row){
|
||||
|
||||
this.answerTitle = "答题详情";
|
||||
this.answerDisabled = true;
|
||||
this.answerForm = {};
|
||||
this.answerOpen = true;
|
||||
getHistoryExam(row.id).then(res=>{
|
||||
this.answerForm = res;
|
||||
if (this.answerForm != null){
|
||||
this.answerForm.singleChoiceList.forEach(item=>{
|
||||
console.log(item)
|
||||
item.questionOptionsObject = JSON.parse(item.questionOptions);
|
||||
});
|
||||
this.answerForm.multiChoiceList.forEach(item=>{
|
||||
item.questionOptionsObject = JSON.parse(item.questionOptions);
|
||||
if (item.examineAnswer === null || item.examineAnswer === ''){
|
||||
this.$set(item, 'examineAnswerList', [])
|
||||
}else {
|
||||
this.$set(item, 'examineAnswerList', item.examineAnswer.split(","))
|
||||
}
|
||||
});
|
||||
this.answerForm.judgeList.forEach(item=>{
|
||||
item.questionOptionsObject = JSON.parse(item.questionOptions);
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
attestationHandleQuery() {
|
||||
this.attestationQueryParams.pageNum = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user