diff --git a/src/components/jero/JImageUpload.vue b/src/components/jero/JImageUpload.vue index e94bd29..58f5a84 100644 --- a/src/components/jero/JImageUpload.vue +++ b/src/components/jero/JImageUpload.vue @@ -136,9 +136,14 @@ const fileObj = await this.getFileInfo(arr[a]) // 获取图片路径 const url = getFileAccessHttpUrl(fileObj.url) + const fileName = (fileObj || {}).fileName + const fileNameNotType = fileName.substring(0, fileName.lastIndexOf('.')) + const previewUrl = (fileObj || {}).url || '' + const previewName = previewUrl.substring(previewUrl.lastIndexOf(fileNameNotType)) fileList.push({ uid: uidGenerator(), name: (fileObj || {}).fileName, + previewName, status: 'done', url: url, response: { @@ -225,7 +230,7 @@ // 预览 handlePreview(file) { if (file && file.url) { - var fileFullUrl = `${window._CONFIG['domianWebSocketURL']}/sys/common/download/${file.response.result.id}?token=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${file.name}` + var fileFullUrl = `${window._CONFIG['domianWebSocketURL']}/sys/common/download/${file.response.result.id}?token=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${file.previewName || file.name}` // let url = `${window._CONFIG['onlinePreviewDomainURL']}?url=${encodeURIComponent(Base64.encode(fileFullUrl))}` let url = `${window._CONFIG['onlinePreviewDomainURL']}?url=${encodeURIComponent(fileFullUrl)}` window.open(url) diff --git a/src/components/jero/JUpload.vue b/src/components/jero/JUpload.vue index a774193..5cd8eb4 100644 --- a/src/components/jero/JUpload.vue +++ b/src/components/jero/JUpload.vue @@ -231,11 +231,16 @@ export default { } else { const fileObj = await this.getFileInfo(arr[a]) const url = getFileAccessHttpUrl(arr[a]) + const fileName = (fileObj || {}).fileName + const fileNameNotType = fileName.substring(0, fileName.lastIndexOf('.')) + const previewUrl = (fileObj || {}).url || '' + const previewName = previewUrl.substring(previewUrl.lastIndexOf(fileNameNotType)) fileList.push({ uid: uidGenerator(), name: (fileObj || {}).fileName, status: 'done', url: url, + previewName, response: { status: 'history', message: arr[a], @@ -383,7 +388,7 @@ export default { } // eslint-disable-next-line no-unreachable if (file && file.url) { - const fileFullUrl = `${window._CONFIG['domianWebSocketURL']}/sys/common/download/${file.response.result.id}?token=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${file.name}` + const fileFullUrl = `${window._CONFIG['domianWebSocketURL']}/sys/common/download/${file.response.result.id}?token=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${file.previewName}` let url = `${window._CONFIG['onlinePreviewDomainURL']}?url=${encodeURIComponent(fileFullUrl)}` // let url = `${window._CONFIG['onlinePreviewDomainURL']}?url=${encodeURIComponent(fileFullUrl)}` window.open(url) @@ -437,7 +442,7 @@ export default { */ myPreview(file) { if (file && file.url) { - const fileFullUrl = `${window._CONFIG['domianWebSocketURL']}/sys/common/download/${file.response.result.id}?token=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${file.name}` + const fileFullUrl = `${window._CONFIG['domianWebSocketURL']}/sys/common/download/${file.response.result.id}?token=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${file.previewName}` let url = `${window._CONFIG['onlinePreviewDomainURL']}?url=${encodeURIComponent(fileFullUrl)}` // let url = `${window._CONFIG['onlinePreviewDomainURL']}?url=${encodeURIComponent(fileFullUrl)}` window.open(url) diff --git a/src/components/jero/PreviewFile.vue b/src/components/jero/PreviewFile.vue index 266794c..bb9a27f 100644 --- a/src/components/jero/PreviewFile.vue +++ b/src/components/jero/PreviewFile.vue @@ -70,7 +70,11 @@ export default { for (let i = 0; i < arr.length; i++) { let fileObj = {} fileObj = await this.getFileInfo(arr[i]) - fileList.push({id: fileObj.id, name: fileObj.fileName}) + const fileName = (fileObj || {}).fileName + const fileNameNotType = fileName.substring(0, fileName.lastIndexOf('.')) + const previewUrl = (fileObj || {}).url || '' + const previewName = previewUrl.substring(previewUrl.lastIndexOf(fileNameNotType)) + fileList.push({id: fileObj.id, name: fileObj.fileName, previewName}) } this.fileList = [...fileList] }else { @@ -83,7 +87,7 @@ export default { }, handlePreview(file) { if (file && file.id) { - const fileFullUrl = `${window._CONFIG['domianWebSocketURL']}/sys/common/download/${file.id}?token=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${file.name}` + const fileFullUrl = `${window._CONFIG['domianWebSocketURL']}/sys/common/download/${file.id}?token=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${file.previewName}` let url = `${window._CONFIG['onlinePreviewDomainURL']}?url=${encodeURIComponent(fileFullUrl)}` // let url = `${window._CONFIG['onlinePreviewDomainURL']}?url=${encodeURIComponent(fileFullUrl)}` window.open(url)