Parcourir la source

查看答案只显示正确答案

dsy il y a 1 mois
Parent
commit
6b7cca2f77

+ 1 - 1
src/views/book/courseware/preview/components/common/PreviewMixin.js

@@ -30,7 +30,7 @@ const mixin = {
       openAnswerCorrect: () => this.openAnswerCorrect(),
     };
   },
-  inject: ['getLang', 'getChinese', 'convertText', 'getTitleList', 'getPermissionControl', 'getShowPinYin'],
+  inject: ['getLang', 'getChinese', 'convertText', 'getTitleList', 'getPermissionControl'],
   props: {
     id: {
       type: String,

+ 0 - 6
src/views/book/courseware/preview/components/fill/FillPreview.vue

@@ -364,14 +364,8 @@ export default {
      * @param {string} mark 选项标识
      */
     computedAnswerText(mark) {
-      if (!this.isShowRightAnswer) return '';
-      let selectOption = this.answer.answer_list.find((item) => item.mark === mark);
       let answerOption = this.data.answer.answer_list.find((item) => item.mark === mark);
-      if (!selectOption) return '';
-      let selectValue = selectOption.value;
       let answerValue = answerOption.value;
-      let isRight = selectValue === answerValue;
-      if (isRight) return '';
       return `${answerValue}`;
     },
     // 重做

+ 2 - 12
src/views/book/courseware/preview/components/judge/JudgePreview.vue

@@ -99,13 +99,7 @@
               v-for="option_type in incertitudeList"
               :key="option_type"
               :style="{ cursor: disabled ? 'not-allowed' : 'pointer' }"
-              :class="[
-                'option-type-item',
-                {
-                  active: isAnswer(mark, option_type),
-                },
-                computedIsShowRightAnswer(mark, option_type),
-              ]"
+              :class="['option-type-item', computedIsShowRightAnswer(mark, option_type)]"
               @click="selectAnswer(mark, option_type)"
             >
               <SvgIcon
@@ -203,13 +197,9 @@ export default {
     // 计算是否显示正确答案的样式
     computedIsShowRightAnswer(mark, option_type) {
       if (!this.isShowRightAnswer) return '';
-      let selectOption = this.answer.answer_list.find((item) => item.mark === mark); // 查找是否已选中的选项
       // 是否是正确的选项类型
       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' : '';
+      return isCorrectType ? 'answer-right' : '';
     },
     retry() {
       this.answer.answer_list = [];

+ 0 - 1
src/views/book/courseware/preview/components/matching/MatchingPreview.vue

@@ -49,7 +49,6 @@
       @closeAnswerAnalysis="closeAnswerAnalysis"
     >
       <div slot="right-answer" class="right-answer">
-        <div class="title">正确答案</div>
         <ul ref="answerList" class="option-list">
           <li v-for="(item, i) in data.option_list" :key="i" class="list-item">
             <div v-for="{ content, mark } in item" :key="mark" :class="['item-wrapper', `answer-item-${mark}`]">

+ 17 - 18
src/views/book/courseware/preview/components/picture/PicturePreview.vue

@@ -39,7 +39,7 @@
               </div>
             </template>
             <ul v-else class="view-independent">
-              <li v-for="file in data.file_list" :key="file.file_id" @click="handleIndicatorClick(i)">
+              <li v-for="(file, i) in data.file_list" :key="file.file_id" @click="handleIndicatorClick(i)">
                 <el-image :id="file.file_id" :src="file.file_url" fit="contain" />
               </li>
             </ul>
@@ -135,25 +135,23 @@ export default {
   mounted() {
     this.$nextTick(() => {
       const ele = this.$refs.pictureAreaBox;
-      if (ele) {
-        const sn_position = this.data.property.sn_position;
-        const viewMemo = this.isEnable(this.data.property.view_memo);
-        // 序号在左和右补齐序号高度,去掉padding(8*2)
-        if (sn_position.includes('left') || sn_position.includes('right')) {
-          this.elementWidth = viewMemo ? (ele.clientWidth - 16) * 0.8 : ele.clientWidth - 16;
-          this.elementHeight = ele.clientHeight;
-        } else {
-          this.elementWidth = viewMemo ? ele.clientWidth * 0.8 : ele.clientWidth;
-          this.elementHeight = ele.clientHeight;
-        }
+      if (!ele) return;
+      const sn_position = this.data.property.sn_position;
+      const viewMemo = this.isEnable(this.data.property.view_memo);
+      // 序号在左和右补齐序号高度,去掉padding(8*2)
+      if (sn_position.includes('left') || sn_position.includes('right')) {
+        this.elementWidth = viewMemo ? (ele.clientWidth - 16) * 0.8 : ele.clientWidth - 16;
+        this.elementHeight = ele.clientHeight;
+      } else {
+        this.elementWidth = viewMemo ? ele.clientWidth * 0.8 : ele.clientWidth;
+        this.elementHeight = ele.clientHeight;
+      }
 
-        this.fileLen = this.data.file_list.length;
-        if (this.fileLen > 1) {
-          this.isMore = true;
-        }
-        this.isViewLeftRightBtn();
-        return;
+      this.fileLen = this.data.file_list.length;
+      if (this.fileLen > 1) {
+        this.isMore = true;
       }
+      this.isViewLeftRightBtn();
 
       this.resizeObserver = new ResizeObserver((entries) => {
         if (!this.getDragStatus()) return;
@@ -203,6 +201,7 @@ export default {
     handleIndicatorClick(index) {
       // 获取 Carousel 实例
       const carousel = this.$refs.pictureCarousel;
+      if (!carousel) return;
       // 切换到对应索引的图片
       carousel.setActiveItem(index);
       this.curPictureMemoIndex = index;

+ 1 - 1
src/views/book/courseware/preview/components/record_input/RecordInputPreview.vue

@@ -27,7 +27,7 @@
           @handleWav="handleWav"
         />
       </div>
-      <PreviewOperation :is-show-answer="isShowAnswers" @showAnswerAnalysis="showAnswerAnalysis" @retry="retry" />
+      <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" @retry="retry" :isShowAnswer="isShowAnswers" />
       <AnswerCorrect
         :answer-correct="data?.answer_correct"
         :visible.sync="visibleAnswerCorrect"

+ 3 - 2
src/views/book/courseware/preview/components/select/SelectPreview.vue

@@ -60,7 +60,7 @@
           v-for="({ content, mark, multilingual, paragraph_list }, i) in data.option_list"
           :key="mark"
           :style="{ cursor: disabled ? 'not-allowed' : 'pointer', borderColor: data.unified_attrib?.topic_color }"
-          :class="['option-item', { active: isAnswer(mark) }, ...computedAnswerClass(mark, 'answer-analysis')]"
+          :class="['option-item', ...computedAnswerClass(mark, 'answer-analysis')]"
           @click="selectAnswer(mark)"
         >
           <span :class="[isSingle ? 'radio' : 'checkbox']">
@@ -165,9 +165,10 @@ export default {
       let isRight = this.data.answer.answer_list.includes(mark); // 是否是正确答案
 
       let answerClass = [];
-      if (!isHas && this.isShowRightAnswer && type === 'answer-analysis') {
+      if (this.isShowRightAnswer && type === 'answer-analysis') {
         answerClass = isRight ? ['answer-right'] : [];
       }
+
       // 判断是否是正确答案
       if (isHas && this.isJudgingRightWrong) {
         answerClass = isRight ? ['answer-right'] : ['wrong'];

+ 19 - 21
src/views/book/courseware/preview/components/table/TablePreview.vue

@@ -299,7 +299,7 @@
                         :class="[index === 0 ? 'pinyin-text-left' : '']"
                       >
                         <template v-if="item.type === 'input'">
-                          <template v-if="data.property.fill_type === fillTypeList[0].value">
+                          <!-- <template v-if="data.property.fill_type === fillTypeList[0].value">
                             <el-input
                               :key="index"
                               v-model="item.value"
@@ -354,7 +354,7 @@
                               :attrib="data.unified_attrib"
                               @handleWav="handleMiniWav($event, item)"
                             />
-                          </template>
+                          </template> -->
                           <span v-if="data.property.pinyin_position === 'bottom'" class="pinyin">&nbsp;</span>
                         </template>
                         <template v-else>
@@ -369,9 +369,9 @@
                           }}</span>
                         </template>
                         <span
-                          v-show="computedAnswerText(item, i, j).length > 0"
                           :key="`answer-${j}`"
                           class="right-answer"
+                          v-show="computedAnswerText(item, i, j).length > 0"
                         >
                           {{ convertText(computedAnswerText(item, i, j)) }}
                         </span>
@@ -390,7 +390,7 @@
                           v-html="convertText(sanitizeHTML(item.value))"
                         ></span>
                         <template v-if="item.type === 'input'">
-                          <template v-if="data.property.fill_type === fillTypeList[0].value">
+                          <!-- <template v-if="data.property.fill_type === fillTypeList[0].value">
                             <el-input
                               :key="index"
                               v-model="item.value"
@@ -445,12 +445,12 @@
                               :attrib="data.unified_attrib"
                               @handleWav="handleMiniWav($event, item)"
                             />
-                          </template>
-                          {{ computedAnswerText(item, i, j) }}
+                          </template> -->
+
                           <span
-                            v-show="computedAnswerText(item, i, j).length > 0"
                             :key="`answer-${j}`"
                             class="right-answer"
+                            v-show="computedAnswerText(item, i, j).length > 0"
                           >
                             {{ convertText(computedAnswerText(item, i, j)) }}
                           </span>
@@ -594,11 +594,9 @@ export default {
         this.data.answer_lists[i] && this.data.answer_lists[i][j] ? this.data.answer_lists[i][j].answer : '';
       let answerOptionList = answerOption.split('\n');
       if (!item) return '';
-      let selectValue = item.value ? item.value.trim() : '';
       let answerValue = answerOptionList[item.inputIndex] ? answerOptionList[item.inputIndex].split('/') : '';
-      let isRight = answerValue && answerValue.includes(selectValue);
-      if (isRight || !answerValue) return '';
-      return `(${answerValue.join('/')})`;
+      if (!answerValue) return '';
+      return `${answerValue.join('/')}`;
     },
     /**
      * 计算答题对错选项字体颜色
@@ -790,16 +788,6 @@ $border-color: #e6e6e6;
           }
         }
 
-        & + .right-answer {
-          position: relative;
-          left: -4px;
-          display: inline-block;
-          height: 32px;
-          line-height: 28px;
-          vertical-align: bottom;
-          border-bottom: 1px solid $font-color;
-        }
-
         :deep input.el-input__inner {
           padding: 0;
 
@@ -820,6 +808,16 @@ $border-color: #e6e6e6;
       }
     }
 
+    .right-answer {
+      position: relative;
+      left: 0;
+      display: inline-block;
+      height: 24px;
+      line-height: 24px;
+      vertical-align: bottom;
+      border-bottom: 1px solid $font-color;
+    }
+
     .multilingual {
       display: block;
       word-break: break-word;