assessmentType

This commit is contained in:
shijingjing
2023-02-15 11:21:37 +08:00
parent 3d1614e99a
commit eaa92c2dfe

View File

@@ -75,11 +75,12 @@ export default {
subjectConfigs: [],
score: 0,
assessments: [], // 不合格的分数段
status: 1, // 考试结果0未通过、1通过
status: null, // 考试结果0未通过、1通过
startTime: '',
nowTime: '', // 时间戳
studyDuration: 0,
assessmentType: ''
assessmentType: '',
examinationId: '',
}
},
methods: {
@@ -94,6 +95,7 @@ export default {
this.list = res.data.questions
this.subjectConfigs = res.data.subjectConfigs
this.assessments = res.data.assessments
this.examinationId = res.data.id
}
})
},
@@ -135,39 +137,56 @@ export default {
this.showTiJiao = true;
}
},
getScoreType(score) {
let conditionMap = [
(a, b) => a - b >= 0,
(a, b) => a - b > 0,
(a, b) => a - b == 0,
(a, b) => a - b <= 0,
(a, b) => a - b < 0
]
let type = ['0','1','2','3']
for (let i = 0; i < this.assessments.length; i++) {
let ret = this.assessments[i].upScore;
let con = this.assessments[i].upCondition;
if (conditionMap[con](score, ret)) {
this.assessmentType = type[i]
}
}
},
// 提交
submit() {
// 分数区间
// switch(this.assessments) {
// case this.assessments[0]: console.log(1);
// break;
// case 2:
// }
this.getScoreType(this.score)
// 用时
const endTime = new Date().getTime()
let endTime = new Date().getTime()
this.studyDuration = Math.ceil((endTime - this.nowTime) / 1000 / 60)
// 是否合格
const buhege = this.assessments.filter(e=> e.assessmentType == 3)
if(buhege.upCondition == 3) { // 3小于等于、4小于
if(this.score <= buhege.upScore) {
this.status = 0
}
} else if(buhege.upCondition == 4) {
if(this.score < buhege.upScore) {
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
}
}
// this.$instance.post(`/app/appexaminationinfo/commit`,{
// assessmentType: this.assessmentType,
// examinationId: this.id,
// startTime: this.startTime,
// status: this.status,
// studyDuration: this.studyDuration,
// }).then(res=> {
// if(res?.code == 0) {
if(buhege[0].upCondition == 4) {
if(this.score < buhege[0].upScore) {
this.status = 0
}
}
this.$instance.post(`/app/appexaminationinfo/commit`,{
assessmentType: this.assessmentType,
examinationId: this.examinationId,
startTime: this.startTime,
status: this.status,
studyDuration: this.studyDuration,
score: this.score
}).then(res=> {
if(res?.code == 0) {
this.$u.toast('提交成功')
// uni.navigateTo({url: './result'})
// }
// })
}
}).catch(err=> this.$u.toast(err.masg))
},
},
onReachBottom() {