You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.0 KiB
47 lines
1.0 KiB
import {checkWxmpRegister, getUserWechatByUserId} from '@/api/user'
|
|
|
|
const state = {
|
|
userInfo: {},
|
|
appId: '',
|
|
realNameFlag:null,
|
|
agencyId:null,
|
|
houseId:null
|
|
}
|
|
const mutations = {
|
|
SET_USER_INFO(state, userInfo) {
|
|
console.log(userInfo,'用户信息');
|
|
state.userInfo = userInfo;
|
|
state.agencyId = userInfo.agencyId;
|
|
state.realNameFlag = userInfo.realName;
|
|
},
|
|
SET_APP_ID(state, appId){
|
|
state.appId = appId
|
|
},
|
|
SET_HOUSE_ID(state, houseId){
|
|
// console.log(houseId,'houseIdVueX');
|
|
state.houseId = houseId;
|
|
},
|
|
}
|
|
const actions = {
|
|
// 设置是否注册
|
|
getUserInfo({ commit}) {
|
|
return new Promise((resolve, reject) => {
|
|
if (Object.keys(state.userInfo).length) {
|
|
resolve(state.userInfo)
|
|
}
|
|
getUserWechatByUserId(localStorage.getItem('userId'))
|
|
.then(res => {
|
|
commit('SET_USER_INFO', res.data)
|
|
resolve(res.data)
|
|
})
|
|
.catch(error => {
|
|
reject(error)
|
|
})
|
|
})
|
|
}
|
|
}
|
|
export default {
|
|
state,
|
|
mutations,
|
|
actions
|
|
}
|
|
|