From 81e304b1227063617c3ce71be62187dc7d227b0d Mon Sep 17 00:00:00 2001 From: ronger Date: Sun, 13 Mar 2022 23:09:34 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E4=BB=AA=E8=A1=A8=E7=9B=98?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E6=96=B0=E5=A2=9E=E6=96=87=E7=AB=A0/?= =?UTF-8?q?=E7=94=A8=E6=88=B7/=E9=93=B6=E8=A1=8C=E8=B4=A6=E6=88=B7?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BF=A1=E6=81=AF=E5=88=97=E8=A1=A8=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/admin.vue | 11 +- pages/admin/articles.vue | 2 +- pages/admin/banks.vue | 4 +- pages/admin/dashboard.vue | 605 +++++++++++++++++++++++++-------- pages/user/settings/avatar.vue | 1 - store/dashboard.js | 83 ++++- 6 files changed, 563 insertions(+), 143 deletions(-) diff --git a/pages/admin.vue b/pages/admin.vue index f27a8a7..a44d23b 100644 --- a/pages/admin.vue +++ b/pages/admin.vue @@ -59,14 +59,14 @@ export default { title: '文章管理', name: 'admin-articles', path: '/admin/articles', - icon: 'el-icon-s-custom', + icon: 'el-icon-tickets', closable: true }, { title: '评论管理', name: 'admin-comments', path: '/admin/comments', - icon: 'el-icon-s-custom', + icon: 'el-icon-chat-line-square', closable: true }, { @@ -110,6 +110,13 @@ export default { path: '/admin/bank-accounts', icon: 'el-icon-bank-card', closable: true + }, + { + title: '货币规则', + name: 'admin-currency-rules', + path: '/admin/currency-rules', + icon: 'el-icon-document', + closable: true } ] } diff --git a/pages/admin/articles.vue b/pages/admin/articles.vue index 20b1ab6..aa4b970 100644 --- a/pages/admin/articles.vue +++ b/pages/admin/articles.vue @@ -152,7 +152,7 @@ export default { toggleStatus() {}, setPreference(index, idArticle) { let _ts = this; - _ts.$axios.$patch("/api/article/update-perfect", { + _ts.$axios.$patch("/api/admin/article/update-perfect", { idArticle: idArticle, articlePerfect: '1' }).then(function (res) { diff --git a/pages/admin/banks.vue b/pages/admin/banks.vue index e1241af..decf064 100644 --- a/pages/admin/banks.vue +++ b/pages/admin/banks.vue @@ -90,13 +90,13 @@ export default { fetch({store, params, error}) { return Promise.all([ store - .dispatch('bank/fetchList', params) + .dispatch('currency-rule/fetchList', params) .catch(err => error({statusCode: 404})) ]) }, computed: { ...mapState({ - banks: state => state.bank.list.data.banks, + banks: state => state["currency-rule"].list.data.banks, pagination: state => state.bank.list.data.pagination }) }, diff --git a/pages/admin/dashboard.vue b/pages/admin/dashboard.vue index 161c70a..7d5022b 100644 --- a/pages/admin/dashboard.vue +++ b/pages/admin/dashboard.vue @@ -36,160 +36,493 @@ 今日浏览量 + +
+ + +

新增文章列表

+
+ + + + + + + + + + + + + + + +
+ + + + + + +

新增用户列表

+
+ + + + + + + + + + + + +
+ + + + + + +

新增账户列表

+
+ + + + + + + + + + + + + +
+ + + + +
+
+ + + + + + + + + + + + + + + + diff --git a/pages/user/settings/avatar.vue b/pages/user/settings/avatar.vue index 91f0e34..629abd0 100644 --- a/pages/user/settings/avatar.vue +++ b/pages/user/settings/avatar.vue @@ -140,7 +140,6 @@ export default { const isPNG = file.type === 'image/png'; const isLt2M = file.size / 1024 / 1024 < 2; if (!(isJPG || isPNG)) { - this.$message.error('上传头像只能是 JPG 或者 PNG 格式!'); return false; } diff --git a/store/dashboard.js b/store/dashboard.js index 3a37468..c340a07 100644 --- a/store/dashboard.js +++ b/store/dashboard.js @@ -15,12 +15,36 @@ const getDefaultLastThirtyDaysData = () => { } } +const getDefaultNewUserData = () => { + return { + users: [], + pagination: {} + } +} + +const getDefaultNewBankAccountData = () => { + return { + bankAccounts: [], + pagination: {} + } +} + +const getDefaultNewArticleData = () => { + return { + articles: [], + pagination: {} + } +} + export const state = () => { return { fetching: false, data: getDefaultDashboardData(), lastThirtyDays: getDefaultLastThirtyDaysData(), - history: getDefaultLastThirtyDaysData() + history: getDefaultLastThirtyDaysData(), + users: getDefaultNewUserData(), + bankAccounts: getDefaultNewBankAccountData(), + articles: getDefaultNewArticleData() } } @@ -36,6 +60,15 @@ export const mutations = { }, updateHistoryData(state, action) { state.history = action + }, + updateNewUsersData(state, action) { + state.users = action + }, + updateNewBankAccountsData(state, action) { + state.bankAccounts = action + }, + updateNewArticlesData(state, action) { + state.articles = action } } @@ -87,5 +120,53 @@ export const actions = { console.log(error); commit('updateDashboardFetching', false); }); + }, + fetchNewUsers({commit}, params = {}) { + // 清空已有数据 + commit('updateNewUsersData', getDefaultNewUserData()) + commit('updateDashboardFetching', true) + + return this.$axios + .$get(`${DASHBOARD_API_PATH}/new-users`) + .then(response => { + commit('updateDashboardFetching', false); + commit('updateNewUsersData', response); + }) + .catch(error => { + console.log(error); + commit('updateDashboardFetching', false); + }); + }, + fetchNewBankAccounts({commit}, params = {}) { + // 清空已有数据 + commit('updateNewBankAccountsData', getDefaultNewBankAccountData()) + commit('updateDashboardFetching', true) + + return this.$axios + .$get(`${DASHBOARD_API_PATH}/new-bank-accounts`) + .then(response => { + commit('updateDashboardFetching', false); + commit('updateNewBankAccountsData', response); + }) + .catch(error => { + console.log(error); + commit('updateDashboardFetching', false); + }); + }, + fetchNewArticles({commit}, params = {}) { + // 清空已有数据 + commit('updateNewArticlesData', getDefaultNewBankAccountData()) + commit('updateDashboardFetching', true) + + return this.$axios + .$get(`${DASHBOARD_API_PATH}/new-articles`) + .then(response => { + commit('updateDashboardFetching', false); + commit('updateNewArticlesData', response); + }) + .catch(error => { + console.log(error); + commit('updateDashboardFetching', false); + }); } }