This commit is contained in:
熊成强 2020-11-18 15:45:53 +08:00
parent e40534e1fc
commit c87b50cceb
2 changed files with 6 additions and 0 deletions

View File

@ -26,6 +26,7 @@ const user = {
actions: { actions: {
GET_USERINFO: async ({ commit }) => { GET_USERINFO: async ({ commit }) => {
let res = await apiUserInfo() let res = await apiUserInfo()
console.log('GET_USERINFO: ', res)
if (res.code === 200) { if (res.code === 200) {
commit('SET_USER_INFO', res.user) commit('SET_USER_INFO', res.user)
commit('SET_USER_AUTH', res.data) commit('SET_USER_AUTH', res.data)

View File

@ -42,8 +42,13 @@ router.beforeEach(async (to, from, next) => {
let res = await handleGetDingtalkCode() let res = await handleGetDingtalkCode()
console.log('res: ', res) console.log('res: ', res)
if (res === 1) { if (res === 1) {
console.log('res: ', res)
let res1 = await store.dispatch('GET_USERINFO') let res1 = await store.dispatch('GET_USERINFO')
console.log('res1: ', res1)
if (res1 === 1) next() if (res1 === 1) next()
} else {
this.$message.error('网络错误')
next()
} }
} else { } else {
next() next()