This commit is contained in:
zhutianqi
2021-12-23 10:08:50 +08:00
parent a213de7620
commit 2307847426
+20 -33
View File
@@ -353,39 +353,26 @@ export default {
this.$message.warning('文件不存在,下载失败') this.$message.warning('文件不存在,下载失败')
} }
} else { } else {
this.getBusStandFileByAttId(attId) this.$preview(attId)
.then(res => { // this.getBusStandFileByAttId(attId)
console.log(res) // .then(res => {
if(res){ // console.log(res)
const editFileInfo = res // if(res){
console.log(editFileInfo) // const editFileInfo = res
if(editFileInfo.fileSuffix === 'pdg' || editFileInfo.fileSuffix === 'PDG'){ // console.log(editFileInfo)
window.open('book://ssreader/e0?url='+editFileInfo.downLoadUrl) // if(editFileInfo.fileSuffix === 'pdg' || editFileInfo.fileSuffix === 'PDG'){
}else if(editFileInfo.fileSuffix === 'pdf' || editFileInfo.fileSuffix === 'PDF'){ // window.open('book://ssreader/e0?url='+editFileInfo.downLoadUrl)
window.open('/static/pdf/web/viewer.html?file=' + encodeURIComponent('/api/att/attFile/getFileInfo?fileId=' + editFileInfo.id)) // }else if(editFileInfo.fileSuffix === 'pdf' || editFileInfo.fileSuffix === 'PDF'){
}else { // window.open('/static/pdf/web/viewer.html?file=' + encodeURIComponent('/api/att/attFile/getFileInfo?fileId=' + editFileInfo.id))
const nowTime = new Date().getTime() // }else {
// window.open('http://127.0.0.1:8012/onlinePreview?url='+encodeURIComponent(Base64.encode(editFileInfo.downLoadUrl))); // 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(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('/static/pdf/web/viewer.html?file=' + encodeURIComponent('/api/att/attFile/getFileInfo?fileId=' + editFileInfo.id)) // }
} // }).catch(e => {
// switch (res.convertState) { // console.log(e)
// case 'ERROR': // this.$message.warning('文件不存在,预览失败')
// this.$message.warning('文档转换失败') // })
// break
// case 'LODING':
// this.$message.info('文档转换中,请稍后查看')
// break
// case 'SUCCESS':
// const { convertFileInfo } = res
// window.open('/static/pdf/web/viewer.html?file=' + encodeURIComponent('/api/att/attFile/getFileInfo?fileId=' + convertFileInfo.id))
// break
// }
}).catch(e => {
console.log(e)
this.$message.warning('文件不存在,预览失败')
})
} }
}, },