bug修复

This commit is contained in:
binbin_pan 2024-09-02 13:02:45 +08:00
parent 345c999df7
commit dbbb7c1269
1 changed files with 33 additions and 17 deletions

View File

@ -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)
} }
}) })
uni.reLaunch({ setTimeout(() => {
url: '/pages/YNEduApp/learnProj/learnProjDetail?id=' + this.studyId uni.reLaunch({
}) 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'