From 5c236aa8ee143c1f0f23e738f92c0ebc21270549 Mon Sep 17 00:00:00 2001 From: 闫增涛 <1829501689@qq.com> Date: 星期二, 02 四月 2024 16:26:28 +0800 Subject: [PATCH] 答题器bug修改 --- packageBookService/pages/bookServices/examination/examination.js | 36 +++++++++++++++++------------------- 1 files changed, 17 insertions(+), 19 deletions(-) diff --git a/packageBookService/pages/bookServices/examination/examination.js b/packageBookService/pages/bookServices/examination/examination.js index 727756c..1baf9aa 100644 --- a/packageBookService/pages/bookServices/examination/examination.js +++ b/packageBookService/pages/bookServices/examination/examination.js @@ -775,8 +775,6 @@ 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 @@ -796,13 +794,16 @@ 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"') }) + } + // 瑙f瀽瀵屾枃鏈鐞� + 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') { @@ -813,13 +814,17 @@ 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() // 鏃ф暟鎹噷 棰樼洰姝g‘ 璁板綍姝g‘鏁伴噺 if (questionObj.isRight) { this.setData({ @@ -832,7 +837,6 @@ subjectiveTotal: this.data.subjectiveTotal + 1 }) } - } // cardList璧嬪�� let cardIndex = this.data.cardList.findIndex((item) => item.path == pathitem.productLinkPath) @@ -841,11 +845,9 @@ 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 => { @@ -880,7 +882,6 @@ // 鎵规敼棰樼洰 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() @@ -892,7 +893,6 @@ } } else if (item.questionType == 'singleChoice' || item.questionType == 'judge') { // 鍗曢�� 鍒ゆ柇 - // subjectiveGrade.value += item.score questionList[index].isRight = item.answer == item.userAnswer } else if (item.questionType == 'shortAnswer') { // 绠�绛� 缈昏瘧 @@ -909,7 +909,6 @@ ) } } - // subjectiveGrade.value += item.score if (typeof item.answer == 'string') { questionList[index].isRight = item.answer == item.userAnswer[0] } else { @@ -925,7 +924,6 @@ if (item.questionType != 'shortAnswer') { this.setData({ subjectiveTotal: this.data.subjectiveTotal + 1, - subjectiveGrade: this.data.subjectiveGrade + item.score }) } if (questionList[index].isRight && item.questionType != 'shortAnswer') { @@ -1322,12 +1320,6 @@ }, // 鑾峰彇閿欓闆� async getErrorDataList() { - // this.setData({ - // cardList: [{ - // catalogName: '閿欓闆�', - // infoList: [] - // }] - // }) this.setData({ cardList: [{ catalogName: '鍗曢�夐', @@ -1686,6 +1678,12 @@ 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 -- Gitblit v1.9.1