修复:已共的享文件夹里新增文件,无法共享访问的问题
This commit is contained in:
parent
bbfef4481b
commit
af161e63f2
@ -52,7 +52,7 @@ export default {
|
||||
let url = fileConfig.previewUrl(this.$store.state.user.name, newFile, this.$store.getters.token)
|
||||
console.log(url)
|
||||
if(!this.$store.state.user.token){
|
||||
url = fileConfig.publicPreviewUrl(newFile.id);
|
||||
url = fileConfig.publicPreviewUrl(newFile.id, window.shareId);
|
||||
}
|
||||
let music = newFile.music
|
||||
let fileName = newFile.name.substring(0,newFile.name.length - newFile.suffix.length-1)
|
||||
|
||||
@ -91,7 +91,7 @@
|
||||
if(!element.isFolder && element.contentType.startsWith('image')){
|
||||
let url = fileConfig.previewUrl(this.$store.state.user.name, element, this.$store.getters.token)
|
||||
if(this.shareId){
|
||||
url = fileConfig.publicPreviewUrl(element.id);
|
||||
url = fileConfig.publicPreviewUrl(element.id, window.shareId);
|
||||
}
|
||||
this.images.push(url)
|
||||
if(this.file.id === element.id){
|
||||
|
||||
@ -101,7 +101,7 @@ export default {
|
||||
if(visible){
|
||||
let url = fileConfig.previewUrl(this.$store.state.user.name, this.file, this.$store.getters.token)
|
||||
if(this.shareId){
|
||||
url = fileConfig.publicPreviewUrl(this.file.id);
|
||||
url = fileConfig.publicPreviewUrl(this.file.id, window.shareId);
|
||||
}
|
||||
this.playerOptions.sources = [{
|
||||
//类型
|
||||
|
||||
@ -3,9 +3,11 @@ import fileApi from '@/api/file-api'
|
||||
export default {
|
||||
|
||||
baseUrl: '/api',
|
||||
// webDAV的url
|
||||
webDAVUrl: function(username) {
|
||||
return window.location.origin + `${this.baseUrl}/webDAV/${username}`
|
||||
},
|
||||
// 预览文件的url
|
||||
previewUrl: function(username, file, token) {
|
||||
if (token) {
|
||||
return `${this.baseUrl}/file/${username}${file.path}${file.name}?jmal-token=${token}`
|
||||
@ -13,40 +15,50 @@ export default {
|
||||
return `${this.baseUrl}/file/${username}${file.path}${file.name}`
|
||||
}
|
||||
},
|
||||
// mardown里上传图片后的图片预览地址
|
||||
mardownPreviewUrl: function (path){
|
||||
return window.location.origin + `${this.baseUrl}${path}`
|
||||
},
|
||||
publicPreviewUrl: function(fileId) {
|
||||
return `${this.baseUrl}/public/preview/${fileId}`
|
||||
},
|
||||
// 预览文件
|
||||
preview: function(username, file, token) {
|
||||
const url = this.previewUrl(username, file, token)
|
||||
window.open(url, '_blank')
|
||||
},
|
||||
publicPreview: function(fileIds) {
|
||||
const url = this.publicPreviewUrl(fileIds)
|
||||
window.open(url, '_blank')
|
||||
},
|
||||
// 下载文件
|
||||
download: function(username, file, token) {
|
||||
fileApi.isAllowDownload().then(() => {
|
||||
let url = `${this.baseUrl}/file/${username}${file.path}${file.name}?jmal-token=${token}&o=download`
|
||||
window.open(url, '_self')
|
||||
})
|
||||
},
|
||||
publicDownload: function(shareId, file) {
|
||||
window.open(this.publicDownloadUrl(shareId, file), '_self')
|
||||
},
|
||||
// 打包下载文件
|
||||
packageDownload: function(fileIds, token) {
|
||||
fileApi.isAllowDownload().then(() => {
|
||||
window.open(`${this.baseUrl}/packageDownload?fileIds=${fileIds}&jmal-token=${token}`, '_self')
|
||||
})
|
||||
},
|
||||
// 共享文件下载
|
||||
publicDownload: function(shareId, file) {
|
||||
window.open(this.publicDownloadUrl(shareId, file), '_self')
|
||||
},
|
||||
// 共享文件预览
|
||||
publicPreview: function(fileId, shareId) {
|
||||
const url = this.publicPreviewUrl(fileId, shareId)
|
||||
window.open(url, '_blank')
|
||||
},
|
||||
// 共享文件预览Url
|
||||
publicPreviewUrl: function(fileId, shareId) {
|
||||
return `${this.baseUrl}/public/s/preview/${fileId}/${shareId}`
|
||||
},
|
||||
// 共享文件打包下载
|
||||
publicPackageDownload: function(shareId, fileIds) {
|
||||
window.open(this.publicPackageDownloadUrl(shareId, fileIds), '_self')
|
||||
},
|
||||
// 共享文件下载Url
|
||||
publicDownloadUrl: function(shareId, file) {
|
||||
return window.location.origin + `${this.baseUrl}/public/s/download/${file.id}/${shareId}`
|
||||
},
|
||||
// 共享文件打包下载Url
|
||||
publicPackageDownloadUrl: function(shareId, fileIds) {
|
||||
return window.location.origin + `${this.baseUrl}/public/s/packageDownload?shareId=${shareId}&fileIds=${fileIds}`
|
||||
},
|
||||
|
||||
@ -896,6 +896,7 @@
|
||||
},
|
||||
// 点击文件或文件夹
|
||||
fileClick(row) {
|
||||
window.shareId = this.shareId
|
||||
if (row.isFolder) {
|
||||
// 打开文件夹
|
||||
const item = {}
|
||||
@ -933,7 +934,7 @@
|
||||
return
|
||||
}
|
||||
// 打开文件
|
||||
fileConfig.publicPreview(row.id)
|
||||
fileConfig.publicPreview(row.id, this.shareId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user