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); + }); + } +}