Browse Source

预览操作组件新增是否显示答案按钮参数

dsy 1 week ago
parent
commit
b46faae2a1

+ 12 - 1
src/views/book/courseware/preview/common/PreviewOperation.vue

@@ -6,7 +6,11 @@
       class="button correct"
       @click="openAnswerCorrect()"
     ></div>
-    <div v-show="permissionControl.can_show_answer" class="button answer" @click="showAnswerAnalysis()"></div>
+    <div
+      v-show="permissionControl.can_show_answer && isShowAnswer"
+      class="button answer"
+      @click="showAnswerAnalysis()"
+    ></div>
   </div>
 </template>
 
@@ -14,6 +18,13 @@
 export default {
   name: 'PreviewOperation',
   inject: ['getPermissionControl', 'openAnswerCorrect'],
+  props: {
+    // 是否显示答案按钮
+    isShowAnswer: {
+      type: Boolean,
+      default: true,
+    },
+  },
   data() {
     return {};
   },

+ 7 - 1
src/views/book/courseware/preview/components/character/CharacterPreview.vue

@@ -188,7 +188,13 @@
               <div class="words-left" :style="{}">
                 <AudioPlay
                   v-if="isEnable(data.property.is_enable_voice)"
-                  :file-id="item.audio_file_id ? item.audio_file_id.file_url : ''"
+                  :file-id="
+                    item.audio_file_id
+                      ? item.audio_file_id.file_url
+                        ? item.audio_file_id.file_url
+                        : item.audio_file_id
+                      : ''
+                  "
                   :theme-color="
                     data.unified_attrib && data.unified_attrib.topic_color ? data.unified_attrib.topic_color : ''
                   "

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

@@ -37,6 +37,7 @@
         :visible.sync="visibleAnswerAnalysis"
         :answer-list="data.answer_list"
         :analysis-list="data.analysis_list"
+        :isShowAnswer="isShowAnswers"
         @closeAnswerAnalysis="closeAnswerAnalysis"
       />
     </div>
@@ -58,6 +59,7 @@ export default {
   data() {
     return {
       data: getRecordInputData(),
+      isShowAnswers: false,
     };
   },
   computed: {},
@@ -79,6 +81,14 @@ export default {
     if (!this.isJudgingRightWrong) {
       this.answer = this.data.answer;
     }
+    if (
+      (this.data.answer_list && this.data.answer_list.length > 0) ||
+      (this.data.analysis_list && this.data.analysis_list.length > 0)
+    ) {
+      this.isShowAnswers = true;
+    } else {
+      this.isShowAnswers = false;
+    }
   },
   methods: {
     handleWav(data) {

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

@@ -222,7 +222,7 @@
           </tr>
         </table>
       </div>
-      <PreviewOperation v-if="isHasInput" @showAnswerAnalysis="showAnswerAnalysis" @retry="retry" />
+      <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" @retry="retry" v-if="isHasInput" />
       <AnswerCorrect
         :answer-correct="data?.answer_correct"
         :visible.sync="visibleAnswerCorrect"