Browse Source

判断题答题时显示全部答案

dusenyao 1 year ago
parent
commit
7acfa6bc47
1 changed files with 6 additions and 5 deletions
  1. 6 5
      src/views/exercise_questions/preview/JudgePreview.vue

+ 6 - 5
src/views/exercise_questions/preview/JudgePreview.vue

@@ -98,11 +98,12 @@ export default {
     computedIsShowRightAnswer(mark, option_type) {
     computedIsShowRightAnswer(mark, option_type) {
       if (!this.isShowRightAnswer) return '';
       if (!this.isShowRightAnswer) return '';
       let selectOption = this.answer.answer_list.find((item) => item.mark === mark); // 查找是否已选中的选项
       let selectOption = this.answer.answer_list.find((item) => item.mark === mark); // 查找是否已选中的选项
-      if (!selectOption) return '';
-      return this.data.answer.answer_list.find((item) => item.mark === mark).option_type === option_type &&
-        !(selectOption.option_type === option_type)
-        ? 'answer-right'
-        : '';
+      // 是否是正确的选项类型
+      let isCorrectType = this.data.answer.answer_list.find((item) => item.mark === mark).option_type === option_type;
+      if (!selectOption) {
+        return isCorrectType ? 'answer-right' : '';
+      }
+      return isCorrectType && !(selectOption.option_type === option_type) ? 'answer-right' : '';
     },
     },
     /**
     /**
      * 计算判断题题干的样式
      * 计算判断题题干的样式