diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 8a868a4..40e8560 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -1,6 +1,5 @@ import { getDepList } from '@/api/report' -import * as dd from 'dingtalk-jsapi' -import { apiDingtalkLogin, apiUserInfo } from '@/api/login' +import { apiUserInfo } from '@/api/login' const user = { state: { deplist: [], @@ -28,8 +27,10 @@ const user = { if (res.code === 200) { commit('SET_USER_INFO', res.user) commit('SET_USER_INFO', res.data) + return 1 } else { this.$message.error(res.msg0) + return 0 } }, GET_DEPLIST: ({ commit }) => { diff --git a/src/utils/permission.js b/src/utils/permission.js index f2e2b42..5676df4 100644 --- a/src/utils/permission.js +++ b/src/utils/permission.js @@ -39,7 +39,10 @@ function handleGetDingtalkCode () { router.beforeEach(async (to, from, next) => { if (!store.getters.userInfo.userNo && !dd.other) { let res = await handleGetDingtalkCode() - if (res === 1) next() + if (res === 1) { + let res1 = await store.dispatch('GET_USERINFO') + if (res1 === 1) next() + } } else { next() }