mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-12 03:01:12 +00:00
feat: 优化链接获取逻辑
This commit is contained in:
parent
80d1e6469e
commit
4c2425c758
@ -482,6 +482,8 @@ export default {
|
|||||||
|
|
||||||
linkGet(refresh) {
|
linkGet(refresh) {
|
||||||
this.linkLoad++;
|
this.linkLoad++;
|
||||||
|
const {id, name} = this.linkData;
|
||||||
|
const previousGuestAccess = this.linkData.guest_access;
|
||||||
this.$store.dispatch("call", {
|
this.$store.dispatch("call", {
|
||||||
url: 'file/link',
|
url: 'file/link',
|
||||||
data: {
|
data: {
|
||||||
@ -490,10 +492,17 @@ export default {
|
|||||||
guest_access: this.linkData.guest_access ? 'yes' : 'no'
|
guest_access: this.linkData.guest_access ? 'yes' : 'no'
|
||||||
},
|
},
|
||||||
}).then(({data}) => {
|
}).then(({data}) => {
|
||||||
this.linkData = Object.assign(data, {
|
const guestAccess = data.guest_access !== undefined
|
||||||
id: this.linkData.id,
|
? Boolean(data.guest_access)
|
||||||
name: this.linkData.name,
|
: previousGuestAccess;
|
||||||
guest_access: Boolean(data.guest_access || this.linkData.guest_access) // 确保是布尔值
|
this.linkData = Object.assign({}, data, {
|
||||||
|
id,
|
||||||
|
name,
|
||||||
|
guest_access: guestAccess // 确保是布尔值
|
||||||
|
});
|
||||||
|
this.$store.dispatch("saveFile", {
|
||||||
|
id,
|
||||||
|
guest_access: guestAccess ? 1 : 0
|
||||||
});
|
});
|
||||||
// 根据不同情况处理
|
// 根据不同情况处理
|
||||||
if (refresh === true) {
|
if (refresh === true) {
|
||||||
|
|||||||
@ -1753,6 +1753,8 @@ export default {
|
|||||||
|
|
||||||
linkGet(refresh) {
|
linkGet(refresh) {
|
||||||
this.linkLoad++;
|
this.linkLoad++;
|
||||||
|
const {id, name} = this.linkData;
|
||||||
|
const previousGuestAccess = this.linkData.guest_access;
|
||||||
this.$store.dispatch("call", {
|
this.$store.dispatch("call", {
|
||||||
url: 'file/link',
|
url: 'file/link',
|
||||||
data: {
|
data: {
|
||||||
@ -1761,11 +1763,21 @@ export default {
|
|||||||
guest_access: this.linkData.guest_access ? 'yes' : 'no'
|
guest_access: this.linkData.guest_access ? 'yes' : 'no'
|
||||||
},
|
},
|
||||||
}).then(({data}) => {
|
}).then(({data}) => {
|
||||||
this.linkData = Object.assign(data, {
|
const guestAccess = data.guest_access !== undefined
|
||||||
id: this.linkData.id,
|
? Boolean(data.guest_access)
|
||||||
name: this.linkData.name,
|
: previousGuestAccess;
|
||||||
guest_access: Boolean(data.guest_access || this.linkData.guest_access) // 确保是布尔值
|
this.linkData = Object.assign({}, data, {
|
||||||
|
id,
|
||||||
|
name,
|
||||||
|
guest_access: guestAccess // 确保是布尔值
|
||||||
});
|
});
|
||||||
|
this.$store.dispatch("saveFile", {
|
||||||
|
id,
|
||||||
|
guest_access: guestAccess ? 1 : 0
|
||||||
|
});
|
||||||
|
if (this.fileInfo && this.fileInfo.id === id) {
|
||||||
|
this.$set(this.fileInfo, 'guest_access', guestAccess ? 1 : 0);
|
||||||
|
}
|
||||||
// 根据不同情况处理
|
// 根据不同情况处理
|
||||||
if (refresh === true) {
|
if (refresh === true) {
|
||||||
// 刷新链接时复制
|
// 刷新链接时复制
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user