[update] 修改预览word文件改成公用方法

This commit is contained in:
lideqin
2024-01-02 15:21:41 +08:00
parent 74e6cdba16
commit 1870dd41ac
8 changed files with 62 additions and 35 deletions
@@ -122,12 +122,12 @@ import JTable from '@/components/jero/JTable'
import Vue from 'vue'
import { ACCESS_TOKEN, USER_INFO } from '@/store/mutation-types'
import { previewPdf } from '@/utils/previewPdf'
import { getFileAccessHttpUrl } from '@/api/manage'
import { getFileAccessHttpUrl, downloadFile } from '@/api/manage'
import QuizModal from './modules/QuizModal'
import { kkFilePreview } from '@/utils/kkFilePreview'
const FILE_TYPE_IMGS = ['jpg', 'jpeg', 'png', 'raw']
const FILE_TYPE_PDF = 'pdf'
const Base64 = require('js-base64').Base64
export default {
name: 'QuestionAnswerList',
@@ -240,9 +240,13 @@ export default {
window.open(url)
return
}
// 其余可预览文件仍使用KKFile进行预览
const url = `${window._CONFIG.onlinePreviewDomainURL}?url=${encodeURIComponent(Base64.encode(fileFullUrl))}`
window.open(url)
// word用KKfile预览
if (fileSuffix === 'doc' || fileSuffix === 'docx') {
kkFilePreview(fileFullUrl)
return
}
// 如果都不能预览就下载
downloadFile(`/sys/common/download/${record.declareFile}`, record.declareFileName)
},
// 查看
handleDetail (record) {