fix: 修复挂载文件根据位置跳转后无法返回上级目录的问题
This commit is contained in:
parent
f42ce5bb0e
commit
658b85885f
@ -264,7 +264,7 @@ export default {
|
|||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 挂用户获取分享文件信息 /mount/file_info
|
// 挂用户获取分享文件信息
|
||||||
getMountFileInfo: function(params) {
|
getMountFileInfo: function(params) {
|
||||||
return request({
|
return request({
|
||||||
url: '/mount/file_info',
|
url: '/mount/file_info',
|
||||||
@ -272,6 +272,14 @@ export default {
|
|||||||
params
|
params
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
// 挂用户获取目录Id
|
||||||
|
getMountFolderId: function(params) {
|
||||||
|
return request({
|
||||||
|
url: '/mount/folder/id',
|
||||||
|
method: 'get',
|
||||||
|
params
|
||||||
|
})
|
||||||
|
},
|
||||||
// 验证提取码
|
// 验证提取码
|
||||||
validShareCode: function(data) {
|
validShareCode: function(data) {
|
||||||
return request({
|
return request({
|
||||||
|
|||||||
@ -793,7 +793,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<el-button size="small" @click="deleteConfirmVisible = false">取 消</el-button>
|
<el-button size="small" @click="deleteConfirmVisible = false">取 消</el-button>
|
||||||
<el-button v-if="permanentDeleteDisable" type="danger" size="small" @click="sweepDeleteFile" :loading="deleteLoading">彻底删除</el-button>
|
<el-button v-if="permanentDeleteDisable" type="danger" size="small" @click="sweepDeleteFile" :loading="deleteLoading">彻底删除</el-button>
|
||||||
<el-button v-else type="warning" size="small" @click="moveToRecycle" :loading="deleteLoading">移至回收站</el-button>
|
<el-button v-if="!permanentDeleteDisable" type="warning" size="small" @click="moveToRecycle" :loading="deleteLoading">移至回收站</el-button>
|
||||||
</div>
|
</div>
|
||||||
</span>
|
</span>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
@ -2405,7 +2405,7 @@ export default {
|
|||||||
keywordQuery
|
keywordQuery
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
handleLink(item, index, unPushLink, unRefresh, keywordQuery) {
|
async handleLink(item, index, unPushLink, unRefresh, keywordQuery) {
|
||||||
this.pathList.splice(
|
this.pathList.splice(
|
||||||
this.pathList.findIndex((v, i) => i === index + 1),
|
this.pathList.findIndex((v, i) => i === index + 1),
|
||||||
this.pathList.length - (index + 1)
|
this.pathList.length - (index + 1)
|
||||||
@ -2427,6 +2427,9 @@ export default {
|
|||||||
this.path = this.path.replace(/\\/g, '/')
|
this.path = this.path.replace(/\\/g, '/')
|
||||||
})
|
})
|
||||||
let queryFolder = localStorage.getItem('mountFileOwner') ? localStorage.getItem(this.path) : this.$route.query.folder
|
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}` : ''
|
let searchOpenFolder = this.$route.query.searchOpenFolder ? `&searchOpenFolder=${this.$route.query.searchOpenFolder}` : ''
|
||||||
if (!unPushLink) {
|
if (!unPushLink) {
|
||||||
const queryTagId = this.$route.query.tagId
|
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() {
|
getBasePath() {
|
||||||
let basePath = this.$route.query.basePath
|
let basePath = this.$route.query.basePath
|
||||||
? `&basePath=${this.$route.query.basePath}`
|
? `&basePath=${this.$route.query.basePath}`
|
||||||
@ -4182,8 +4204,8 @@ export default {
|
|||||||
getSelectFileList() {
|
getSelectFileList() {
|
||||||
const fileList = [];
|
const fileList = [];
|
||||||
this.permanentDeleteDisable = false;
|
this.permanentDeleteDisable = false;
|
||||||
const addFileToList = ({ id, suffix, name, contentType, isFolder, music, video }) => {
|
const addFileToList = ({ id, suffix, name, mountFileId, contentType, isFolder, music, video }) => {
|
||||||
fileList.push({ id, suffix, name, contentType, isFolder, music, video });
|
fileList.push({ id, suffix, name, mountFileId, contentType, isFolder, music, video });
|
||||||
};
|
};
|
||||||
if (this.selectRowData.length > 1 || this.menusIsMultiple) {
|
if (this.selectRowData.length > 1 || this.menusIsMultiple) {
|
||||||
this.$refs.fileListTable.tableSelectData.forEach(value => addFileToList(value));
|
this.$refs.fileListTable.tableSelectData.forEach(value => addFileToList(value));
|
||||||
@ -4191,12 +4213,12 @@ export default {
|
|||||||
addFileToList(this.rowContextData);
|
addFileToList(this.rowContextData);
|
||||||
}
|
}
|
||||||
if (fileList.length > 0) {
|
if (fileList.length > 0) {
|
||||||
this.checkPermanentDelete(fileList[0].id);
|
this.checkPermanentDelete(fileList[0]);
|
||||||
}
|
}
|
||||||
return fileList;
|
return fileList;
|
||||||
},
|
},
|
||||||
checkPermanentDelete(fileId) {
|
checkPermanentDelete(file) {
|
||||||
if (/\//.test(fileId)) {
|
if (/\//.test(file.id) || file.mountFileId) {
|
||||||
this.permanentDeleteDisable = true
|
this.permanentDeleteDisable = true
|
||||||
this.permanentDelete = true
|
this.permanentDelete = true
|
||||||
}
|
}
|
||||||
@ -4464,6 +4486,9 @@ export default {
|
|||||||
if (this.dialogMoveOrCopyVisible) {
|
if (this.dialogMoveOrCopyVisible) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
if (this.deleteConfirmVisible) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
return this.notPreviewDialogVisible;
|
return this.notPreviewDialogVisible;
|
||||||
},
|
},
|
||||||
determineDownload(file) {
|
determineDownload(file) {
|
||||||
|
|||||||
@ -195,22 +195,29 @@ export default {
|
|||||||
visible(val) {
|
visible(val) {
|
||||||
this.$emit('update:visible', val)
|
this.$emit('update:visible', val)
|
||||||
if (val) {
|
if (val) {
|
||||||
this.filepath = this.file.path
|
this.filepath = this.getLocalPath(this.file.path)
|
||||||
this.pathUrl = `/?path=${this.file.path}&highlight=${this.file.name}`
|
this.pathUrl = `/?path=${this.filepath}&highlight=${this.file.name}`
|
||||||
this.getIsSync()
|
this.getIsSync()
|
||||||
if (this.fileUsername) {
|
if (this.fileUsername) {
|
||||||
fileApi.getMountFileInfo({
|
fileApi.getMountFileInfo({
|
||||||
fileId: this.file.id,
|
fileId: this.file.id,
|
||||||
fileUsername: this.fileUsername
|
fileUsername: this.fileUsername
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
this.filepath = res.data.path
|
const path = this.getLocalPath(res.data.path)
|
||||||
this.pathUrl = `/?path=${res.data.path}&highlight=${this.file.name}&folder=${res.data.folder}`
|
this.filepath = path
|
||||||
|
this.pathUrl = `/?path=${path}&highlight=${this.file.name}&folder=${res.data.folder}`
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getLocalPath(path) {
|
||||||
|
if (path === '/') {
|
||||||
|
return path
|
||||||
|
}
|
||||||
|
return path.endsWith('/') ? path.slice(0, -1) : path
|
||||||
|
},
|
||||||
isOSSFile(file) {
|
isOSSFile(file) {
|
||||||
if (!file || !file.id) {
|
if (!file || !file.id) {
|
||||||
return false
|
return false
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user