From d960e09d14937b2502716140923a39d1fb1e3122 Mon Sep 17 00:00:00 2001 From: jmal Date: Tue, 30 Apr 2024 16:51:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=A7=81=E5=AF=86=E5=88=86=E4=BA=AB?= =?UTF-8?q?=E7=9A=84offic=E6=96=87=E4=BB=B6=E6=8C=82=E8=BD=BD=E5=90=8E?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E9=A2=84=E8=A7=88=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=20#82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ShowFile/ShowFile.vue | 1 + src/components/office/OnlyOfficeEditor.vue | 6 +++--- src/utils/file-config.js | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/ShowFile/ShowFile.vue b/src/components/ShowFile/ShowFile.vue index 4ad40ba..6015ed3 100644 --- a/src/components/ShowFile/ShowFile.vue +++ b/src/components/ShowFile/ShowFile.vue @@ -2653,6 +2653,7 @@ export default { }, // 设置挂载文件的用户名(文件的所有者) setMountFileOwner() { + localStorage.removeItem('mountFileOwner') if (this.$route.query.folder && this.fileList.length > 0) { let firstFile = this.fileList[0] if (firstFile.userId !== this.$store.getters.userId) { diff --git a/src/components/office/OnlyOfficeEditor.vue b/src/components/office/OnlyOfficeEditor.vue index 4a79216..e46dadb 100644 --- a/src/components/office/OnlyOfficeEditor.vue +++ b/src/components/office/OnlyOfficeEditor.vue @@ -100,13 +100,13 @@ export default { this.$store.dispatch('updateMessage', { event: 'loadFileFailed'}) return } - if(this.$store.state.user.token && this.$store.state.user.userId === this.file.userId){ - api.getFileInfoById({id: this.file.id}).then(res => { + if (!this.shareId) { + api.getPublicFileInfoById({fileId: this.file.id, shareId: this.shareId}).then(res => { this.file = res.data this.loadFile() }) } else { - api.getPublicFileInfoById({fileId: this.file.id, shareId: this.shareId}).then(res => { + api.getFileInfoById({id: this.file.id}).then(res => { this.file = res.data this.loadFile() }) diff --git a/src/utils/file-config.js b/src/utils/file-config.js index a56d9c9..c939bac 100644 --- a/src/utils/file-config.js +++ b/src/utils/file-config.js @@ -22,7 +22,7 @@ export default { // 预览文件的url previewUrl: function(username, file, token, shareToken) { let owner = null - if (username !== store.getters.name || localStorage.getItem('mountFileOwner') !== undefined) { + if (username !== store.getters.name || localStorage.getItem('mountFileOwner') !== null) { owner = localStorage.getItem('mountFileOwner') } else { owner = username