|
|
@ -17,7 +17,7 @@ const store = new Vuex.Store({ |
|
|
|
}, |
|
|
|
getters: { |
|
|
|
userInfo:state => state.userInfo, |
|
|
|
isLogin:state=>state.token?true:false |
|
|
|
isLogin:state => state.token ? true : false |
|
|
|
}, |
|
|
|
mutations: { |
|
|
|
// 初始化配置
|
|
|
@ -86,6 +86,18 @@ const store = new Vuex.Store({ |
|
|
|
if(res.code == 200){ |
|
|
|
uni.setStorageSync('userInfo',JSON.stringify(res.result)) |
|
|
|
state.userInfo = res.result |
|
|
|
|
|
|
|
// if(!state.userInfo.nickName ||
|
|
|
|
// !state.userInfo.headImage ||
|
|
|
|
// !state.userInfo.phone ||
|
|
|
|
// !state.userInfo.sex){
|
|
|
|
// uni.showToast({
|
|
|
|
// title: '请您先完善必要信息'
|
|
|
|
// })
|
|
|
|
// uni.navigateTo({
|
|
|
|
// url: '/pages_login/wxUserInfo'
|
|
|
|
// })
|
|
|
|
// }
|
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
@ -100,10 +112,19 @@ const store = new Vuex.Store({ |
|
|
|
// },
|
|
|
|
// 退出登录
|
|
|
|
logout(state){ |
|
|
|
state.userInfo = {} |
|
|
|
state.role = false |
|
|
|
state.token = "" |
|
|
|
uni.removeStorageSync('token') |
|
|
|
uni.showModal({ |
|
|
|
title: '确认退出登录吗', |
|
|
|
success(r) { |
|
|
|
if (r.confirm) { |
|
|
|
state.userInfo = {} |
|
|
|
state.token = "" |
|
|
|
uni.removeStorageSync('token') |
|
|
|
uni.reLaunch({ |
|
|
|
url: '/pages/index/index' |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 查询地区
|
|
|
|
getArea(state, fn){ |
|
|
|