| | |
| | | this.setData({ |
| | | currentIndex: e.detail.index |
| | | }) |
| | | if (this.data.answerType == 'collectQuestion' || this.data.answerType == 'errorQuestion') { |
| | | let index = e.detail.index - 1 >= 0 ? e.detail.index - 1 : 0 |
| | | let flag = this.isHaveAnswer(this.data.questionDataList[index].userAnswer) |
| | | if (flag) this.handleQuestion(e.detail.index) |
| | | let index = e.detail.index - 1 >= 0 ? e.detail.index - 1 : 0 |
| | | const item = this.data.questionDataList[index] |
| | | if ((this.data.answerType == 'collectQuestion' || this.data.answerType == 'errorQuestion') && !item.isComplete) { |
| | | let flag = this.isHaveAnswer(item.userAnswer) |
| | | if (flag) this.handleQuestion(index) |
| | | } |
| | | }, |
| | | // 点击答题卡跳转题目 |
| | |
| | | const id = e.detail.value.currentTarget.dataset.id |
| | | const radioChecked = e.detail.value.detail.value |
| | | const questionList = this.data.questionDataList |
| | | questionList.forEach(item => { |
| | | if (item.id == id) { |
| | | // 我的错题和我的收藏模式下,单选题选择了直接批改 |
| | | for (let index = 0; index < questionList.length; index++) { |
| | | const item = questionList[index]; |
| | | if (item.id == id && !item.isComplete) { |
| | | item.userAnswer = radioChecked |
| | | item.isUserAnswer = this.isHaveAnswer(radioChecked) |
| | | if ((item.questionType == 'singleChoice' || item.questionType == 'judge') && (this.data.answerType == 'collectQuestion' || this.data.answerType == 'errorQuestion') && !item.isComplete) { |
| | | debugger |
| | | let index = this.data.currentIndex - 1 >= 0 ? this.data.currentIndex - 1 : 0 |
| | | this.handleQuestion(index) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | // questionList.forEach(item => { |
| | | // if (item.id == id && !item.isComplete) { |
| | | // item.userAnswer = radioChecked |
| | | // item.isUserAnswer = this.isHaveAnswer(radioChecked) |
| | | // if ((item.questionType == 'singleChoice' || item.questionType == 'judge') && (this.data.answerType == 'collectQuestion' || this.data.answerType == 'errorQuestion') && !item.isComplete) { |
| | | // this.handleQuestion(this.data.currentIndex) |
| | | // } |
| | | // } |
| | | // }) |
| | | const cardListUpdata = this.data.cardList |
| | | cardListUpdata.forEach(item => { |
| | | item.infoList.forEach(citem => { |
| | | if (citem.id == id) { |
| | | for (let index = 0; index < cardListUpdata.length; index++) { |
| | | const item = cardListUpdata[index]; |
| | | for (let cindex = 0; cindex < item.infoList.length; cindex++) { |
| | | const citem = item.infoList[cindex]; |
| | | if (citem.id == id && !citem.isComplete) { |
| | | citem.userAnswer = radioChecked |
| | | citem.isUserAnswer = this.isHaveAnswer(radioChecked) |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | // cardListUpdata.forEach(item => { |
| | | // item.infoList.forEach(citem => { |
| | | // if (citem.id == id && !citem.isComplete) { |
| | | // citem.userAnswer = radioChecked |
| | | // citem.isUserAnswer = this.isHaveAnswer(radioChecked) |
| | | // } |
| | | // }) |
| | | // }) |
| | | this.setData({ |
| | | questionDataList: questionList, |
| | | cardList: cardListUpdata |
| | |
| | | const qustionList = this.data.questionDataList |
| | | for (let index = 0; index < qustionList.length; index++) { |
| | | const item = qustionList[index]; |
| | | if (!item.isComplete) this.handleQuestion(index + 1) |
| | | if (!item.isComplete) this.handleQuestion(index) |
| | | } |
| | | } |
| | | if (this.data.answerType == 'option') { |
| | |
| | | }) |
| | | if (this.data.answerType == 'option') { |
| | | if (this.data) |
| | | this.startCountdown() |
| | | this.setData({ |
| | | countdownTime: 2 * 60 * 60 * 1000 |
| | | }) |
| | | // this.startCountdown() |
| | | this.setData({ |
| | | countdownTime: 2 * 60 * 60 * 1000 |
| | | }) |
| | | // 测试答题 |
| | | await this.getCollectIdList() // 获取收藏id列表 |
| | | await this.getErrorList() // 获取错题id列表 |
| | |
| | | }) |
| | | }) |
| | | } |
| | | // 有题目再开始倒计时 |
| | | if (this.data.questionDataList.length) this.startCountdown() |
| | | this.setData({ |
| | | loading: false |
| | | }) |
| | |
| | | // 批改题目 (练习,我的错题,我的收藏,,组卷) |
| | | handleQuestion(num) { |
| | | const questionList = this.data.questionDataList |
| | | const index = num - 1 >= 0 ? num - 1 : 0 |
| | | const index = num |
| | | if (questionList[index].isComplete) { |
| | | // 题目已完成,跳过 |
| | | return true |