diff --git a/pages/admin/topic/_topic_uri.vue b/pages/admin/topic/_topic_uri.vue new file mode 100644 index 0000000..51cd868 --- /dev/null +++ b/pages/admin/topic/_topic_uri.vue @@ -0,0 +1,152 @@ + + + + + 首页 + 专题管理 + {{ topic.topicTitle }} + + + + + + + + + + {{ topic.topicTitle }} + {{ topic.topicTagCount }} 引用 + 0 引用 + + + + + + 管理 + 关联标签 + + + + + {{ topic.topicDescription }} + + + + + + + + + + + {{ tag.tagTitle }} + + + {{ tag.tagArticleCount }} 引用 + 0 引用 + + + + 取消关联 + + {{ tag.tagDescription }} + + + + + + + + + + + + + + + diff --git a/pages/admin/topic/bind/_topic_id.vue b/pages/admin/topic/bind/_topic_id.vue new file mode 100644 index 0000000..e831404 --- /dev/null +++ b/pages/admin/topic/bind/_topic_id.vue @@ -0,0 +1,124 @@ + + + + + + 首页 + 专题管理 + {{ topic.topicTitle }} + 关联标签 + + + + + + + + + + + + + + + {{ tag.tagTitle }} + + + {{ tag.tagArticleCount }} 引用 + 0 引用 + + + + 关联 + + {{ tag.tagDescription }} + + + + + + + + + + + + + + + diff --git a/pages/admin/topic/post/_topic_id.vue b/pages/admin/topic/post/_topic_id.vue new file mode 100644 index 0000000..64e645e --- /dev/null +++ b/pages/admin/topic/post/_topic_id.vue @@ -0,0 +1,13 @@ + + + + + + + diff --git a/pages/admin/topic.vue b/pages/admin/topics.vue similarity index 89% rename from pages/admin/topic.vue rename to pages/admin/topics.vue index 2ea63e5..5c7dc0c 100644 --- a/pages/admin/topic.vue +++ b/pages/admin/topics.vue @@ -18,7 +18,9 @@ - {{ topic.topicTitle }} + {{ + topic.topicTitle + }} @@ -36,7 +38,7 @@ import {mapState} from 'vuex'; export default { - name: "topic", + name: "topics", fetch({store, params, error}) { return Promise.all([ store @@ -53,8 +55,7 @@ methods: { onRouter(item, data) { this.$router.push({ - name: item, - params: data + path: '/admin/topic/' + data }) }, createTopic() { @@ -65,7 +66,7 @@ } }, mounted() { - this.$store.commit("setActiveMenu", "admin-topic"); + this.$store.commit("setActiveMenu", "admin-topics"); } } diff --git a/store/topic.js b/store/topic.js index 5f73fd7..2727a9a 100644 --- a/store/topic.js +++ b/store/topic.js @@ -13,6 +13,12 @@ const getDefaultListData = () => { pagination: {} } } +const getDefaultTagsData = () => { + return { + tags: [], + pagination: {} + } +} export const state = () => { return { @@ -21,6 +27,14 @@ export const state = () => { list: { fetching: false, data: getDefaultListData() + }, + detail: { + fetching: false, + data: {} + }, + tags: { + fetching: false, + data: getDefaultTagsData() } } } @@ -37,6 +51,18 @@ export const mutations = { }, updateNavData(state, action) { state.data = action + }, + updateDetailFetching(state, action) { + state.detail.fetching = action + }, + updateDetailData(state, action) { + state.detail.data = action + }, + updateTopicTagsFetching(state, action) { + state.tags.fetching = action + }, + updateTopicTagsData(state, action) { + state.tags.data = action } } @@ -73,5 +99,43 @@ export const actions = { .catch(error => { commit('updateFetching', false) }) + }, + fetchDetail({ commit }, params) { + commit('updateDetailFetching', true); + return this.$axios + .$get(`${ADMIN_API_PATH}/topic/${params.topic_uri}`) + .then(response => { + commit('updateDetailData', response) + commit('updateDetailFetching', false) + }) + .catch(error => { + commit('updateDetailFetching', false) + }) + }, + fetchTopicTags({ commit }, params) { + commit('updateTopicTagsFetching', true); + return this.$axios + .$get(`${ADMIN_API_PATH}/topic/${params.topic_uri}/tags?page=${params.page}`) + .then(response => { + commit('updateTopicTagsData', response) + commit('updateTopicTagsFetching', false) + }) + .catch(error => { + commit('updateTopicTagsFetching', false) + }) + }, + fetchUnBindTags({ commit }, params) { + commit('updateTopicTagsFetching', true); + return this.$axios + .$get(`${ADMIN_API_PATH}/topic/unbind-topic-tags`, { + params: params + }) + .then(response => { + commit('updateTopicTagsData', response) + commit('updateTopicTagsFetching', false) + }) + .catch(error => { + commit('updateTopicTagsFetching', false) + }) } }
{{ topic.topicDescription }}