|
|
@ -21,17 +21,16 @@ export default new Vuex.Store({ |
|
|
|
}, |
|
|
|
mutations:{ |
|
|
|
setUserInfo(state, val){ |
|
|
|
state.userInfo={ |
|
|
|
...val.userInfo, |
|
|
|
companyName:val.departs[0].departName |
|
|
|
} |
|
|
|
state.userInfo=val.userInfo |
|
|
|
state.token=val.token |
|
|
|
uni.setStorageSync('token', val.token) |
|
|
|
this.dispatch('getSysMsg') |
|
|
|
}, |
|
|
|
outLogin(state){ |
|
|
|
state.userInfo={} |
|
|
|
state.baseInfo={} |
|
|
|
state.token='' |
|
|
|
uni.removeStorageSync('token') |
|
|
|
clearTimeout(timer) |
|
|
|
uni.reLaunch({ |
|
|
|
url:"/pages/home/login", |
|
|
@ -63,5 +62,21 @@ export default new Vuex.Store({ |
|
|
|
} |
|
|
|
timer=setTimeout(()=>dispatch('getSysMsg'),30*60*1000) |
|
|
|
}, |
|
|
|
async getUserInfo({commit},val){ |
|
|
|
console.log(val,'------------token---------------') |
|
|
|
if(val){ |
|
|
|
var res=await request("/common/api/dict/queryUserInfoByToken",{ |
|
|
|
params:{token:val} |
|
|
|
}) |
|
|
|
if(res.statu){ |
|
|
|
commit('setUserInfo',{userInfo:res.data, token:val}) |
|
|
|
uni.switchTab({url:'/pages/home/index'}) |
|
|
|
return false |
|
|
|
}else{ |
|
|
|
return true |
|
|
|
} |
|
|
|
} |
|
|
|
return true |
|
|
|
}, |
|
|
|
} |
|
|
|
}) |
|
|
|