|
|
@ -90,7 +90,7 @@ const vuexStore = new Vuex.Store({ |
|
|
|
userInfo({ state, commit }, force) { |
|
|
|
userInfo({ state, commit }, force) { |
|
|
|
if (state.userInfo !== null && !force) { |
|
|
|
if (state.userInfo !== null && !force) { |
|
|
|
return Promise.resolve(state.userInfo); |
|
|
|
return Promise.resolve(state.userInfo); |
|
|
|
} else { |
|
|
|
} |
|
|
|
return new Promise(reslove => { |
|
|
|
return new Promise(reslove => { |
|
|
|
getUserInfo().then(res => { |
|
|
|
getUserInfo().then(res => { |
|
|
|
commit("updateUserInfo", res.data); |
|
|
|
commit("updateUserInfo", res.data); |
|
|
@ -103,9 +103,11 @@ const vuexStore = new Vuex.Store({ |
|
|
|
duration: 2000, |
|
|
|
duration: 2000, |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
getUser({ state, commit }) { |
|
|
|
getUser({ state, commit }) { |
|
|
|
|
|
|
|
if (!state.token) { |
|
|
|
|
|
|
|
return Promise.reject('未获取到token'); |
|
|
|
|
|
|
|
} |
|
|
|
return new Promise(reslove => { |
|
|
|
return new Promise(reslove => { |
|
|
|
getUserInfo().then(res => { |
|
|
|
getUserInfo().then(res => { |
|
|
|
console.log(res) |
|
|
|
console.log(res) |
|
|
|