diff --git a/src/project/qujing/AppLegalLearning/AppLegalLearning.vue b/src/project/qujing/AppLegalLearning/AppLegalLearning.vue index 65f201f..95cf5c1 100644 --- a/src/project/qujing/AppLegalLearning/AppLegalLearning.vue +++ b/src/project/qujing/AppLegalLearning/AppLegalLearning.vue @@ -17,7 +17,7 @@ export default { appName: '法治学习', data() { return { - currIndex: 1, + currIndex: 0, tabs: [ { name: '在线课堂', diff --git a/src/project/qujing/AppLegalLearning/result.vue b/src/project/qujing/AppLegalLearning/result.vue index 6698d9e..bafedb1 100644 --- a/src/project/qujing/AppLegalLearning/result.vue +++ b/src/project/qujing/AppLegalLearning/result.vue @@ -2,28 +2,30 @@
-
100
+
{{ data.score }}
考试分数
-
超过99%的人
+
超过{{status0}}{{status1}}%的人
结果
-
通过
+
+ 通过 +
用时
-
1小时32分
+
{{ time }}
对题数
-
10
+
{{ data.rightCount }}
-
对题数
-
1
+
错题数
+
{{ data.examCount - data.rightCount }}
返回
@@ -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 } } diff --git a/src/project/qujing/AppLegalLearning/testForm.vue b/src/project/qujing/AppLegalLearning/testForm.vue index 1adf136..534aad0 100644 --- a/src/project/qujing/AppLegalLearning/testForm.vue +++ b/src/project/qujing/AppLegalLearning/testForm.vue @@ -12,7 +12,7 @@
-
{{ item.title }}{{score}}
+
{{ item.title }}
- {{ opt.sort }}: {{ opt.content}} {{opt.isChecked}} + {{ opt.sort }}: {{ opt.content}}
@@ -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() {