perf: 取消分享前提示子分享
This commit is contained in:
parent
fc8b8016dc
commit
7c562f4a66
@ -237,6 +237,17 @@ export default {
|
||||
params
|
||||
})
|
||||
},
|
||||
// 检测是否含有子分享
|
||||
hasSubShare: function(params) {
|
||||
return request({
|
||||
url: '/share/has-sub-share',
|
||||
method: 'get',
|
||||
params,
|
||||
paramsSerializer: function(params) {
|
||||
return qs.stringify(params, { arrayFormat: 'repeat' })
|
||||
}
|
||||
})
|
||||
},
|
||||
// 取消分享
|
||||
cancelShareLink: function(params) {
|
||||
return request({
|
||||
|
||||
@ -340,22 +340,42 @@ export default {
|
||||
// 取消分享
|
||||
cancelShare() {
|
||||
this.cancelSharing = true
|
||||
let title = '确定要取消分享 "' + this.file.name + '" 吗?'
|
||||
this.$confirm(title, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
|
||||
api.hasSubShare({shareIds: [this.shareId]}).then(res => {
|
||||
if (res.data) {
|
||||
this.$confirm('选择的文件夹下存其他分享,取消分享后其下的所有分享链接都将被删除,是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.doCancelShareLink()
|
||||
}).catch(() => {
|
||||
this.cancelSharing = false
|
||||
})
|
||||
} else {
|
||||
let title = '确定要取消分享 "' + this.file.name + '" 吗?'
|
||||
this.$confirm(title, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.doCancelShareLink()
|
||||
}).catch(() => {
|
||||
this.cancelSharing = false
|
||||
})
|
||||
}
|
||||
}).catch(() => {
|
||||
this.cancelSharing = false
|
||||
})
|
||||
},
|
||||
doCancelShareLink() {
|
||||
api.cancelShareLink({
|
||||
userId: this.$store.state.user.userId,
|
||||
shareId: [this.shareId]
|
||||
}).then(() => {
|
||||
api.cancelShareLink({
|
||||
userId: this.$store.state.user.userId,
|
||||
shareId: [this.shareId]
|
||||
}).then(() => {
|
||||
this.$emit('onCancelShare')
|
||||
this.shareDialogVisible = false
|
||||
this.shareDialogClose()
|
||||
}).catch(() => {
|
||||
this.cancelSharing = false
|
||||
})
|
||||
this.$emit('onCancelShare')
|
||||
this.shareDialogVisible = false
|
||||
this.shareDialogClose()
|
||||
}).catch(() => {
|
||||
this.cancelSharing = false
|
||||
})
|
||||
|
||||
@ -448,30 +448,47 @@
|
||||
},
|
||||
// 取消分享
|
||||
cancelShare(row) {
|
||||
let title = row === false ? '确定要取消选中的' + this.selectRowData.length + '项分享吗?' : '确定要取消分享 "' + row.fileName + '" 吗?'
|
||||
this.$confirm(title, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
let shareIds = []
|
||||
if(row){
|
||||
|
||||
let shareIds = []
|
||||
if(row){
|
||||
shareIds.push(row.id)
|
||||
} else {
|
||||
this.selectRowData.forEach(row => {
|
||||
shareIds.push(row.id)
|
||||
})
|
||||
}
|
||||
|
||||
api.hasSubShare({shareIds: shareIds}).then(res => {
|
||||
if (res.data) {
|
||||
this.$confirm('选择的文件夹下存其他分享,取消分享后其下的所有分享链接都将被删除,是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.doCancelShare(shareIds)
|
||||
})
|
||||
} else {
|
||||
this.selectRowData.forEach(row => {
|
||||
shareIds.push(row.id)
|
||||
let title = row === false ? '确定要取消选中的' + this.selectRowData.length + '项分享吗?' : '确定要取消分享 "' + row.fileName + '" 吗?'
|
||||
this.$confirm(title, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.doCancelShare(shareIds)
|
||||
})
|
||||
}
|
||||
api.cancelShareLink({
|
||||
userId: this.$store.state.user.userId,
|
||||
shareId: shareIds
|
||||
}).then(() => {
|
||||
if(shareIds.length === 1){
|
||||
this.fileList.splice(row.index,1)
|
||||
}else{
|
||||
this.getFileList()
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
doCancelShare(shareIds) {
|
||||
api.cancelShareLink({
|
||||
userId: this.$store.state.user.userId,
|
||||
shareId: shareIds
|
||||
}).then(() => {
|
||||
if(shareIds.length === 1){
|
||||
this.fileList.splice(row.index,1)
|
||||
}else{
|
||||
this.getFileList()
|
||||
}
|
||||
})
|
||||
},
|
||||
onCancelShare() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user