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