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;