去除文件预览url的 base64加密

This commit is contained in:
fengachen
2021-11-09 15:44:34 +08:00
parent 98c63a8665
commit 2c7ff76073
2 changed files with 5 additions and 5 deletions
+3 -3
View File
@@ -56,7 +56,7 @@ import {getFileAccessHttpUrl, downloadFile} from '@/api/manage'
import {getFileInfo} from '@/api/api' import {getFileInfo} from '@/api/api'
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
const Base64 = require('js-base64').Base64 // const Base64 = require('js-base64').Base64
const FILE_TYPE_ALL = 'all' const FILE_TYPE_ALL = 'all'
const FILE_TYPE_IMG = 'image' const FILE_TYPE_IMG = 'image'
@@ -384,7 +384,7 @@ export default {
// eslint-disable-next-line no-unreachable // eslint-disable-next-line no-unreachable
if (file && file.url) { 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.name}`
let url = `${window._CONFIG['onlinePreviewDomainURL']}?url=${encodeURIComponent(Base64.encode(fileFullUrl))}` let url = `${window._CONFIG['onlinePreviewDomainURL']}?url=${encodeURIComponent(fileFullUrl)}`
// let url = `${window._CONFIG['onlinePreviewDomainURL']}?url=${encodeURIComponent(fileFullUrl)}` // let url = `${window._CONFIG['onlinePreviewDomainURL']}?url=${encodeURIComponent(fileFullUrl)}`
window.open(url) window.open(url)
} }
@@ -438,7 +438,7 @@ export default {
myPreview(file) { myPreview(file) {
if (file && file.url) { 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.name}`
let url = `${window._CONFIG['onlinePreviewDomainURL']}?url=${encodeURIComponent(Base64.encode(fileFullUrl))}` let url = `${window._CONFIG['onlinePreviewDomainURL']}?url=${encodeURIComponent(fileFullUrl)}`
// let url = `${window._CONFIG['onlinePreviewDomainURL']}?url=${encodeURIComponent(fileFullUrl)}` // let url = `${window._CONFIG['onlinePreviewDomainURL']}?url=${encodeURIComponent(fileFullUrl)}`
window.open(url) window.open(url)
} }
+2 -2
View File
@@ -13,7 +13,7 @@ import {ACCESS_TOKEN} from '@/store/mutation-types'
import {getFileInfo} from '@/api/api' import {getFileInfo} from '@/api/api'
import {downloadFile} from '@api/manage' import {downloadFile} from '@api/manage'
// eslint-disable-next-line // eslint-disable-next-line
const Base64 = require('js-base64').Base64 // const Base64 = require('js-base64').Base64
export default { export default {
@@ -84,7 +84,7 @@ export default {
handlePreview(file) { handlePreview(file) {
if (file && file.id) { 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.name}`
let url = `${window._CONFIG['onlinePreviewDomainURL']}?url=${encodeURIComponent(Base64.encode(fileFullUrl))}` let url = `${window._CONFIG['onlinePreviewDomainURL']}?url=${encodeURIComponent(fileFullUrl)}`
// let url = `${window._CONFIG['onlinePreviewDomainURL']}?url=${encodeURIComponent(fileFullUrl)}` // let url = `${window._CONFIG['onlinePreviewDomainURL']}?url=${encodeURIComponent(fileFullUrl)}`
window.open(url) window.open(url)
} }