fix: 私密分享的offic文件挂载后无法预览的问题 #82

This commit is contained in:
jmal 2024-04-30 16:51:06 +08:00
parent 47d6bf59ea
commit d960e09d14
3 changed files with 5 additions and 4 deletions

View File

@ -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) {

View File

@ -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()
})

View File

@ -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