commit
f15fbea449
@ -237,6 +237,25 @@ export default {
|
|||||||
params
|
params
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
// 检测分享文件下是否含有子分享
|
||||||
|
hasSubShare: function(params) {
|
||||||
|
return request({
|
||||||
|
url: '/share/has-sub-share',
|
||||||
|
method: 'get',
|
||||||
|
params,
|
||||||
|
paramsSerializer: function(params) {
|
||||||
|
return qs.stringify(params, { arrayFormat: 'repeat' })
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 检测文件下是否含有子分享
|
||||||
|
folderSubShare: function(params) {
|
||||||
|
return request({
|
||||||
|
url: '/share/folder-sub-share',
|
||||||
|
method: 'get',
|
||||||
|
params
|
||||||
|
})
|
||||||
|
},
|
||||||
// 取消分享
|
// 取消分享
|
||||||
cancelShareLink: function(params) {
|
cancelShareLink: function(params) {
|
||||||
return request({
|
return request({
|
||||||
|
|||||||
@ -108,7 +108,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div slot="footer" class="dialog-footer">
|
<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"
|
<el-button size="small" v-if="!shareOptionConfig.shared" type="primary" @click="submitShare"
|
||||||
v-loading="generateShareLinkLoading">创建分享
|
v-loading="generateShareLinkLoading">创建分享
|
||||||
</el-button>
|
</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=`,
|
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,
|
shareDialogVisible: false,
|
||||||
generateShareLinkLoading: false,
|
generateShareLinkLoading: false,
|
||||||
|
cancelSharing: false,
|
||||||
pickerOptions: {
|
pickerOptions: {
|
||||||
disabledDate(time) {
|
disabledDate(time) {
|
||||||
const dateTime = new Date();
|
const dateTime = new Date();
|
||||||
@ -260,7 +261,7 @@ export default {
|
|||||||
this.showSharedPage(shareObject)
|
this.showSharedPage(shareObject)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
this.showNotSharedPage()
|
this.showNotSharedPage(this.file)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -293,14 +294,24 @@ export default {
|
|||||||
this.extractionCode = shareObject.extractionCode
|
this.extractionCode = shareObject.extractionCode
|
||||||
this.shareId = shareObject.shareId
|
this.shareId = shareObject.shareId
|
||||||
},
|
},
|
||||||
showNotSharedPage() {
|
showNotSharedPage(file) {
|
||||||
this.shareOptionConfig.shared = false
|
this.shareOptionConfig.shared = false
|
||||||
this.shareOptionConfig.linkLabel = '选择有效期'
|
this.shareOptionConfig.linkLabel = '选择有效期'
|
||||||
this.shareOption.isPrivacy = false
|
this.shareOption.isPrivacy = false
|
||||||
this.shareOption.expiresDate = null
|
this.shareOption.expiresDate = null
|
||||||
this.shareOption.expiresDateOption = 1
|
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() {
|
shareDialogClose() {
|
||||||
|
this.cancelSharing = false
|
||||||
this.shareOptionConfig.shared = false
|
this.shareOptionConfig.shared = false
|
||||||
this.$emit('update:status', this.shareDialogVisible)
|
this.$emit('update:status', this.shareDialogVisible)
|
||||||
},
|
},
|
||||||
@ -328,20 +339,45 @@ export default {
|
|||||||
},
|
},
|
||||||
// 取消分享
|
// 取消分享
|
||||||
cancelShare() {
|
cancelShare() {
|
||||||
let title = '确定要取消分享 "' + this.file.name + '" 吗?'
|
this.cancelSharing = true
|
||||||
this.$confirm(title, '提示', {
|
|
||||||
confirmButtonText: '确定',
|
api.hasSubShare({shareIds: [this.shareId]}).then(res => {
|
||||||
cancelButtonText: '取消',
|
if (res.data) {
|
||||||
type: 'warning'
|
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(() => {
|
}).then(() => {
|
||||||
api.cancelShareLink({
|
this.$emit('onCancelShare')
|
||||||
userId: this.$store.state.user.userId,
|
this.shareDialogVisible = false
|
||||||
shareId: [this.shareId]
|
this.shareDialogClose()
|
||||||
}).then(() => {
|
}).catch(() => {
|
||||||
this.$emit('onCancelShare')
|
this.cancelSharing = false
|
||||||
this.shareDialogVisible = false
|
|
||||||
this.shareDialogClose()
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
submitShare() {
|
submitShare() {
|
||||||
@ -389,7 +425,30 @@ export default {
|
|||||||
this.generateShareLinkLoading = false
|
this.generateShareLinkLoading = false
|
||||||
return
|
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({
|
api.generate({
|
||||||
shortId: this.shareOption.customAddr,
|
shortId: this.shareOption.customAddr,
|
||||||
userId: this.$store.state.user.userId,
|
userId: this.$store.state.user.userId,
|
||||||
|
|||||||
@ -79,6 +79,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span class="table-file-name">{{ scope.row.fileName }}</span>
|
<span class="table-file-name">{{ scope.row.fileName }}</span>
|
||||||
|
<span v-if="scope.row.fatherShareId" style="color: #9a9a9a">(子分享)</span>
|
||||||
</template>
|
</template>
|
||||||
</pl-table-column>
|
</pl-table-column>
|
||||||
<!--取消分享-->
|
<!--取消分享-->
|
||||||
@ -448,30 +449,47 @@
|
|||||||
},
|
},
|
||||||
// 取消分享
|
// 取消分享
|
||||||
cancelShare(row) {
|
cancelShare(row) {
|
||||||
let title = row === false ? '确定要取消选中的' + this.selectRowData.length + '项分享吗?' : '确定要取消分享 "' + row.fileName + '" 吗?'
|
|
||||||
this.$confirm(title, '提示', {
|
let shareIds = []
|
||||||
confirmButtonText: '确定',
|
if(row){
|
||||||
cancelButtonText: '取消',
|
shareIds.push(row.id)
|
||||||
type: 'warning'
|
} else {
|
||||||
}).then(() => {
|
this.selectRowData.forEach(row => {
|
||||||
let shareIds = []
|
|
||||||
if(row){
|
|
||||||
shareIds.push(row.id)
|
shareIds.push(row.id)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
api.hasSubShare({shareIds: shareIds}).then(res => {
|
||||||
|
if (res.data) {
|
||||||
|
this.$confirm('所选的文件夹下存其他分享,取消分享后其下的所有分享链接都将被删除,是否继续?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
this.doCancelShare(shareIds)
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
this.selectRowData.forEach(row => {
|
let title = row === false ? '确定要取消选中的' + this.selectRowData.length + '项分享吗?' : '确定要取消分享 "' + row.fileName + '" 吗?'
|
||||||
shareIds.push(row.id)
|
this.$confirm(title, '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
this.doCancelShare(shareIds)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
api.cancelShareLink({
|
})
|
||||||
userId: this.$store.state.user.userId,
|
},
|
||||||
shareId: shareIds
|
doCancelShare(shareIds) {
|
||||||
}).then(() => {
|
api.cancelShareLink({
|
||||||
if(shareIds.length === 1){
|
userId: this.$store.state.user.userId,
|
||||||
this.fileList.splice(row.index,1)
|
shareId: shareIds
|
||||||
}else{
|
}).then(() => {
|
||||||
this.getFileList()
|
if(shareIds.length === 1){
|
||||||
}
|
this.fileList.splice(row.index,1)
|
||||||
})
|
}else{
|
||||||
|
this.getFileList()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
onCancelShare() {
|
onCancelShare() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user