添加authorid

This commit is contained in:
fofolee 2022-05-16 12:00:44 +08:00
parent d17caf42af
commit 6f4bf8fe96
2 changed files with 9 additions and 4 deletions

View File

@ -84,7 +84,11 @@ export default {
}, },
computed: { computed: {
disableShare() { disableShare() {
return this.shareLock || !this.yuQueInfo.yuQueToken; return (
this.shareLock ||
!this.yuQueInfo.yuQueToken ||
this.yuQueInfo.authorId !== this.command.authorId
);
}, },
}, },
mounted() { mounted() {

View File

@ -179,7 +179,8 @@ export default {
this.getCommand( this.getCommand(
item.slug, item.slug,
item.content_updated_at, item.content_updated_at,
item.last_editor.name item.last_editor.name,
item.last_editor.id
).then((command) => { ).then((command) => {
this.commands.push(command); this.commands.push(command);
}); });
@ -211,7 +212,7 @@ export default {
this.fetchCommandDetails(1); this.fetchCommandDetails(1);
}, },
// //
async getCommand(id, updateTime, authorName) { async getCommand(id, updateTime, authorName, authorId) {
let localCache = JSON.parse(localStorage.getItem(id)); let localCache = JSON.parse(localStorage.getItem(id));
if (localCache?.updateTime === updateTime) return localCache; if (localCache?.updateTime === updateTime) return localCache;
let res = await window.yuQueClient( let res = await window.yuQueClient(
@ -221,7 +222,7 @@ export default {
res.data?.data.body.match(/```json([\s\S]*)```/)?.[1] res.data?.data.body.match(/```json([\s\S]*)```/)?.[1]
); );
if (!command) return; if (!command) return;
Object.assign(command, { authorName, updateTime }); Object.assign(command, { authorName, updateTime, authorId });
localStorage.setItem(id, JSON.stringify(command)); localStorage.setItem(id, JSON.stringify(command));
return command; return command;
}, },