Просмотр исходного кода

fix:受控文件查阅预览bug修复

luoaoxuan 1 год назад
Родитель
Сommit
51a84a2f6c

+ 2 - 1
src/business/platform/file/attachment/editFile/editor.vue

@@ -137,7 +137,8 @@ export default {
                 },
                 width: '100%',
                 token: getToken(),
-                height: document.body.clientHeight + 'px'
+                // 减去弹窗的顶部标题区域
+                height: document.body.clientHeight - 56 + 'px'
             }
             const docEditor = new DocsAPI.DocEditor('editorDiv', config)
             this.configKey = config.document.key

+ 18 - 3
src/views/component/fileTraining/index.vue

@@ -14,8 +14,8 @@
         append-to-body
         custom-class="ibps-file-preview-dialog"
     >
-        <div @mousemove="startTimer" @mouseleave="pauseTimer">
-            <fView ref="fvView" :option-file="optionFile" :operation_status="operation_status" @hadLoadedFile="hadLoadedFile" />
+        <div>
+            <fView v-if="refresh" ref="fvView" :option-file="optionFile" :operation_status="operation_status" @hadLoadedFile="hadLoadedFile" />
         </div>
     </el-dialog>
 </template>
@@ -67,7 +67,8 @@ export default {
             upFunc: () => {},
             height: 0,
             out: false, // 记录鼠标是否离开过被监听的位置,未离开过则startTimer不启用
-            hadLoad: false
+            hadLoad: false,
+            refresh: false
         }
     },
     watch: {
@@ -91,6 +92,11 @@ export default {
                 this.optionFile.fileType = data.ext // 类型
                 this.optionFile.data = data // 记录编制的位置,需要替换。
                 this.optionFile.data.index = data.index
+                // 使用 v-if 实现组件刷新功能
+                this.refresh = false
+                this.$nextTick(() => {
+                    this.refresh = true
+                })
             }
         },
         browseTime: {
@@ -113,8 +119,17 @@ export default {
     },
     mounted () {
         this.height = this.getDialogHeightHeight()
+        // 页面切换时改变计时状态
+        document.addEventListener('visibilitychange', this.handlePageChange)
     },
     methods: {
+        handlePageChange () {
+            if (document.visibilityState === 'hidden') {
+                this.pauseTimer()
+            } else {
+                this.startTimer()
+            }
+        },
         closeDialog () {
             const fvView = this.$refs.fvView
             // 销毁子组件方法

+ 3 - 2
src/views/infosManage/fileIE.vue

@@ -46,10 +46,11 @@
                             slot-scope="scope"
                         >
                             <div>
-                                <img
+                                <!-- <img
                                     :src="wordPng"
                                     style="vertical-align: middle; height: 20px;"
-                                >
+                                > -->
+                                <i class="el-icon-document" />
                                 <el-tag
                                     type="info"
                                     style="cursor: pointer;"