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