Pārlūkot izejas kodu

单选题兼容10个以上选项

lideyin 5 gadi atpakaļ
vecāks
revīzija
64feec8915
1 mainītis faili ar 29 papildinājumiem un 11 dzēšanām
  1. 29 11
      src/modules/oe/views/examPaperDetail.vue

+ 29 - 11
src/modules/oe/views/examPaperDetail.vue

@@ -81,7 +81,8 @@
                 "
                 style="color: blue;font-weight: bold;"
               >
-                学生答案: <span v-html="questionUnit.studentAnswer"></span>
+                学生答案:
+                <span v-html="questionUnit.studentAnswer"></span>
                 <i
                   class="el-icon-check"
                   v-show="
@@ -260,17 +261,34 @@ export default {
           for (var i5 = 0; i5 < newOptionList.length; i5++) {
             var letter = String.fromCharCode(i5 + 65);
             newOptionList[i5].letter = letter;
-            if (
-              correctAnswer &&
-              correctAnswer.indexOf(newOptionList[i5].optionId.toString()) > -1
-            ) {
-              newCorrectAnswer.push(letter);
+            if (correctAnswer) {
+              //如果是单选题,直接判等
+              if (
+                question.questionType == "SINGLE_CHOICE" &&
+                correctAnswer == newOptionList[i5].optionId.toString()
+              ) {
+                newCorrectAnswer.push(letter);
+              } else if (
+                question.questionType != "SINGLE_CHOICE" &&
+                correctAnswer.indexOf(newOptionList[i5].optionId.toString()) >
+                  -1
+              ) {
+                newCorrectAnswer.push(letter);
+              }
             }
-            if (
-              studentAnswer &&
-              studentAnswer.indexOf(newOptionList[i5].optionId.toString()) > -1
-            ) {
-              newStudentAnswer.push(letter);
+            if (studentAnswer) {
+              if (
+                question.questionType == "SINGLE_CHOICE" &&
+                studentAnswer == newOptionList[i5].optionId.toString()
+              ) {
+                newStudentAnswer.push(letter);
+              } else if (
+                question.questionType != "SINGLE_CHOICE" &&
+                studentAnswer.indexOf(newOptionList[i5].optionId.toString()) >
+                  -1
+              ) {
+                newStudentAnswer.push(letter);
+              }
             }
           }
           question.quesOptions = newOptionList; //选项