From 0e6c6d9f456f11a4dd643afa96d3d4e71b90f877 Mon Sep 17 00:00:00 2001 From: wxyclub Date: Fri, 1 Dec 2023 11:50:18 +0800 Subject: [PATCH] =?UTF-8?q?bug:=20=E6=96=87=E4=BB=B6=E9=A2=84=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/details/meetingDetail/index.vue | 71 +------------------ .../details/policyTopicsDetail/index.vue | 71 +------------------ .../regulatoryMaterialsDetail/index.vue | 71 +------------------ 3 files changed, 3 insertions(+), 210 deletions(-) diff --git a/src/pages/details/meetingDetail/index.vue b/src/pages/details/meetingDetail/index.vue index a7c42c6b9..737af2869 100644 --- a/src/pages/details/meetingDetail/index.vue +++ b/src/pages/details/meetingDetail/index.vue @@ -209,76 +209,7 @@ export default { }) }, openFileInPdf (attId, fileName) { - // 判断是否是图片格式,图片格式不预览,直接下载 - let index1 = fileName.lastIndexOf('.') - let index2 = fileName.length - let fileSuffix = fileName.substring(index1, index2) - //把后缀转大写 - if(fileSuffix !== undefined && fileSuffix !== null){ - fileSuffix = fileSuffix.toUpperCase() - } - // 判断上传文件格式 - if (fileSuffix === '.PNG'|| fileSuffix === '.JPG'|| fileSuffix === '.JPEG') { - this.downloadFile(attId) - return true - } - // 缺少文件 - if (this.$hasPermission('fd83032ae5f41a0021b00e93c88edbbg')) { - if (fileSuffix === '.PDG' || fileSuffix === '.pdg') { - this.getBusStandFileByAttId(attId) - .then(res => { - if(res){ - const editFileInfo = res - if(editFileInfo.fileSuffix === 'pdg' || editFileInfo.fileSuffix === 'PDG'){ - window.open('book://ssreader/e0?url='+editFileInfo.downLoadUrl) - } - } - }).catch(e => { - this.$message.warning('文件不存在,预览失败') - }) - }else { - this.$http.get('att/attFile/getBusStandFileByAttId', { - attId: attId - }, { - _this: this - }, res => { - if (res.data) { - let fileObj = {} - fileObj.fileId = res.data.attId - fileObj.fileName = fileName - let fileList = [] - let repeatData = 0 - if (sessionStorage.getItem('fileInfo')) { - fileList = JSON.parse(sessionStorage.getItem('fileInfo')) - if (fileList != null && fileList.length > 0) { - for (let i = 0; i < fileList.length; i++) { - if (fileList[i].fileId === res.data.attId) { - repeatData = 1 - break - } - } - if (repeatData === 0) { - fileList.push(fileObj) - fileList = JSON.stringify(fileList) - sessionStorage.setItem('fileInfo', fileList) - } - } - } else { - fileList.push(fileObj) - fileList = JSON.stringify(fileList) - sessionStorage.setItem('fileInfo', fileList) - } - window.open('/static/pdf/web/viewer.html?file=' + encodeURIComponent('/api/att/attFile/getFileInfo?fileId=' + res.data.attId)) - } else { - this.$message.error('文档未转换成功或本地读取不到该文档') - } - }, e => { - this.$message.error('文档未转换成功或本地读取不到该文档') - }) - } - } else { - this.$message.error('没有在线预览文档权限!') - } + this.$preview(attId) }, } } diff --git a/src/pages/details/policyTopicsDetail/index.vue b/src/pages/details/policyTopicsDetail/index.vue index b5be02180..5cfb6d883 100644 --- a/src/pages/details/policyTopicsDetail/index.vue +++ b/src/pages/details/policyTopicsDetail/index.vue @@ -365,76 +365,7 @@ export default { }) }, openFileInPdf (attId, fileName) { - // 判断是否是图片格式,图片格式不预览,直接下载 - let index1 = fileName.lastIndexOf('.') - let index2 = fileName.length - let fileSuffix = fileName.substring(index1, index2) - //把后缀转大写 - if(fileSuffix !== undefined && fileSuffix !== null){ - fileSuffix = fileSuffix.toUpperCase() - } - // 判断上传文件格式 - if (fileSuffix === '.PNG'|| fileSuffix === '.JPG'|| fileSuffix === '.JPEG') { - this.downloadFile(attId) - return true - } - // 缺少文件 - if (this.$hasPermission('fd83032ae5f41a0021b00e93c88edbbg')) { - if (fileSuffix === '.PDG' || fileSuffix === '.pdg') { - this.getBusStandFileByAttId(attId) - .then(res => { - if(res){ - const editFileInfo = res - if(editFileInfo.fileSuffix === 'pdg' || editFileInfo.fileSuffix === 'PDG'){ - window.open('book://ssreader/e0?url='+editFileInfo.downLoadUrl) - } - } - }).catch(e => { - this.$message.warning('文件不存在,预览失败') - }) - }else { - this.$http.get('att/attFile/getBusStandFileByAttId', { - attId: attId - }, { - _this: this - }, res => { - if (res.data) { - let fileObj = {} - fileObj.fileId = res.data.attId - fileObj.fileName = fileName - let fileList = [] - let repeatData = 0 - if (sessionStorage.getItem('fileInfo')) { - fileList = JSON.parse(sessionStorage.getItem('fileInfo')) - if (fileList != null && fileList.length > 0) { - for (let i = 0; i < fileList.length; i++) { - if (fileList[i].fileId === res.data.attId) { - repeatData = 1 - break - } - } - if (repeatData === 0) { - fileList.push(fileObj) - fileList = JSON.stringify(fileList) - sessionStorage.setItem('fileInfo', fileList) - } - } - } else { - fileList.push(fileObj) - fileList = JSON.stringify(fileList) - sessionStorage.setItem('fileInfo', fileList) - } - window.open('/static/pdf/web/viewer.html?file=' + encodeURIComponent('/api/att/attFile/getFileInfo?fileId=' + res.data.attId)) - } else { - this.$message.error('文档未转换成功或本地读取不到该文档') - } - }, e => { - this.$message.error('文档未转换成功或本地读取不到该文档') - }) - } - } else { - this.$message.error('没有在线预览文档权限!') - } + this.$preview(attId) }, } } diff --git a/src/pages/details/regulatoryMaterialsDetail/index.vue b/src/pages/details/regulatoryMaterialsDetail/index.vue index d7f85d936..917faf306 100644 --- a/src/pages/details/regulatoryMaterialsDetail/index.vue +++ b/src/pages/details/regulatoryMaterialsDetail/index.vue @@ -249,76 +249,7 @@ export default { }) }, openFileInPdf (attId, fileName) { - // 判断是否是图片格式,图片格式不预览,直接下载 - let index1 = fileName.lastIndexOf('.') - let index2 = fileName.length - let fileSuffix = fileName.substring(index1, index2) - //把后缀转大写 - if(fileSuffix !== undefined && fileSuffix !== null){ - fileSuffix = fileSuffix.toUpperCase() - } - // 判断上传文件格式 - if (fileSuffix === '.PNG'|| fileSuffix === '.JPG'|| fileSuffix === '.JPEG') { - this.downloadFile(attId) - return true - } - // 缺少文件 - if (this.$hasPermission('fd83032ae5f41a0021b00e93c88edbbg')) { - if (fileSuffix === '.PDG' || fileSuffix === '.pdg') { - this.getBusStandFileByAttId(attId) - .then(res => { - if(res){ - const editFileInfo = res - if(editFileInfo.fileSuffix === 'pdg' || editFileInfo.fileSuffix === 'PDG'){ - window.open('book://ssreader/e0?url='+editFileInfo.downLoadUrl) - } - } - }).catch(e => { - this.$message.warning('文件不存在,预览失败') - }) - }else { - this.$http.get('att/attFile/getBusStandFileByAttId', { - attId: attId - }, { - _this: this - }, res => { - if (res.data) { - let fileObj = {} - fileObj.fileId = res.data.attId - fileObj.fileName = fileName - let fileList = [] - let repeatData = 0 - if (sessionStorage.getItem('fileInfo')) { - fileList = JSON.parse(sessionStorage.getItem('fileInfo')) - if (fileList != null && fileList.length > 0) { - for (let i = 0; i < fileList.length; i++) { - if (fileList[i].fileId === res.data.attId) { - repeatData = 1 - break - } - } - if (repeatData === 0) { - fileList.push(fileObj) - fileList = JSON.stringify(fileList) - sessionStorage.setItem('fileInfo', fileList) - } - } - } else { - fileList.push(fileObj) - fileList = JSON.stringify(fileList) - sessionStorage.setItem('fileInfo', fileList) - } - window.open('/static/pdf/web/viewer.html?file=' + encodeURIComponent('/api/att/attFile/getFileInfo?fileId=' + res.data.attId)) - } else { - this.$message.error('文档未转换成功或本地读取不到该文档') - } - }, e => { - this.$message.error('文档未转换成功或本地读取不到该文档') - }) - } - } else { - this.$message.error('没有在线预览文档权限!') - } + this.$preview(attId) }, } }