[update] 修改企标稽查内容预览pdf和word,其他提示;浏览记录修改字段名

This commit is contained in:
lideqin
2023-09-28 10:52:21 +08:00
parent 163eb1091f
commit 13dcbb4aaa
2 changed files with 26 additions and 5 deletions
@@ -11,7 +11,8 @@
<div class="content">
<!-- 左侧文件预览 -->
<div class="content-left">
<iframe :src="iframeSrc" width="100%" frameborder="0"></iframe>
<iframe v-if="iframeSrc" :src="iframeSrc" width="100%" frameborder="0"></iframe>
<a-empty class="empty-file" v-else description="当前文件类型暂不支持预览"></a-empty>
</div>
<!-- 右侧表单区域 -->
<div class="content-right">
@@ -39,6 +40,10 @@
import pick from 'lodash.pick'
import { getFileInfo } from '@/api/api'
import { previewPdf } from '@/utils/previewPdf'
import Vue from 'vue'
import { ACCESS_TOKEN } from '@/store/mutation-types'
const Base64 = require('js-base64').Base64
export default {
name: 'CheckContentModal',
@@ -108,14 +113,23 @@ export default {
})
},
handlePreview (file) {
// pdf预览
const url = previewPdf(file.id)
this.iframeSrc = url
const fileSuffix = file.fileName ? file.fileName.split('.')[file.fileName.split('.').length - 1].toLowerCase() : ''
if (fileSuffix === 'pdf') {
// pdf预览
const url = previewPdf(file.id)
this.iframeSrc = url
} else if (fileSuffix === 'docx') {
const fileFullUrl = `${window._CONFIG.domianWebSocketURL}/sys/common/download/${file.id}?token=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${file.fileName}`
// word文件仍使用KKFile进行预览
const url = `${window._CONFIG.onlinePreviewDomainURL}?url=${encodeURIComponent(Base64.encode(fileFullUrl))}`
this.iframeSrc = url
}
},
close () {
this.visible = false
this.model = {}
this.index = undefined
this.iframeSrc = ''
},
handleCancel () {
this.close()
@@ -157,4 +171,11 @@ export default {
}
}
.empty-file {
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
}
</style>