|
|
@@ -1,24 +1,17 @@
|
|
|
import { getState, setState } from '@/store/modules/vuexStorange'
|
|
|
import { getSelfInfo } from '@/utils/auth'
|
|
|
import { shopAll } from '@/api/common'
|
|
|
-/** 员工用户信息 */
|
|
|
const state = {
|
|
|
selfInfo: null,
|
|
|
user: null,
|
|
|
shopUser: null,
|
|
|
- userShopAll: [] //用户所有店铺
|
|
|
+ //用户所有店铺
|
|
|
+ userShopAll: []
|
|
|
}
|
|
|
-
|
|
|
const getters = {
|
|
|
// 员工用户信息
|
|
|
getSelfInfo: (state) => {
|
|
|
getState(state, 'selfInfo', 'selfInfo')
|
|
|
- // if (state.selfInfo) return state.selfInfo
|
|
|
- // let data = {}
|
|
|
- // getSelfInfo().then(res => {
|
|
|
- // data = res
|
|
|
- // })
|
|
|
- // return data
|
|
|
return state.selfInfo
|
|
|
},
|
|
|
// 用户信息
|
|
|
@@ -32,69 +25,26 @@ const getters = {
|
|
|
return state.shopUser
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
const actions = {
|
|
|
// 员工用户信息
|
|
|
- setSelfInfo({
|
|
|
- commit,
|
|
|
- dispatch,
|
|
|
- getters,
|
|
|
- rootGetters,
|
|
|
- rootState,
|
|
|
- state
|
|
|
- }, userInfo) {
|
|
|
+ setSelfInfo({commit}, userInfo) {
|
|
|
commit('SET_BASIC_USER', userInfo)
|
|
|
},
|
|
|
- delSelfInfo({
|
|
|
- commit,
|
|
|
- dispatch,
|
|
|
- getters,
|
|
|
- rootGetters,
|
|
|
- rootState,
|
|
|
- state
|
|
|
- }) {
|
|
|
+ delSelfInfo({commit}) {
|
|
|
commit('DEL_BASIC_USER')
|
|
|
},
|
|
|
// 后台管理用户信息
|
|
|
- setUser({
|
|
|
- commit,
|
|
|
- dispatch,
|
|
|
- getters,
|
|
|
- rootGetters,
|
|
|
- rootState,
|
|
|
- state
|
|
|
- }, userInfo) {
|
|
|
+ setUser({commit}, userInfo) {
|
|
|
commit('SET_USER', userInfo)
|
|
|
},
|
|
|
- delUser({
|
|
|
- commit,
|
|
|
- dispatch,
|
|
|
- getters,
|
|
|
- rootGetters,
|
|
|
- rootState,
|
|
|
- state
|
|
|
- }) {
|
|
|
+ delUser({commit}) {
|
|
|
commit('DEL_USER')
|
|
|
},
|
|
|
// 商城用户信息
|
|
|
- setShopUser({
|
|
|
- commit,
|
|
|
- dispatch,
|
|
|
- getters,
|
|
|
- rootGetters,
|
|
|
- rootState,
|
|
|
- state
|
|
|
- }, userInfo) {
|
|
|
+ setShopUser({commit}, userInfo) {
|
|
|
commit('SET_SHOP_USER', userInfo)
|
|
|
},
|
|
|
- delShopUser({
|
|
|
- commit,
|
|
|
- dispatch,
|
|
|
- getters,
|
|
|
- rootGetters,
|
|
|
- rootState,
|
|
|
- state
|
|
|
- }) {
|
|
|
+ delShopUser({ commit }) {
|
|
|
commit('DEL_SHOP_USER')
|
|
|
},
|
|
|
setUserShopAll({commit,state},info={}){
|
|
|
@@ -103,7 +53,6 @@ const actions = {
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
const mutations = {
|
|
|
// 员工用户信息
|
|
|
SET_BASIC_USER(state, userInfo = {}) {
|
|
|
@@ -130,10 +79,4 @@ const mutations = {
|
|
|
state.userShopAll = info
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-export default {
|
|
|
- state,
|
|
|
- getters,
|
|
|
- actions,
|
|
|
- mutations
|
|
|
-}
|
|
|
+export default { state, getters, actions, mutations }
|