From 5b969cfb0c0710bc90ae36589a9b775b692f1b1b Mon Sep 17 00:00:00 2001 From: ronger Date: Thu, 10 Dec 2020 16:24:55 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E8=B4=A7=E5=B8=81=E8=A7=84?= =?UTF-8?q?=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/layouts/pc/footer.vue | 4 ++- pages/rules/currency.vue | 62 ++++++++++++++++++++++++++++++++ store/rule.js | 38 ++++++++++++++++++++ 3 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 pages/rules/currency.vue create mode 100644 store/rule.js diff --git a/components/layouts/pc/footer.vue b/components/layouts/pc/footer.vue index 4d24bf0..6d63019 100644 --- a/components/layouts/pc/footer.vue +++ b/components/layouts/pc/footer.vue @@ -9,6 +9,7 @@ Markdown 教程 社区规章 + 货币规则 意见反馈 关于我们 github @@ -45,7 +46,8 @@ rules: '/article/20', email: 'mailto:support@rymcu.com', aboutMe: '/article/115', - github: 'https://github.com/rymcu' + github: 'https://github.com/rymcu', + currencyRule: '/rules/currency' } } } diff --git a/pages/rules/currency.vue b/pages/rules/currency.vue new file mode 100644 index 0000000..69104df --- /dev/null +++ b/pages/rules/currency.vue @@ -0,0 +1,62 @@ + + + + + diff --git a/store/rule.js b/store/rule.js new file mode 100644 index 0000000..09531df --- /dev/null +++ b/store/rule.js @@ -0,0 +1,38 @@ +export const RULE_API_PATH = '/api/rule' + +export const state = () => { + return { + currencyRules: { + fetching: false, + data: [] + } + } +} + +export const mutations = { + updateCurrencyRulesFetching(state, action) { + state.currencyRules.fetching = action + }, + updateCurrencyRulesData(state, action) { + state.currencyRules.data = action + } +} + +export const actions = { + fetchCurrencyRules({commit}, params = {}) { + // 清空已有数据 + commit('updateCurrencyRulesData', []) + commit('updateCurrencyRulesFetching', true) + + return this.$axios + .$get(`${RULE_API_PATH}/currency/list`) + .then(response => { + commit('updateCurrencyRulesFetching', false); + commit('updateCurrencyRulesData', response); + }) + .catch(error => { + console.log(error); + commit('updateCurrencyRulesFetching', false); + }); + } +}