fix: 修复挂载文件无法预览的问题

This commit is contained in:
jmal 2024-03-18 17:53:11 +08:00
parent 51f5e7e51b
commit 4aedaf1139
2 changed files with 6 additions and 4 deletions

View File

@ -3808,7 +3808,7 @@ export default {
totalSize += this.rowContextData.size; totalSize += this.rowContextData.size;
} }
if (totalSize > 0) { if (totalSize > 0) {
var fileIds = []; let fileIds = [];
if (this.$refs.fileListTable.tableSelectData.length > 0) { if (this.$refs.fileListTable.tableSelectData.length > 0) {
this.$refs.fileListTable.tableSelectData.forEach(value => { this.$refs.fileListTable.tableSelectData.forEach(value => {
fileIds.push(value.id); fileIds.push(value.id);
@ -4131,10 +4131,10 @@ export default {
}, 100); }, 100);
}, },
determineDownload(file) { determineDownload(file) {
this.downLaod(file); this.download(file);
this.notPreviewDialogVisible = false; this.notPreviewDialogVisible = false;
}, },
downLaod(file) { download(file) {
fileConfig.download( fileConfig.download(
this.$store.state.user.name, this.$store.state.user.name,
file, file,

View File

@ -22,11 +22,13 @@ export default {
// 预览文件的url // 预览文件的url
previewUrl: function(username, file, token, shareToken) { previewUrl: function(username, file, token, shareToken) {
let owner let owner
if (username !== store.getters.name) { console.log('username', username, 'store.getters.name', store.getters.name)
if (username !== store.getters.name || localStorage.getItem('mountFileOwner') !== undefined) {
owner = localStorage.getItem('mountFileOwner') owner = localStorage.getItem('mountFileOwner')
} else { } else {
owner = username owner = username
} }
console.log('owner', owner)
let fileUrl = `${this.baseUrl}/file/${owner}${encodeURI(file.path)}${encodeURI(file.name)}` let fileUrl = `${this.baseUrl}/file/${owner}${encodeURI(file.path)}${encodeURI(file.name)}`
fileUrl = fileUrl.replace(/%5C/g, '/') fileUrl = fileUrl.replace(/%5C/g, '/')
if (token) { if (token) {