考试结果

This commit is contained in:
shijingjing
2023-02-15 15:00:55 +08:00
parent eaa92c2dfe
commit 920180d95b
3 changed files with 64 additions and 19 deletions

View File

@@ -12,7 +12,7 @@
<div>
<div >
<!-- 题目 -->
<div>{{ item.title }}{{score}}</div>
<div>{{ item.title }}</div>
<!-- 单选,判断 -->
<div class="answer_list" v-if="item.type==0 || item.type==2">
<div class="answer_item" v-for="(opt,inx) in item.items" :key="inx"
@@ -26,7 +26,7 @@
<div class="answer_item" v-for="(opt,inx) in item.items" :key="inx"
:class="{'Checked': opt.isChecked,'Succeed': showAnalysis && opt.checked == 1, 'Error': showAnalysis && opt.isChecked && opt.checked == 0}"
@click="itemClick(inx)">
{{ opt.sort }}: {{ opt.content}} {{opt.isChecked}}
{{ opt.sort }}: {{ opt.content}}
</div>
</div>
</div>
@@ -81,6 +81,8 @@ export default {
studyDuration: 0,
assessmentType: '',
examinationId: '',
rightCount: 0,
flag: false,
}
},
methods: {
@@ -123,11 +125,13 @@ export default {
if(this.list[this.activeIndex].type==0 || this.list[this.activeIndex].type==2){
if(this.list[this.activeIndex].items[this.clickIndex].checked==1) {
this.score=this.score + this.subjectConfigs[this.list[this.activeIndex].type].eachScore
this.rightCount ++
}
}
if(this.list[this.activeIndex].type==1) { // 多选
if(this.list[this.activeIndex].items.every(item=>item.checked===item.isChecked)){
this.score=this.score + this.subjectConfigs[this.list[this.activeIndex].type].eachScore
this.score = this.score + this.subjectConfigs[this.list[this.activeIndex].type].eachScore
this.rightCount ++
}
}
if(this.activeIndex < this.list.length - 1) {
@@ -151,19 +155,19 @@ export default {
let con = this.assessments[i].upCondition;
if (conditionMap[con](score, ret)) {
this.assessmentType = type[i]
break;
}
}
},
// 提交
submit() {
// 分数区间
if(this.flag) return
this.getScoreType(this.score)
// 用时
let endTime = new Date().getTime()
this.studyDuration = Math.ceil((endTime - this.nowTime) / 1000 / 60)
// 是否合格
let buhege = this.assessments.filter(e=> e.assessmentType == 3)
if(buhege[0].upCondition == 3) { // 3小于等于、4小于
if(this.score <= buhege[0].upScore) {
this.status = 0
@@ -174,6 +178,7 @@ export default {
this.status = 0
}
}
this.flag = true
this.$instance.post(`/app/appexaminationinfo/commit`,{
assessmentType: this.assessmentType,
examinationId: this.examinationId,
@@ -183,10 +188,18 @@ export default {
score: this.score
}).then(res=> {
if(res?.code == 0) {
this.flag = false
this.$u.toast('提交成功')
// uni.navigateTo({url: './result'})
setTimeout(()=> {
uni.navigateTo({
url: `./result?status=${this.status}&time=${this.studyDuration}&rightCount=${this.rightCount}&examCount=${this.list.length}&score=${this.score}`
})
}, 600)
}
}).catch(err=> this.$u.toast(err.masg))
}).catch(err=> {
this.flag = false
this.$u.toast(err.masg)
})
},
},
onReachBottom() {