[update] 修改在线编辑的查看

This commit is contained in:
lideqin
2024-01-24 16:51:14 +08:00
parent 2825abd049
commit 0031aeb637
13 changed files with 305 additions and 34 deletions
@@ -65,6 +65,7 @@ import { previewPdf } from '@/utils/previewPdf'
import Vue from 'vue'
import { ACCESS_TOKEN } from '@/store/mutation-types'
import { USER_INFO } from '../../../../store/mutation-types'
import { queryFileInfoByEditId } from '../../../../api/workCenter'
const Base64 = require('js-base64').Base64
@@ -147,7 +148,7 @@ export default {
getFileInfo (fileId) {
return new Promise(resolve => {
let fileInfo
getFileInfo({ id: fileId }).then(res => {
queryFileInfoByEditId({ id: fileId }).then(res => {
if (res.success) {
fileInfo = res.result
}
@@ -157,17 +158,10 @@ export default {
})
},
handlePreview (file) {
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/view/${file.id}?at=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${file.fileName}`
// word文件仍使用KKFile进行预览
const url = `${window._CONFIG.onlinePreviewDomainURL}?url=${encodeURIComponent(Base64.encode(fileFullUrl))}`
this.iframeSrc = url
}
const filePaths = file.filePath.split('/')
const fileName = filePaths[filePaths.length - 1]
const url = `${window._CONFIG.onlinePreviewDomainURL}?url=${encodeURIComponent(Base64.encode(this.documentUrl + file.filePath + '&fullfilename=' + fileName))}`
this.iframeSrc = url
},
close () {
this.visible = false