From 8f1758c4395021d2028d5ff24b9da358ee74daf1 Mon Sep 17 00:00:00 2001 From: ronger Date: Tue, 20 Apr 2021 10:17:03 +0800 Subject: [PATCH] :ambulance: https://github.com/rymcu/forest/issues/40 --- pages/article/post/_article_id.vue | 105 ++++++++++++++++++----------- 1 file changed, 64 insertions(+), 41 deletions(-) diff --git a/pages/article/post/_article_id.vue b/pages/article/post/_article_id.vue index be31e60..b3b1311 100644 --- a/pages/article/post/_article_id.vue +++ b/pages/article/post/_article_id.vue @@ -1,46 +1,57 @@ @@ -66,7 +77,16 @@ computed: { ...mapState({ article: state => state.article.detail.data - }) + }), + hasPermissions() { + let account = this.$store.state.userInfo?.nickname; + if (account) { + if (account === this.article.articleAuthor.userNickname) { + return true; + } + } + return this.$store.getters.hasPermissions('blog_admin'); + } }, data() { return { @@ -346,6 +366,9 @@ window.onbeforeunload = null; }, async mounted() { + if (!this.hasPermissions) { + return + } window.addEventListener('beforeunload', e => { e = e || window.event;