natasha 11 mēneši atpakaļ
vecāks
revīzija
01462b3b3c

+ 13 - 3
src/views/exercise_questions/preview/ReplaceAnswerPreview.vue

@@ -34,7 +34,12 @@
         </template>
         <span v-else class="select-item replace-ul">{{ item[0].content }}</span>
       </div>
-      <SoundRecordPreview :wav-blob.sync="answer.answer_list[0].audio_file_id" :disabled="disabled" position="center" />
+      <SoundRecordPreview
+        :wav-blob.sync="answer.answer_list[0].audio_file_id"
+        :disabled="disabled"
+        position="center"
+        v-if="answer.answer_list[0] && answer.answer_list[0].hasOwnProperty('audio_file_id')"
+      />
     </div>
     <div v-if="isEnable(data.property.is_enable_reference_answer) && isShowRightAnswer" class="reference-box">
       <h5 class="reference-title">参考答案</h5>
@@ -89,7 +94,6 @@ export default {
   methods: {
     // 初始化数据
     handleData() {
-      this.show_preview = true;
       this.option_list = [];
       this.active_content = [];
       if (!this.isJudgingRightWrong) {
@@ -117,6 +121,7 @@ export default {
           if (this.isJudgingRightWrong) {
             this.active_content.push('');
             this.answer.answer_list[0].mark_list.forEach((item_mark, index_mark) => {
+              this.$refs[`ui${index_mark}`][0].scrollTop = 0;
               option_item.forEach((option_items, index_items) => {
                 if (item_mark === option_items.mark) {
                   this.active_content[index_mark] = option_items.content;
@@ -132,6 +137,7 @@ export default {
           }
         }
       });
+      this.show_preview = true;
     },
     // 处理滚动
     handleScroll(event, i) {
@@ -149,7 +155,11 @@ export default {
       this.$forceUpdate();
     },
     computedAnswerClass(i, item) {
-      return this.answer.answer_list[0].mark_list[i] === item.mark ? 'active' : '';
+      return this.answer.answer_list[0] &&
+        this.answer.answer_list[0].mark_list &&
+        this.answer.answer_list[0].mark_list[i] === item.mark
+        ? 'active'
+        : '';
     },
   },
 };