perf: 优化父级目录的重复分享逻辑
This commit is contained in:
parent
833bb26c91
commit
fc8b8016dc
@ -108,7 +108,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button size="small" v-if="shareOptionConfig.shared" type="danger" @click="cancelShare">取消分享</el-button>
|
||||
<el-button size="small" v-if="shareOptionConfig.shared" type="danger" @click="cancelShare" v-loading="cancelSharing">取消分享</el-button>
|
||||
<el-button size="small" v-if="!shareOptionConfig.shared" type="primary" @click="submitShare"
|
||||
v-loading="generateShareLinkLoading">创建分享
|
||||
</el-button>
|
||||
@ -164,6 +164,7 @@ export default {
|
||||
audioCoverUrl: `${process.env.VUE_APP_BASE_API}/view/cover?jmal-token=${this.$store.state.user.token}&name=${this.$store.state.user.name}&id=`,
|
||||
shareDialogVisible: false,
|
||||
generateShareLinkLoading: false,
|
||||
cancelSharing: false,
|
||||
pickerOptions: {
|
||||
disabledDate(time) {
|
||||
const dateTime = new Date();
|
||||
@ -260,7 +261,7 @@ export default {
|
||||
this.showSharedPage(shareObject)
|
||||
})
|
||||
} else {
|
||||
this.showNotSharedPage()
|
||||
this.showNotSharedPage(this.file)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -293,14 +294,24 @@ export default {
|
||||
this.extractionCode = shareObject.extractionCode
|
||||
this.shareId = shareObject.shareId
|
||||
},
|
||||
showNotSharedPage() {
|
||||
showNotSharedPage(file) {
|
||||
this.shareOptionConfig.shared = false
|
||||
this.shareOptionConfig.linkLabel = '选择有效期'
|
||||
this.shareOption.isPrivacy = false
|
||||
this.shareOption.expiresDate = null
|
||||
this.shareOption.expiresDateOption = 1
|
||||
if (file.isShare) {
|
||||
this.shareOption.isPrivacy = file.isPrivacy
|
||||
if (file.expiresAt > 253398735999000) {
|
||||
this.shareOption.expiresDateOption = 1
|
||||
} else {
|
||||
this.shareOption.expiresDate = file.expiresAt
|
||||
this.shareOption.expiresDateOption = 2
|
||||
}
|
||||
}
|
||||
},
|
||||
shareDialogClose() {
|
||||
this.cancelSharing = false
|
||||
this.shareOptionConfig.shared = false
|
||||
this.$emit('update:status', this.shareDialogVisible)
|
||||
},
|
||||
@ -328,6 +339,7 @@ export default {
|
||||
},
|
||||
// 取消分享
|
||||
cancelShare() {
|
||||
this.cancelSharing = true
|
||||
let title = '确定要取消分享 "' + this.file.name + '" 吗?'
|
||||
this.$confirm(title, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
@ -341,7 +353,11 @@ export default {
|
||||
this.$emit('onCancelShare')
|
||||
this.shareDialogVisible = false
|
||||
this.shareDialogClose()
|
||||
}).catch(() => {
|
||||
this.cancelSharing = false
|
||||
})
|
||||
}).catch(() => {
|
||||
this.cancelSharing = false
|
||||
})
|
||||
},
|
||||
submitShare() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user