From c7fdcf59ac49928a059e944f2610b77ded44962a Mon Sep 17 00:00:00 2001 From: Bowen Date: Wed, 26 Sep 2018 20:19:42 +0800 Subject: [PATCH] feat: add searchData process --- mock/analysis.js | 11 +++++++++++ src/store/modules/analysis/actions.js | 4 +++- src/store/modules/analysis/mutations/index.js | 4 ++++ src/store/modules/analysis/mutations/types.js | 3 ++- src/store/modules/analysis/state.js | 15 ++++++++++++++- src/view/Analysis.vue | 15 +++++++++++++-- 6 files changed, 47 insertions(+), 5 deletions(-) diff --git a/mock/analysis.js b/mock/analysis.js index 40fb6e7..917a0c7 100644 --- a/mock/analysis.js +++ b/mock/analysis.js @@ -52,3 +52,14 @@ for (let i = 0; i < 7; i++) { } export const rankList = rank + +export const searchData = { + total: { + value: 12321, + trend: 0.171 + }, + average: { + value: 2.7, + trend: -0.262 + } +} diff --git a/src/store/modules/analysis/actions.js b/src/store/modules/analysis/actions.js index bd62b50..1ec7b97 100644 --- a/src/store/modules/analysis/actions.js +++ b/src/store/modules/analysis/actions.js @@ -6,12 +6,14 @@ export default { visitors, payments, operations, - rankList + rankList, + searchData }) { commit(types.SET_SALES, sales) commit(types.SET_VISITORS, visitors) commit(types.SET_PAYMENTS, payments) commit(types.SET_OPERATIONS, operations) commit(types.SET_RANK_LIST, rankList) + commit(types.SET_SEARCH_DATA, searchData) } } diff --git a/src/store/modules/analysis/mutations/index.js b/src/store/modules/analysis/mutations/index.js index 8283ae0..3b800c0 100644 --- a/src/store/modules/analysis/mutations/index.js +++ b/src/store/modules/analysis/mutations/index.js @@ -19,5 +19,9 @@ export default { [types.SET_RANK_LIST] (state, rankList) { state.rankList = rankList + }, + + [types.SET_SEARCH_DATA] (state, searchData) { + state.searchData = searchData } } diff --git a/src/store/modules/analysis/mutations/types.js b/src/store/modules/analysis/mutations/types.js index bb0158f..5cfb8fd 100644 --- a/src/store/modules/analysis/mutations/types.js +++ b/src/store/modules/analysis/mutations/types.js @@ -3,5 +3,6 @@ export default { 'SET_VISITORS': 'SET_VISITORS', 'SET_PAYMENTS': 'SET_PAYMENTS', 'SET_OPERATIONS': 'SET_OPERATIONS', - 'SET_RANK_LIST': 'SEt_RANK_LIST' + 'SET_RANK_LIST': 'SET_RANK_LIST', + 'SET_SEARCH_DATA': 'SET_SEARCH_DATA' } diff --git a/src/store/modules/analysis/state.js b/src/store/modules/analysis/state.js index b3c057e..ec3156b 100644 --- a/src/store/modules/analysis/state.js +++ b/src/store/modules/analysis/state.js @@ -1,3 +1,5 @@ +// store.state basic schema + export default { sales: { trend: [ @@ -46,5 +48,16 @@ export default { name: 'sample name', value: 10000 } - ] + ], + + searchData: { + total: { + value: 12321, + trend: 0.1 + }, + average: { + value: 2.7, + trend: -0.2 + } + } } diff --git a/src/view/Analysis.vue b/src/view/Analysis.vue index b5c4f29..2fab2ed 100644 --- a/src/view/Analysis.vue +++ b/src/view/Analysis.vue @@ -85,9 +85,11 @@ + + @@ -96,6 +98,7 @@ + @@ -117,7 +120,14 @@ import { // import { getAnalysisData } from 'SERVICES' // ! work with dev mode -import { sales, visitors, payments, operations, rankList } from 'MOCK/analysis' +import { + sales, + visitors, + payments, + operations, + rankList, + searchData +} from 'MOCK/analysis' export default { data () { @@ -172,7 +182,8 @@ export default { visitors, payments, operations, - rankList + rankList, + searchData }) },