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() {