diff --git a/components/common/portfolio/list.vue b/components/common/portfolio/list.vue index 777201c..d1a7e86 100644 --- a/components/common/portfolio/list.vue +++ b/components/common/portfolio/list.vue @@ -62,7 +62,7 @@ ) }, currentChange(page) { - this.$emit('currentChangePortfolios', page); + this.$emit('currentChange', page); } } } diff --git a/components/common/portfolio/manager/bind/list.vue b/components/common/portfolio/manager/bind/list.vue new file mode 100644 index 0000000..8712a67 --- /dev/null +++ b/components/common/portfolio/manager/bind/list.vue @@ -0,0 +1,69 @@ + + + + + + + + + {{ article.articlePreviewContent }} + + 添加至作品集 + + + + + + + + + + + + + + + + diff --git a/components/common/portfolio/manager/list.vue b/components/common/portfolio/manager/list.vue new file mode 100644 index 0000000..8324c64 --- /dev/null +++ b/components/common/portfolio/manager/list.vue @@ -0,0 +1,151 @@ + + + + + + + + + {{ + scope.row.articleTitle }} + + + + + + + + + + + 取消绑定 + + + + + + + + + + + + + + + + diff --git a/pages/portfolio/manager/_portfolio_id.vue b/pages/portfolio/manager/_portfolio_id.vue new file mode 100644 index 0000000..8a6c48f --- /dev/null +++ b/pages/portfolio/manager/_portfolio_id.vue @@ -0,0 +1,106 @@ + + + + + + + + + + {{ portfolio.portfolioTitle }} + + + 作者 + + + {{ portfolio.portfolioAuthorName }} + + + + 文章 {{portfolio.articleNumber}}篇 + + + + + + + + + 编辑 + + 添加文章 + + + + + + + + + + + + + + + + + diff --git a/pages/portfolio/manager/bind/_portfolio_id.vue b/pages/portfolio/manager/bind/_portfolio_id.vue new file mode 100644 index 0000000..57261ca --- /dev/null +++ b/pages/portfolio/manager/bind/_portfolio_id.vue @@ -0,0 +1,87 @@ + + + + + 返回上一级 + 关联文章 + + + + + + + + + + + + + + + + + diff --git a/pages/portfolio/post/_portfolio_id.vue b/pages/portfolio/post/_portfolio_id.vue new file mode 100644 index 0000000..eb8cc44 --- /dev/null +++ b/pages/portfolio/post/_portfolio_id.vue @@ -0,0 +1,312 @@ + + + + + {{ portfolio.portfolioTitle }} + + 更新作品集 + + + + 创建作品集 + + + 作品集需要有明确的写作方向,如果您在某个领域有深度的研究,欢迎创建自己的作品集分享自己的观点 + + + + + + + + + + + + + + + + + + 删除 + 更新 + 提交 + + + + + + + + + diff --git a/store/portfolio.js b/store/portfolio.js index 6208d25..d57012f 100644 --- a/store/portfolio.js +++ b/store/portfolio.js @@ -1,7 +1,8 @@ import Vue from 'vue'; import { isBrowser } from '~/environment'; -export const PORTFOLIO_API_PATH = '/api/console' +export const BASE_API_PATH = '/api/console' +export const PORTFOLIO_API_PATH = '/api/portfolio' const getDefaultListData = () => { return { @@ -23,6 +24,10 @@ export const state = () => { articles: { articles: [], pagination: {} + }, + unbindArticles: { + articles: [], + pagination: {} } } } @@ -51,6 +56,10 @@ export const mutations = { state.articles.articles = action.articles state.articles.pagination = action.pagination }, + updateUnbindArticleList(state, action) { + state.unbindArticles.articles = action.articles + state.unbindArticles.pagination = action.pagination + }, // 更新作品集阅读全文状态 updateDetailRenderedState(state, action) { @@ -75,7 +84,7 @@ export const actions = { } return this.$axios - .$get(`${PORTFOLIO_API_PATH}/portfolios`, { + .$get(`${BASE_API_PATH}/portfolios`, { params: data }) .then(response => { @@ -103,7 +112,7 @@ export const actions = { commit('updateDetailFetching', true) // commit('updateDetailData', {}) return this.$axios - .$get(`${PORTFOLIO_API_PATH}/portfolio/${params.portfolio_id}`) + .$get(`${BASE_API_PATH}/portfolio/${params.portfolio_id}`) .then(response => { return new Promise(resolve => { commit('updateDetailData', response) @@ -122,9 +131,9 @@ export const actions = { fetchArticleList({commit}, params) { commit('updateDetailFetching', true) return this.$axios - .$get(`${PORTFOLIO_API_PATH}/portfolio/${params.portfolio_id}/articles`, { + .$get(`${BASE_API_PATH}/portfolio/${params.portfolio_id}/articles`, { params: { - page: params.page + page: params.page || 1 } }) .then(response => { @@ -134,5 +143,55 @@ export const actions = { .catch(error => { commit('updateDetailFetching', false) }) + }, + fetchUnBindArticleList({commit}, params) { + commit('updateDetailFetching', true) + return this.$axios + .$get(`${PORTFOLIO_API_PATH}/${params.portfolio_id}/unbind-articles`, { + params: { + page: params.page || 1, + searchText: params.searchText || '' + } + }) + .then(response => { + commit('updateUnbindArticleList', response) + commit('updateDetailFetching', false) + }) + .catch(error => { + commit('updateDetailFetching', false) + }) + }, + fetchPostDetail({ commit }, params = {}) { + // const delay = fetchDelay( + // isBrowser + // ) + // if (isBrowser) { + // Vue.nextTick(() => { + // window.scrollTo(0, 300); + // }) + // } + + if (typeof params.portfolio_id === 'undefined') { + commit('updateDetailData', getDefaultListData()) + return; + } + commit('updateDetailFetching', true) + // commit('updateDetailData', {}) + return this.$axios + .$get(`${PORTFOLIO_API_PATH}/detail/${params.portfolio_id}`) + .then(response => { + return new Promise(resolve => { + commit('updateDetailData', response) + commit('updateDetailFetching', false) + resolve(response) + // delay(() => { + // resolve(response) + // }) + }) + }) + .catch(error => { + commit('updateDetailFetching', false) + return Promise.reject(error) + }) } }