From c80b8507a112b343769715dec4bd2e9867fd412a Mon Sep 17 00:00:00 2001 From: ronger Date: Tue, 8 Dec 2020 19:59:46 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E6=AF=8F=E6=97=A5=E4=B8=80?= =?UTF-8?q?=E9=A2=98=E7=B3=BB=E7=BB=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/layouts/pc/header.vue | 1 + pages/answer.vue | 128 +++++++++++++++++++++++++++++++ static/robots.txt | 4 +- store/answer.js | 38 +++++++++ 4 files changed, 169 insertions(+), 2 deletions(-) create mode 100644 pages/answer.vue create mode 100644 store/answer.js diff --git a/components/layouts/pc/header.vue b/components/layouts/pc/header.vue index 88dc9c2..9c855f0 100644 --- a/components/layouts/pc/header.vue +++ b/components/layouts/pc/header.vue @@ -80,6 +80,7 @@ 系统管理 个人中心 + 每日一题 我的草稿 我的钱包 设置 diff --git a/pages/answer.vue b/pages/answer.vue new file mode 100644 index 0000000..444aac6 --- /dev/null +++ b/pages/answer.vue @@ -0,0 +1,128 @@ + + + + + diff --git a/static/robots.txt b/static/robots.txt index 687524c..ea741b1 100644 --- a/static/robots.txt +++ b/static/robots.txt @@ -1,3 +1,3 @@ User-agent: * -Disallow: /admin -Disallow: /draft +Disallow: /admin/ +Disallow: /draft/ diff --git a/store/answer.js b/store/answer.js new file mode 100644 index 0000000..5d8b473 --- /dev/null +++ b/store/answer.js @@ -0,0 +1,38 @@ +export const ANSWER_API_PATH = '/api/answer'; + +export const state = () => { + return { + fetching: false, + detail: {} + } +} + +export const mutations = { + // 数据列表 + updateFetching(state, action) { + state.fetching = action + }, + updateDetailData(state, action) { + state.detail = action + } +} + +export const actions = { + // 获取文章列表 + fetchDetail({commit}, params = {}) { + // 清空已有数据 + commit('updateDetailData', {}); + commit('updateFetching', true); + + return this.$axios + .$get(`${ANSWER_API_PATH}/today`) + .then(response => { + commit('updateFetching', false); + commit('updateDetailData', response); + }) + .catch(error => { + console.log(error); + commit('updateFetching', false); + }); + } +}