| | |
| | | if (flag) this.handleQuestion(index) |
| | | } |
| | | }, |
| | | // 我的错题,收藏查看解析按钮 |
| | | viewParsing() { |
| | | if (this.data.answerType == 'collectQuestion' || this.data.answerType == 'errorQuestion') { |
| | | const item = this.data.questionDataList[this.data.currentIndex] |
| | | if (!item.isComplete) this.handleQuestion(this.data.currentIndex) |
| | | } |
| | | }, |
| | | // 点击答题卡跳转题目 |
| | | goQuestion(e) { |
| | | const id = e.detail.id |
| | |
| | | }, |
| | | // 提交逻辑 |
| | | submitPaper() { |
| | | |
| | | // 关闭退出页面监听 |
| | | wx.disableAlertBeforeUnload() |
| | | this.setData({ |
| | |
| | | // 简答 翻译 |
| | | questionList[index].isRight = null |
| | | } else if (item.questionType == 'completion') { |
| | | // 填空 |
| | | if (item.answer == 'string') { |
| | | item.isRight = item.answer == item.userAnswer[0] |
| | | } else { |
| | | if (item.answer.length != item.userAnswer.length) { |
| | | item.isRight = false |
| | | } else { |
| | | item.isRight = item.answer.every( |
| | | (value, index) => value === item.userAnswer[index] |
| | | ) |
| | | } |
| | | } |
| | | // subjectiveGrade.value += item.score |
| | | if (typeof item.answer == 'string') { |
| | | questionList[index].isRight = item.answer == item.userAnswer[0] |
| | |
| | | // 获取收藏夹 |
| | | async getCollectDataList() { |
| | | let questionArr = [] |
| | | // this.setData({ |
| | | // cardList: [{ |
| | | // catalogName: '收藏夹', |
| | | // infoList: [] |
| | | // }] |
| | | // }) |
| | | this.setData({ |
| | | cardList: [{ |
| | | catalogName: '收藏夹', |
| | | catalogName: '单选题', |
| | | infoList: [] |
| | | }, { |
| | | catalogName: '判断题', |
| | | infoList: [] |
| | | }, { |
| | | catalogName: '多选题', |
| | | infoList: [] |
| | | }, { |
| | | catalogName: '填空题', |
| | | infoList: [] |
| | | }, { |
| | | catalogName: '简答题', |
| | | infoList: [] |
| | | }] |
| | | }) |
| | | let singleChoiceArr = [] // 单选 |
| | | let judgeArr = [] // 判断 |
| | | let shortArr = [] // 简答 |
| | | let multipleChoiceArr = [] // 多选 |
| | | let completionArr = [] // 填空 |
| | | let query = { |
| | | path: '*', |
| | | cmsPath: this.data.rootCmsItemId, |
| | |
| | | if (optionItem.img) optionItem.img = getPublicImage(optionItem.img, 150) |
| | | }) |
| | | } |
| | | // if (item.Embedded_QuestionBank_QuestionType == 'judge') { |
| | | // topicList.value.judge.data.push(questionObj) |
| | | // } else if (item.Embedded_QuestionBank_QuestionType == 'singleChoice') { |
| | | // topicList.value.radio.data.push(questionObj) |
| | | // } else if (item.Embedded_QuestionBank_QuestionType == 'multipleChoice') { |
| | | // topicList.value.check.data.push(questionObj) |
| | | // } else if (item.Embedded_QuestionBank_QuestionType == 'completion') { |
| | | // topicList.value.gap.data.push(questionObj) |
| | | // } else if (item.Embedded_QuestionBank_QuestionType == 'shortAnswer') { |
| | | // topicList.value.short.data.push(questionObj) |
| | | // } |
| | | questionArr.push(questionObj) |
| | | // cardList.value[0].infoList.push(questionObj) |
| | | // 题干富文本处理 |
| | | if (questionObj.stemStyle == 'RichText') { |
| | | // questionObj.option.txt = '' |
| | | questionObj.stem.stemTxt = questionObj.stem.stemTxt.replace(/\<img/gi, '<img style="max-width: 300rpx !important;object-fit: contain;" class="stem-rich-img" ').replace(/\<p/gi, '<p class="stem-rich-p"') |
| | | |
| | | } |
| | | // 选项富文本处理 |
| | | if (questionObj.optionStyle == 'RichText' && (questionObj.questionType == 'singleChoice' || questionObj.questionType == 'judge' || questionObj.questionType == 'multipleChoice')) { |
| | | questionObj.option.forEach(item => { |
| | | if (item.txt) item.txt = item.txt.replace(/\<img/gi, '<img class="option-rich-img"').replace(/\<p/gi, '<p class="stem-rich-p"') |
| | | }) |
| | | // loadings.value = false |
| | | } |
| | | if (item.Embedded_QuestionBank_QuestionType == 'judge') { |
| | | questionObj.type = '判断题' |
| | | judgeArr.push(questionObj) |
| | | } else if (item.Embedded_QuestionBank_QuestionType == 'singleChoice') { |
| | | questionObj.type = '单选题' |
| | | singleChoiceArr.push(questionObj) |
| | | } else if (item.Embedded_QuestionBank_QuestionType == 'multipleChoice') { |
| | | questionObj.type = '多选题' |
| | | multipleChoiceArr.push(questionObj) |
| | | } else if (item.Embedded_QuestionBank_QuestionType == 'completion') { |
| | | questionObj.type = '填空题' |
| | | completionArr.push(questionObj) |
| | | } else if (item.Embedded_QuestionBank_QuestionType == 'shortAnswer') { |
| | | questionObj.type = '简答题' |
| | | shortArr.push(questionObj) |
| | | } |
| | | // questionArr.push(questionObj) |
| | | }) |
| | | // this.setData({ |
| | | // questionDataList: questionArr, |
| | | // ['cardList[0].infoList']: questionArr, |
| | | // loading: false, |
| | | // }) |
| | | this.setData({ |
| | | ['cardList[0].infoList']: singleChoiceArr, |
| | | ['cardList[1].infoList']: judgeArr, |
| | | ['cardList[2].infoList']: multipleChoiceArr, |
| | | ['cardList[3].infoList']: completionArr, |
| | | ['cardList[3].infoList']: shortArr, |
| | | }) |
| | | const cardList = this.data.cardList |
| | | for (let index = 0; index < cardList.length; index++) { |
| | | const item = cardList[index]; |
| | | for (let cindex = 0; cindex < item.infoList.length; cindex++) { |
| | | const citem = item.infoList[cindex] |
| | | citem.number = cindex + 1 |
| | | questionArr.push(citem) |
| | | } |
| | | } |
| | | this.setData({ |
| | | questionDataList: questionArr, |
| | | ['cardList[0].infoList']: questionArr, |
| | | loading: false, |
| | | cardList: cardList, |
| | | loading: false |
| | | }) |
| | | }) |
| | | }, |
| | |
| | | }, |
| | | // 获取错题集 |
| | | async getErrorDataList() { |
| | | // this.setData({ |
| | | // cardList: [{ |
| | | // catalogName: '错题集', |
| | | // infoList: [] |
| | | // }] |
| | | // }) |
| | | this.setData({ |
| | | cardList: [{ |
| | | catalogName: '错题集', |
| | | catalogName: '单选题', |
| | | infoList: [] |
| | | }, { |
| | | catalogName: '判断题', |
| | | infoList: [] |
| | | }, { |
| | | catalogName: '多选题', |
| | | infoList: [] |
| | | }, { |
| | | catalogName: '填空题', |
| | | infoList: [] |
| | | }, { |
| | | catalogName: '简答题', |
| | | infoList: [] |
| | | }] |
| | | }) |
| | | let singleChoiceArr = [] // 单选 |
| | | let judgeArr = [] // 判断 |
| | | let shortArr = [] // 简答 |
| | | let multipleChoiceArr = [] // 多选 |
| | | let completionArr = [] // 填空 |
| | | let query = { |
| | | path: '*', |
| | | cmsPath: this.data.rootCmsItemId, |
| | |
| | | if (optionItem.img) optionItem.img = getPublicImage(optionItem.img, 150) |
| | | }) |
| | | } |
| | | // if (item.Embedded_QuestionBank_QuestionType == 'judge') { |
| | | // topicList.value.judge.data.push(questionObj) |
| | | // } else if (item.Embedded_QuestionBank_QuestionType == 'singleChoice') { |
| | | // topicList.value.radio.data.push(questionObj) |
| | | // } else if (item.Embedded_QuestionBank_QuestionType == 'multipleChoice') { |
| | | // topicList.value.check.data.push(questionObj) |
| | | // } else if (item.Embedded_QuestionBank_QuestionType == 'completion') { |
| | | // topicList.value.gap.data.push(questionObj) |
| | | // } else if (item.Embedded_QuestionBank_QuestionType == 'shortAnswer') { |
| | | // topicList.value.short.data.push(questionObj) |
| | | // } |
| | | questionArr.push(questionObj) |
| | | // 题干富文本处理 |
| | | if (questionObj.stemStyle == 'RichText') { |
| | | // questionObj.option.txt = '' |
| | | questionObj.stem.stemTxt = questionObj.stem.stemTxt.replace(/\<img/gi, '<img style="max-width: 300rpx !important;object-fit: contain;" class="stem-rich-img" ').replace(/\<p/gi, '<p class="stem-rich-p"') |
| | | |
| | | } |
| | | // 选项富文本处理 |
| | | if (questionObj.optionStyle == 'RichText' && (questionObj.questionType == 'singleChoice' || questionObj.questionType == 'judge' || questionObj.questionType == 'multipleChoice')) { |
| | | questionObj.option.forEach(item => { |
| | | if (item.txt) item.txt = item.txt.replace(/\<img/gi, '<img class="option-rich-img"').replace(/\<p/gi, '<p class="stem-rich-p"') |
| | | }) |
| | | } |
| | | if (item.Embedded_QuestionBank_QuestionType == 'judge') { |
| | | questionObj.type = '判断题' |
| | | judgeArr.push(questionObj) |
| | | } else if (item.Embedded_QuestionBank_QuestionType == 'singleChoice') { |
| | | questionObj.type = '单选题' |
| | | singleChoiceArr.push(questionObj) |
| | | } else if (item.Embedded_QuestionBank_QuestionType == 'multipleChoice') { |
| | | questionObj.type = '多选题' |
| | | multipleChoiceArr.push(questionObj) |
| | | } else if (item.Embedded_QuestionBank_QuestionType == 'completion') { |
| | | questionObj.type = '填空题' |
| | | completionArr.push(questionObj) |
| | | } else if (item.Embedded_QuestionBank_QuestionType == 'shortAnswer') { |
| | | questionObj.type = '简答题' |
| | | shortArr.push(questionObj) |
| | | } |
| | | // questionArr.push(questionObj) |
| | | }) |
| | | this.setData({ |
| | | // questionDataList: questionArr, |
| | | ['cardList[0].infoList']: singleChoiceArr, |
| | | ['cardList[1].infoList']: judgeArr, |
| | | ['cardList[2].infoList']: multipleChoiceArr, |
| | | ['cardList[3].infoList']: completionArr, |
| | | ['cardList[3].infoList']: shortArr, |
| | | // loading: false |
| | | }) |
| | | const cardList = this.data.cardList |
| | | for (let index = 0; index < cardList.length; index++) { |
| | | const item = cardList[index]; |
| | | for (let cindex = 0; cindex < item.infoList.length; cindex++) { |
| | | const citem = item.infoList[cindex] |
| | | citem.number = cindex + 1 |
| | | questionArr.push(citem) |
| | | } |
| | | } |
| | | this.setData({ |
| | | questionDataList: questionArr, |
| | | ['cardList[0].infoList']: questionArr, |
| | | cardList: cardList, |
| | | loading: false |
| | | }) |
| | | }) |