fix: 手机端详情预览回滚

This commit is contained in:
zyn
2024-01-06 12:09:41 +08:00
parent 1df0c9ebd8
commit 62ebc9cde1
+44 -45
View File
@@ -3204,51 +3204,50 @@ export default {
})
},
openFileInPdf (attId, oldFileName) {
this.$preview(attId)
/*
// 判断是否是图片格式,图片格式不预览,直接下载
let index1 = oldFileName.lastIndexOf('.')
let index2 = oldFileName.length
let fileSuffix = oldFileName.substring(index1, index2)
//把后缀转大写
if (fileSuffix !== undefined && fileSuffix !== null) {
fileSuffix = fileSuffix.toUpperCase()
}
if (fileSuffix !== 'pdg' && fileSuffix !== 'PDG') {
this.getBusStandFileByAttId(attId)
.then(res => {
if (res) {
const editFileInfo = res
const nowTime = new Date().getTime()
// this.loadingText = true
if (editFileInfo.fileSuffix.toLowerCase() === 'pdf') {
// if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
// //alert(navigator.userAgent);
// this.getFileInfo(editFileInfo.id)
// } else if (/(Android)/i.test(navigator.userAgent)) {
// //alert(navigator.userAgent);
// this.loadingText = false
// window.open('/static/pdf/web/viewer.html?file=' + encodeURIComponent('/api/att/attFile/getFileInfo?fileId=' + editFileInfo.id))
// } else {
// this.loadingText = false
window.open(kkFileViewUrl + '/onlinePreview?url=' + encodeURIComponent(Base64.encode(editFileInfo.downLoadUrl)) + '&watermarkTxt=' + encodeURIComponent(this.$store.getters.userInfo.userName));
// window.open('/static/pdf/web/viewer.html?file=' + encodeURIComponent('/api/att/attFile/getFileInfo?fileId=' + editFileInfo.id))
// }
// window.open('/#/phonePDF?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(this.$store.getters.userInfo.userName));
}
}
}).catch(e => {
this.$message.warning('文件不存在,预览失败')
this.loadingText = false
})
} else {
this.$message.warning('PDG文件,不支持手机端预览')
}
*/
// this.$preview(attId)
// 判断是否是图片格式,图片格式不预览,直接下载
const index1 = oldFileName.lastIndexOf('.')
const index2 = oldFileName.length
let fileSuffix = oldFileName.substring(index1, index2)
// 把后缀转大写
if (fileSuffix !== undefined && fileSuffix !== null) {
fileSuffix = fileSuffix.toUpperCase()
}
if (fileSuffix !== 'pdg' && fileSuffix !== 'PDG') {
this.getBusStandFileByAttId(attId)
.then(res => {
if (res) {
const editFileInfo = res
const nowTime = new Date().getTime()
// this.loadingText = true
if (editFileInfo.fileSuffix.toLowerCase() === 'pdf') {
// if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
// //alert(navigator.userAgent);
// this.getFileInfo(editFileInfo.id)
// } else if (/(Android)/i.test(navigator.userAgent)) {
// //alert(navigator.userAgent);
// this.loadingText = false
// window.open('/static/pdf/web/viewer.html?file=' + encodeURIComponent('/api/att/attFile/getFileInfo?fileId=' + editFileInfo.id))
// } else {
// this.loadingText = false
window.open(kkFileViewUrl + '/onlinePreview?url=' + encodeURIComponent(Base64.encode(editFileInfo.downLoadUrl)) + '&watermarkTxt=' + encodeURIComponent(this.$store.getters.userInfo.userName));
// window.open('/static/pdf/web/viewer.html?file=' + encodeURIComponent('/api/att/attFile/getFileInfo?fileId=' + editFileInfo.id))
// }
// window.open('/#/phonePDF?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(this.$store.getters.userInfo.userName));
}
}
}).catch(e => {
this.$message.warning('文件不存在,预览失败')
this.loadingText = false
})
} else {
this.$message.warning('PDG文件,不支持手机端预览')
}
},
getFileInfo (fileId) {
Axios({