vuex模块化

This commit is contained in:
aixianling
2022-06-10 16:46:03 +08:00
parent a85a2b5bfe
commit e409328271
4 changed files with 10 additions and 28 deletions

View File

@@ -1,6 +1,9 @@
import http from "./http";
import Vue from "vue";
/**
* 用户登录信息
*/
export const user = {
state: () => ({}),
mutations: {
@@ -16,13 +19,13 @@ export const user = {
return http.post("/admin/user/detail-phone", null, config).then(res => {
if (res?.code == 0) {
commit('setUser', res.data)
return Promise.all([dispatch('getGridInfo')])
return Promise.all([dispatch('getGridInfo', config)])
}
})
},
getGridInfo({commit}) {
getGridInfo({commit}, config) {
//获取登录着网格员信息
return http.post("/app/appgirdmemberinfo/checkLogOnUser").then(res => {
return http.post("/app/appgirdmemberinfo/checkLogOnUser", null, config).then(res => {
if (res?.data) {
let {girdId, girdMemberId, girdName, checkType: girdCheckType, appGirdInfo: gridInfo} = res.data
return commit("setUser", {girdId, girdMemberId, girdName, girdCheckType, gridInfo})