diff --git a/src/api/file-api.js b/src/api/file-api.js index 13bf778..bf40969 100644 --- a/src/api/file-api.js +++ b/src/api/file-api.js @@ -264,7 +264,7 @@ export default { data: data }) }, - // 挂用户获取分享文件信息 /mount/file_info + // 挂用户获取分享文件信息 getMountFileInfo: function(params) { return request({ url: '/mount/file_info', @@ -272,6 +272,14 @@ export default { params }) }, + // 挂用户获取目录Id + getMountFolderId: function(params) { + return request({ + url: '/mount/folder/id', + method: 'get', + params + }) + }, // 验证提取码 validShareCode: function(data) { return request({ diff --git a/src/components/ShowFile/ShowFile.vue b/src/components/ShowFile/ShowFile.vue index 675d47f..2f74db3 100644 --- a/src/components/ShowFile/ShowFile.vue +++ b/src/components/ShowFile/ShowFile.vue @@ -793,7 +793,7 @@
取 消 彻底删除 - 移至回收站 + 移至回收站
@@ -2405,7 +2405,7 @@ export default { keywordQuery ) }, - handleLink(item, index, unPushLink, unRefresh, keywordQuery) { + async handleLink(item, index, unPushLink, unRefresh, keywordQuery) { this.pathList.splice( this.pathList.findIndex((v, i) => i === index + 1), this.pathList.length - (index + 1) @@ -2427,6 +2427,9 @@ export default { this.path = this.path.replace(/\\/g, '/') }) let queryFolder = localStorage.getItem('mountFileOwner') ? localStorage.getItem(this.path) : this.$route.query.folder + if (localStorage.getItem('mountFileOwner') && !queryFolder) { + queryFolder = await this.getMountFolderId(this.$route.query.folder, localStorage.getItem('mountFileOwner'), this.path) + } let searchOpenFolder = this.$route.query.searchOpenFolder ? `&searchOpenFolder=${this.$route.query.searchOpenFolder}` : '' if (!unPushLink) { const queryTagId = this.$route.query.tagId @@ -2453,6 +2456,25 @@ export default { } } }, + getMountFolderId(currentFolder, fileUsername, path) { + return new Promise((resolve, reject) => { + api.getMountFolderId({ + otherFileId: currentFolder, + fileUsername: fileUsername, + path: path + }) + .then(res => { + if (res.data) { + resolve(res.data) + } else { + resolve('') + } + }) + .catch(error => { + reject('') + }) + }) + }, getBasePath() { let basePath = this.$route.query.basePath ? `&basePath=${this.$route.query.basePath}` @@ -4182,8 +4204,8 @@ export default { getSelectFileList() { const fileList = []; this.permanentDeleteDisable = false; - const addFileToList = ({ id, suffix, name, contentType, isFolder, music, video }) => { - fileList.push({ id, suffix, name, contentType, isFolder, music, video }); + const addFileToList = ({ id, suffix, name, mountFileId, contentType, isFolder, music, video }) => { + fileList.push({ id, suffix, name, mountFileId, contentType, isFolder, music, video }); }; if (this.selectRowData.length > 1 || this.menusIsMultiple) { this.$refs.fileListTable.tableSelectData.forEach(value => addFileToList(value)); @@ -4191,12 +4213,12 @@ export default { addFileToList(this.rowContextData); } if (fileList.length > 0) { - this.checkPermanentDelete(fileList[0].id); + this.checkPermanentDelete(fileList[0]); } return fileList; }, - checkPermanentDelete(fileId) { - if (/\//.test(fileId)) { + checkPermanentDelete(file) { + if (/\//.test(file.id) || file.mountFileId) { this.permanentDeleteDisable = true this.permanentDelete = true } @@ -4464,6 +4486,9 @@ export default { if (this.dialogMoveOrCopyVisible) { return true } + if (this.deleteConfirmVisible) { + return true + } return this.notPreviewDialogVisible; }, determineDownload(file) { diff --git a/src/components/preview/FileDetails.vue b/src/components/preview/FileDetails.vue index 394727e..7d995b0 100644 --- a/src/components/preview/FileDetails.vue +++ b/src/components/preview/FileDetails.vue @@ -195,22 +195,29 @@ export default { visible(val) { this.$emit('update:visible', val) if (val) { - this.filepath = this.file.path - this.pathUrl = `/?path=${this.file.path}&highlight=${this.file.name}` + this.filepath = this.getLocalPath(this.file.path) + this.pathUrl = `/?path=${this.filepath}&highlight=${this.file.name}` this.getIsSync() if (this.fileUsername) { fileApi.getMountFileInfo({ fileId: this.file.id, fileUsername: this.fileUsername }).then((res) => { - this.filepath = res.data.path - this.pathUrl = `/?path=${res.data.path}&highlight=${this.file.name}&folder=${res.data.folder}` + const path = this.getLocalPath(res.data.path) + this.filepath = path + this.pathUrl = `/?path=${path}&highlight=${this.file.name}&folder=${res.data.folder}` }) } } } }, methods: { + getLocalPath(path) { + if (path === '/') { + return path + } + return path.endsWith('/') ? path.slice(0, -1) : path + }, isOSSFile(file) { if (!file || !file.id) { return false