bug修复
This commit is contained in:
parent
345c999df7
commit
dbbb7c1269
|
|
@ -154,10 +154,13 @@
|
||||||
:show="showModal"
|
:show="showModal"
|
||||||
title="本次答题正确率"
|
title="本次答题正确率"
|
||||||
showCancelButton
|
showCancelButton
|
||||||
@cancel="handleClose"
|
@cancel="handleConfirm"
|
||||||
@confirm="handleConfirm"
|
@confirm="handleClose"
|
||||||
cancelText="结束答题"
|
cancelText="继续答题"
|
||||||
confirmText="继续答题"
|
confirmText="结束答题"
|
||||||
|
:buttonReverse="true"
|
||||||
|
confirmColor="#606266"
|
||||||
|
cancelColor="#2979ff"
|
||||||
>
|
>
|
||||||
<view class="slot-content">
|
<view class="slot-content">
|
||||||
<div class="correctRate">{{ correctRate }}%</div>
|
<div class="correctRate">{{ correctRate }}%</div>
|
||||||
|
|
@ -242,7 +245,8 @@ export default {
|
||||||
questionListSelect: [],
|
questionListSelect: [],
|
||||||
studyId: '', // 学习id
|
studyId: '', // 学习id
|
||||||
fileUrl: config.fileUrl,
|
fileUrl: config.fileUrl,
|
||||||
intervalId: ''
|
intervalId: '',
|
||||||
|
isEnd: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(opt) {
|
onLoad(opt) {
|
||||||
|
|
@ -260,6 +264,7 @@ export default {
|
||||||
this.getPracticeQuestion()
|
this.getPracticeQuestion()
|
||||||
},
|
},
|
||||||
onUnload() {
|
onUnload() {
|
||||||
|
if (this.isEnd) return
|
||||||
// 清除计时器
|
// 清除计时器
|
||||||
clearInterval(this.intervalId)
|
clearInterval(this.intervalId)
|
||||||
this.handleClose()
|
this.handleClose()
|
||||||
|
|
@ -271,7 +276,7 @@ export default {
|
||||||
practiceId: this.practiceId,
|
practiceId: this.practiceId,
|
||||||
recordId: this.recordId,
|
recordId: this.recordId,
|
||||||
isNew: this.isNew || '',
|
isNew: this.isNew || '',
|
||||||
isMiss: this.isError ? 1 : ''
|
isMiss: this.isError ? '1' : ''
|
||||||
}
|
}
|
||||||
// const res = await getPracticeItData(params)
|
// const res = await getPracticeItData(params)
|
||||||
// this.trueNum = res.data.trueNum
|
// this.trueNum = res.data.trueNum
|
||||||
|
|
@ -308,7 +313,7 @@ export default {
|
||||||
recordId: this.recordId,
|
recordId: this.recordId,
|
||||||
isNew: this.isNew || '',
|
isNew: this.isNew || '',
|
||||||
isOutOfOrder: this.isOutOfOrder || '',
|
isOutOfOrder: this.isOutOfOrder || '',
|
||||||
isMiss: this.isError ? 1 : ''
|
isMiss: this.isError ? '1' : ''
|
||||||
}
|
}
|
||||||
// const res = await getPracticeQuestion(params)
|
// const res = await getPracticeQuestion(params)
|
||||||
// this.recordId = res.data.recordId
|
// this.recordId = res.data.recordId
|
||||||
|
|
@ -352,7 +357,7 @@ export default {
|
||||||
practiceId: this.practiceId,
|
practiceId: this.practiceId,
|
||||||
operate: item || '',
|
operate: item || '',
|
||||||
sort: this.nowNum,
|
sort: this.nowNum,
|
||||||
isMiss: this.isError ? 1 : ''
|
isMiss: this.isError ? '1' : ''
|
||||||
}
|
}
|
||||||
console.log('🚀 ~ handleJump ~ params:', params)
|
console.log('🚀 ~ handleJump ~ params:', params)
|
||||||
// const res = await changeQuestion(params)
|
// const res = await changeQuestion(params)
|
||||||
|
|
@ -380,8 +385,8 @@ export default {
|
||||||
async getPracticeQuestionList() {
|
async getPracticeQuestionList() {
|
||||||
const params = {
|
const params = {
|
||||||
recordId: this.recordId,
|
recordId: this.recordId,
|
||||||
id: this.practiceId,
|
practiceId: this.practiceId,
|
||||||
isMiss: this.isError ? 1 : ''
|
isMiss: this.isError ? '1' : ''
|
||||||
}
|
}
|
||||||
// const res = await getPracticeQuestionList(params)
|
// const res = await getPracticeQuestionList(params)
|
||||||
// console.log('🚀 ~ getPracticeQuestionList ~ res:', res)
|
// console.log('🚀 ~ getPracticeQuestionList ~ res:', res)
|
||||||
|
|
@ -471,7 +476,8 @@ export default {
|
||||||
recordId: this.recordId,
|
recordId: this.recordId,
|
||||||
questionId: this.questionList[0].questionId,
|
questionId: this.questionList[0].questionId,
|
||||||
selectAnswer: option.optionIdent,
|
selectAnswer: option.optionIdent,
|
||||||
isTrue: option.optionIdent == this.questionList[0].correctGrade ? 1 : 0
|
isTrue: option.optionIdent == this.questionList[0].correctGrade ? 1 : 0,
|
||||||
|
isMiss: this.isError ? '1' : ''
|
||||||
}
|
}
|
||||||
console.log('🚀 ~ handleOption ~ params:', params)
|
console.log('🚀 ~ handleOption ~ params:', params)
|
||||||
// 提交答案
|
// 提交答案
|
||||||
|
|
@ -606,17 +612,25 @@ export default {
|
||||||
},
|
},
|
||||||
// 结束答题
|
// 结束答题
|
||||||
handleClose() {
|
handleClose() {
|
||||||
|
this.isEnd = true
|
||||||
// 停止计时
|
// 停止计时
|
||||||
clearInterval()
|
clearInterval()
|
||||||
console.log('结束')
|
console.log('结束', this.usedTime)
|
||||||
// 保存练习时长
|
// 保存练习时长
|
||||||
// savePracticeDuration({
|
// savePracticeDuration({
|
||||||
// id: this.practiceId,
|
// id: this.practiceId,
|
||||||
// practiceDuration: Math.ceil(this.usedTime.split(':')[0] * 60 + this.usedTime.split(':')[1] / 60)
|
// practiceDuration: Math.ceil(this.usedTime.split(':')[0] * 60 + this.usedTime.split(':')[1] / 60)
|
||||||
// })
|
// })
|
||||||
|
// 将this.usedTime 00:00:00 转换为分钟
|
||||||
|
let time = this.usedTime.split(':').reduce((acc, cur, index) => {
|
||||||
|
return acc + cur * Math.pow(60, 2 - index)
|
||||||
|
}, 0)
|
||||||
|
// 再将秒数转换为分钟, 不足一分钟算一分钟
|
||||||
|
time = Math.ceil(time / 60)
|
||||||
|
console.log('🚀 ~ handleClose ~ time:', time)
|
||||||
const params = {
|
const params = {
|
||||||
id: this.practiceId,
|
id: this.recordId,
|
||||||
practiceDuration: Math.ceil(this.usedTime.split(':')[0] * 60 + this.usedTime.split(':')[1] / 60)
|
practiceDuration: time
|
||||||
}
|
}
|
||||||
console.log('🚀 ~ handleClose ~ params:', params)
|
console.log('🚀 ~ handleClose ~ params:', params)
|
||||||
uni.request({
|
uni.request({
|
||||||
|
|
@ -669,9 +683,11 @@ export default {
|
||||||
console.log(err)
|
console.log(err)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
setTimeout(() => {
|
||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
url: '/pages/YNEduApp/learnProj/learnProjDetail?id=' + this.studyId
|
url: '/pages/YNEduApp/learnProj/learnProjDetail?id=' + this.studyId
|
||||||
})
|
})
|
||||||
|
}, 500)
|
||||||
} else {
|
} else {
|
||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
url: '/pages/YNEduApp/prac/prac'
|
url: '/pages/YNEduApp/prac/prac'
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue