From 6f4bf8fe96ffab7a92b5a5007185c7860ee0f021 Mon Sep 17 00:00:00 2001 From: fofolee Date: Mon, 16 May 2022 12:00:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0authorid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/popup/ShareDialog.vue | 6 +++++- src/pages/ShareCenterPage.vue | 7 ++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/components/popup/ShareDialog.vue b/src/components/popup/ShareDialog.vue index 7aa88cd..83cb8a0 100644 --- a/src/components/popup/ShareDialog.vue +++ b/src/components/popup/ShareDialog.vue @@ -84,7 +84,11 @@ export default { }, computed: { disableShare() { - return this.shareLock || !this.yuQueInfo.yuQueToken; + return ( + this.shareLock || + !this.yuQueInfo.yuQueToken || + this.yuQueInfo.authorId !== this.command.authorId + ); }, }, mounted() { diff --git a/src/pages/ShareCenterPage.vue b/src/pages/ShareCenterPage.vue index bf06ab7..13faaf3 100644 --- a/src/pages/ShareCenterPage.vue +++ b/src/pages/ShareCenterPage.vue @@ -179,7 +179,8 @@ export default { this.getCommand( item.slug, item.content_updated_at, - item.last_editor.name + item.last_editor.name, + item.last_editor.id ).then((command) => { this.commands.push(command); }); @@ -211,7 +212,7 @@ export default { this.fetchCommandDetails(1); }, // 如果远端更新时间和本地相同则读取本地缓存,否则更新 - async getCommand(id, updateTime, authorName) { + async getCommand(id, updateTime, authorName, authorId) { let localCache = JSON.parse(localStorage.getItem(id)); if (localCache?.updateTime === updateTime) return localCache; let res = await window.yuQueClient( @@ -221,7 +222,7 @@ export default { res.data?.data.body.match(/```json([\s\S]*)```/)?.[1] ); if (!command) return; - Object.assign(command, { authorName, updateTime }); + Object.assign(command, { authorName, updateTime, authorId }); localStorage.setItem(id, JSON.stringify(command)); return command; },