Skip to content

Commit

Permalink
feat: add storage for analysis page
Browse files Browse the repository at this point in the history
  • Loading branch information
lbwa committed Sep 23, 2018
1 parent a6d8442 commit b65cfbf
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 7 deletions.
11 changes: 10 additions & 1 deletion src/store/actions.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
import types from './mutations/types'

export default {
change ({ commit, state }) {}
getAnalysisData ({ commit, state }, {
sales
}) {
commit(types.SET_SALES, sales)
commit(types.SET_VISITORS, visitors)
commit(types.SET_PAYMENTS, payments)
commit(types.SET_OPERATIONS, operations)
}
}
20 changes: 18 additions & 2 deletions src/store/mutations/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
import type from './type'
import types from './types'

export default {
[type.TOGGLE_ASIDE] (state) {
[types.TOGGLE_ASIDE] (state) {
state.isCollapse = !state.isCollapse
},

[types.SET_SALES] (state, sales) {
state.sales = sales
},

[types.SET_VISITORS] (state, visitors) {
state.visitors = visitors
},

[types.SET_PAYMENTS] (state, payments) {
state.payments = payments
},

[types.SET_OPERATIONS] (state, operations) {
state.operations = operations
}
}
3 changes: 0 additions & 3 deletions src/store/mutations/type.js

This file was deleted.

7 changes: 7 additions & 0 deletions src/store/mutations/types.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default {
'TOGGLE_ASIDE': 'TOGGLE_ASIDE',
'SET_SALES': 'SET_SALES',
'SET_VISITORS': 'SET_VISITORS',
'SET_PAYMENTS': 'SET_PAYMENTS',
'SET_OPERATIONS': 'SET_OPERATIONS'
}
37 changes: 36 additions & 1 deletion src/store/state.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@
export default {
isCollapse: false
isCollapse: false,
dailyVisitor: 1234,
totalVisitor: 8846,
dailySelling: 10000,
totalSelling: 126566,
totalPayment: 6560,
influenceRate: 0.78,
conversionRate: 0.6,
sales: {
trend: [
{
key: '同周比',
value: 0.12
},
{
key: '日环比',
value: -0.11
}
],
daily: 10000,
total: 126566
},
visitors: {
daily: 1234,
trend: '', // chart
total: 8846
},
payments: {
total: 6560,
rate: 0.6
},
operations: {
influence: 0.78,
trend: '', // chart
conversion: 0.6
}
}

0 comments on commit b65cfbf

Please # to comment.