考试结果
This commit is contained in:
@@ -17,7 +17,7 @@ export default {
|
||||
appName: '法治学习',
|
||||
data() {
|
||||
return {
|
||||
currIndex: 1,
|
||||
currIndex: 0,
|
||||
tabs: [
|
||||
{
|
||||
name: '在线课堂',
|
||||
|
||||
@@ -2,28 +2,30 @@
|
||||
<div class="result">
|
||||
<u-navbar title="考试结果" :background="backgroundNavbar"></u-navbar>
|
||||
<div class="result_info">
|
||||
<div class="grade">100</div>
|
||||
<div class="grade">{{ data.score }}</div>
|
||||
<div class="tips">
|
||||
<div>考试分数</div>
|
||||
<div>超过<span>99%</span>的人</div>
|
||||
<div>超过<span v-if="data.status==0">{{status0}}</span><span v-if="data.status==1">{{status1}}</span>%的人</div>
|
||||
</div>
|
||||
|
||||
<div class="card_list">
|
||||
<div class="pass">
|
||||
<div>结果</div>
|
||||
<div class="col_pass">通过</div>
|
||||
<div class="col_pass">
|
||||
<span v-if="data.status==0">未</span><span v-else>已</span>通过
|
||||
</div>
|
||||
</div>
|
||||
<div class="time">
|
||||
<div>用时</div>
|
||||
<div class="col_333">1小时32分</div>
|
||||
<div class="col_333">{{ time }}</div>
|
||||
</div>
|
||||
<div class="pass_num">
|
||||
<div>对题数</div>
|
||||
<div class="col_333">10</div>
|
||||
<div class="col_333">{{ data.rightCount }}</div>
|
||||
</div>
|
||||
<div class="nopass_num">
|
||||
<div>对题数</div>
|
||||
<div class="col_333">1</div>
|
||||
<div>错题数</div>
|
||||
<div class="col_333">{{ data.examCount - data.rightCount }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn" @click="back">返回</div>
|
||||
@@ -41,6 +43,35 @@ export default {
|
||||
background: "url('https://cdn.cunwuyun.cn/qujing/navbar.png') no-repeat",
|
||||
backgroundSize: '100% 100%',
|
||||
},
|
||||
data: {},
|
||||
time: '',
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
status0() {
|
||||
let arr = [45,55,58]
|
||||
let index = parseInt(Math.random()*arr.length)
|
||||
return arr[index]
|
||||
},
|
||||
status1() {
|
||||
let arr = [97,98,99]
|
||||
let index = parseInt(Math.random()*arr.length)
|
||||
return arr[index]
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'data.time'(v) {
|
||||
if(v) {
|
||||
const hour = Math.floor(v / 60) // 小时
|
||||
const min = v % 60 // 分钟
|
||||
if (hour > 0 && min > 0) {
|
||||
this.time = `${hour}小时${min}分钟`;
|
||||
} else if (hour > 0 && min <= 0) {
|
||||
this.time = `${min}小时`;
|
||||
} else if (hour <= 0 && min > 0) {
|
||||
this.time = `${min}分钟`;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -48,9 +79,10 @@ export default {
|
||||
uni.navigateBack({
|
||||
delta: 2,
|
||||
})
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
},
|
||||
onLoad(o) {
|
||||
this.data = o
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -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.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)
|
||||
|
||||
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() {
|
||||
|
||||
Reference in New Issue
Block a user