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