From 2a7af045ab36b4bc474410d7472133a71f329383 Mon Sep 17 00:00:00 2001 From: x ronger Date: Wed, 23 Sep 2020 22:39:36 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E4=BF=AE=E6=94=B9=E6=96=87?= =?UTF-8?q?=E7=AB=A0=E6=A0=87=E7=AD=BE=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/widget/tags.vue | 99 +++++++++++++++++++++++++++++++++++ pages/article/_article_id.vue | 24 ++++++++- 2 files changed, 122 insertions(+), 1 deletion(-) create mode 100644 components/widget/tags.vue diff --git a/components/widget/tags.vue b/components/widget/tags.vue new file mode 100644 index 0000000..c263cd2 --- /dev/null +++ b/components/widget/tags.vue @@ -0,0 +1,99 @@ + + + + + diff --git a/pages/article/_article_id.vue b/pages/article/_article_id.vue index ff8e8e5..39af94f 100644 --- a/pages/article/_article_id.vue +++ b/pages/article/_article_id.vue @@ -23,6 +23,7 @@ 编辑 + 编辑标签 分享 @@ -72,6 +73,15 @@ + + + + + + @@ -79,11 +89,13 @@ import Vue from 'vue'; import {mapState} from 'vuex'; import ShareBox from '~/components/widget/share'; + import EditTags from '~/components/widget/tags'; export default { name: "ArticleDetail", components: { - ShareBox + ShareBox, + EditTags }, validate({params, store}) { return params.article_id && !isNaN(Number(params.article_id)) @@ -113,6 +125,9 @@ } return this.$store.getters.hasPermissions('blog_admin'); }, + isAdmin() { + return this.$store.getters.hasPermissions('blog_admin'); + }, routeArticleId() { return Number(this.$route.params.article_id) } @@ -160,6 +175,7 @@ return { loading: false, isShare: false, + dialogVisible: false, shareData: {}, } }, @@ -177,6 +193,8 @@ _ts.$router.push({ path: `/article/post/${_ts.article.idArticle}` }) + } else if (item === 'editTag') { + _ts.$set(_ts, 'dialogVisible', true); } else { _ts.$axios.$get('/api/article/' + _ts.article.idArticle + '/share').then(function (res) { if (res) { @@ -190,6 +208,10 @@ this.$router.push({ name: 'login' }) + }, + closeTagsDialog() { + this.$set(this, 'dialogVisible', false); + this.$store.dispatch('article/fetchDetail', this.$route.params) } }, mounted() {