From e09d9a0d60a17c14515307448f677ae7846dcb03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=86=8A=E6=88=90=E5=BC=BA?= Date: Mon, 16 Nov 2020 17:17:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/user.js | 5 +++-- src/utils/permission.js | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) 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() }