fix: 创建分享时检测是否含有子分享

This commit is contained in:
jmal 2025-01-12 00:40:08 +08:00
parent 7c562f4a66
commit e7c8fa63d9
3 changed files with 36 additions and 4 deletions

View File

@ -237,7 +237,7 @@ export default {
params
})
},
// 检测是否含有子分享
// 检测分享文件下是否含有子分享
hasSubShare: function(params) {
return request({
url: '/share/has-sub-share',
@ -248,6 +248,14 @@ export default {
}
})
},
// 检测文件下是否含有子分享
folderSubShare: function(params) {
return request({
url: '/share/folder-sub-share',
method: 'get',
params
})
},
// 取消分享
cancelShareLink: function(params) {
return request({

View File

@ -343,7 +343,7 @@ export default {
api.hasSubShare({shareIds: [this.shareId]}).then(res => {
if (res.data) {
this.$confirm('选择的文件夹下存其他分享,取消分享后其下的所有分享链接都将被删除,是否继续?', '提示', {
this.$confirm('所选的文件夹下存其他分享,取消分享后其下的所有分享链接都将被删除,是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
@ -425,7 +425,30 @@ export default {
this.generateShareLinkLoading = false
return
}
// 检查文件夹下是否有其他分享
if (this.file.isFolder) {
api.folderSubShare({fileId: this.file.id}).then(res => {
if (res.data) {
this.$confirm('所选的文件夹下存其他分享,创建分享后将会覆盖其下所有已分享的链接参数,是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.doCreateShare(update, expireDate)
}).catch(() => {
this.generateShareLinkLoading = false
})
} else {
this.doCreateShare(update, expireDate)
}
}).catch(() => {
this.generateShareLinkLoading = false
})
} else {
this.doCreateShare(update, expireDate)
}
},
doCreateShare(update, expireDate) {
api.generate({
shortId: this.shareOption.customAddr,
userId: this.$store.state.user.userId,

View File

@ -79,6 +79,7 @@
</template>
<template slot-scope="scope">
<span class="table-file-name">{{ scope.row.fileName }}</span>
<span v-if="scope.row.fatherShareId" style="color: #9a9a9a">(子分享)</span>
</template>
</pl-table-column>
<!--取消分享-->
@ -460,7 +461,7 @@
api.hasSubShare({shareIds: shareIds}).then(res => {
if (res.data) {
this.$confirm('选择的文件夹下存其他分享,取消分享后其下的所有分享链接都将被删除,是否继续?', '提示', {
this.$confirm('所选的文件夹下存其他分享,取消分享后其下的所有分享链接都将被删除,是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'