| | |
| | | questionObj.answer = item.Embedded_QuestionBank_Answer |
| | | } |
| | | } |
| | | // questionObj.userAnswer = this.arrayToString(questionObj.userAnswer) |
| | | // questionObj.isHaveAnswer = this.isHaveAnswer(questionObj.userAnswer) |
| | | // 填空题改造 |
| | | if (questionObj.questionType == 'completion') { |
| | | let index = 0 |
| | |
| | | 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 (questionObj.analysisCon && typeof questionObj.analysisCon == 'string') { |
| | | questionObj.analysisCon = questionObj.analysisCon.replace(/\<img/gi, '<img style="max-width: 300rpx !important;object-fit: contain;" class="stem-rich-img" ') |
| | | } |
| | | // 获取图片 |
| | | if (questionObj.stemStyle == 'Image' || questionObj.stemStyle == 'TxtAndImage') { |
| | |
| | | if (optionItem.img) optionItem.img = getPublicImage(optionItem.img, 150) |
| | | }) |
| | | } |
| | | // 客观题总分赋值 |
| | | if (questionObj.questionType !== 'shortAnswer') { |
| | | this.setData({ |
| | | subjectiveGrade: this.data.subjectiveGrade + 2 |
| | | }) |
| | | } |
| | | // if (questionObj.optionStyle == 'RichText') { |
| | | // questionObj.option.forEach(optionItem => { |
| | | // optionItem.txt.replace(/<img>/g, "<img class='imgClass'>") |
| | | // }) |
| | | // } |
| | | // 旧数据里 题目已经作答,修改已答题目数量 |
| | | // if (oldObj && oldObj.userAnswer.length > 0) countDownRef.value.changeAlready() |
| | | // 旧数据里 题目正确 记录正确数量 |
| | | if (questionObj.isRight) { |
| | | this.setData({ |
| | |
| | | subjectiveTotal: this.data.subjectiveTotal + 1 |
| | | }) |
| | | } |
| | | |
| | | } |
| | | // cardList赋值 |
| | | let cardIndex = this.data.cardList.findIndex((item) => item.path == pathitem.productLinkPath) |
| | |
| | | this.setData({ |
| | | [`cardList[${cardIndex}].infoList`]: infoList |
| | | }) |
| | | // this.data.cardList[this.data.cardList.findIndex((item) => item.path == pathitem.productLinkPath)] |
| | | // .infoList |
| | | // infoList.push(questionObj) |
| | | flag++; |
| | | let questionList = [] |
| | | let grade = 0 |
| | | const cardUpdatedList = this.data.cardList |
| | | // if (flag == this.data.idPathList.length) { |
| | | cardUpdatedList.forEach(aitem => { |
| | |
| | | // 批改题目 |
| | | if (item.questionType == 'multipleChoice') { |
| | | // 多选题 |
| | | // subjectiveGrade.value += item.score |
| | | if (item.answer.length == item.userAnswer.length) { |
| | | const sortedArr1 = item.answer.slice().sort() |
| | | const sortedArr2 = item.userAnswer.slice().sort() |
| | |
| | | } |
| | | } else if (item.questionType == 'singleChoice' || item.questionType == 'judge') { |
| | | // 单选 判断 |
| | | // subjectiveGrade.value += item.score |
| | | questionList[index].isRight = item.answer == item.userAnswer |
| | | } else if (item.questionType == 'shortAnswer') { |
| | | // 简答 翻译 |
| | |
| | | ) |
| | | } |
| | | } |
| | | // subjectiveGrade.value += item.score |
| | | if (typeof item.answer == 'string') { |
| | | questionList[index].isRight = item.answer == item.userAnswer[0] |
| | | } else { |
| | |
| | | if (item.questionType != 'shortAnswer') { |
| | | this.setData({ |
| | | subjectiveTotal: this.data.subjectiveTotal + 1, |
| | | subjectiveGrade: this.data.subjectiveGrade + item.score |
| | | }) |
| | | } |
| | | if (questionList[index].isRight && item.questionType != 'shortAnswer') { |
| | |
| | | }, |
| | | // 获取错题集 |
| | | async getErrorDataList() { |
| | | // this.setData({ |
| | | // cardList: [{ |
| | | // catalogName: '错题集', |
| | | // infoList: [] |
| | | // }] |
| | | // }) |
| | | this.setData({ |
| | | cardList: [{ |
| | | catalogName: '单选题', |
| | |
| | | if (optionItem.img) optionItem.img = getPublicImage(optionItem.img, 150) |
| | | }) |
| | | } |
| | | // 客观题总分赋值 |
| | | if (questionObj.questionType !== 'shortAnswer') { |
| | | this.setData({ |
| | | subjectiveGrade: this.data.subjectiveGrade + questionObj.score |
| | | }) |
| | | } |
| | | if (oldObj && oldObj.isRight) { |
| | | this.setData({ |
| | | correctNum: this.data.correctNum + 1 |