28 lines
1.3 KiB
JavaScript
28 lines
1.3 KiB
JavaScript
/**
|
|
* 文件预览
|
|
*/
|
|
import { onlyOfficeUrl,kkFileViewUrl } from '@/sysConfig'
|
|
import { getBusStandFileByAttId } from 'api/process'
|
|
let Base64 = require('js-base64').Base64;
|
|
import store from '@/store'
|
|
export default attId => {
|
|
getBusStandFileByAttId({
|
|
attId
|
|
}).then(res => {
|
|
if(res){
|
|
const editFileInfo = res.data
|
|
if(editFileInfo.fileSuffix.toLowerCase() === 'pdg'){
|
|
window.open('book://ssreader/e0?url='+editFileInfo.downLoadUrl)
|
|
}else if(editFileInfo.fileSuffix.toLowerCase() === 'pdf'){
|
|
window.open('./static/pdf/web/viewer.html?file=' + encodeURIComponent('/api/att/attFile/getFileInfo?fileId=' + editFileInfo.id))
|
|
}else {
|
|
const nowTime = new Date().getTime()
|
|
// window.open(onlyOfficeUrl+'/onlyOffice?oldFileName=' + editFileInfo.oldFileName + '&fileType=' + editFileInfo.fileSuffix + '&attId=' + editFileInfo.id + '&fileUrl=' + editFileInfo.downLoadUrl + '&key=' + editFileInfo.id + nowTime+'&filePath='+editFileInfo.filePath+'&fileName='+editFileInfo.fileName)
|
|
window.open(kkFileViewUrl+'/onlinePreview?url='+encodeURIComponent(Base64.encode(editFileInfo.downLoadUrl)) + '&watermarkTxt=' + encodeURIComponent(store.getters.userInfo.userName));
|
|
|
|
}
|
|
}
|
|
}).catch(e => {
|
|
})
|
|
}
|