Quellcode durchsuchen

单张图片调整问题

zq vor 1 Woche
Ursprung
Commit
e09bf27d30

+ 1 - 1
src/components/CommonPreview.vue

@@ -25,7 +25,7 @@
         <span class="link">
           <el-checkbox v-model="chinese" true-label="zh-Hant" false-label="zh-Hans">繁体</el-checkbox>
         </span>
-        <span class="link">
+        <span v-if="false" class="link">
           <el-checkbox v-model="showPinYin" true-label="true" false-label="false">拼音</el-checkbox>
         </span>
         <div class="operator">

+ 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,

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

@@ -14,7 +14,7 @@
           <template v-for="(li, j) in item">
             <template v-if="li.type === 'text'">
               <PinyinText
-                v-if="isEnable(data.property.view_pinyin) && isEnable(getShowPinYin())"
+                v-if="isEnable(data.property.view_pinyin)"
                 :key="`${i}-${j}`"
                 class="content"
                 :paragraph-list="li.paragraph_list"
@@ -115,7 +115,7 @@
           <template v-for="(li, j) in item">
             <template v-if="li.type === 'text'">
               <PinyinText
-                v-if="isEnable(data.property.view_pinyin) && isEnable(getShowPinYin())"
+                v-if="isEnable(data.property.view_pinyin)"
                 :key="`${i}-${j}`"
                 class="content"
                 :paragraph-list="li.paragraph_list"

+ 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/rich_text/RichTextPreview.vue

@@ -6,7 +6,7 @@
     <div class="main">
       <div ref="leftDiv" :style="{ width: data.note_list?.length > 0 ? '' : '100%' }">
         <PinyinText
-          v-if="isEnable(data.property.view_pinyin) && isEnable(getShowPinYin())"
+          v-if="isEnable(data.property.view_pinyin)"
           :paragraph-list="data.paragraph_list"
           :pinyin-position="data.property.pinyin_position"
           :pinyin-overall-position="data.property.pinyin_overall_position"