From 164daf9bf3b0003e44e88b45db600c1bbe239a15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=86=8A=E6=88=90=E5=BC=BA?= Date: Fri, 20 Nov 2020 14:23:07 +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/App.vue | 5 +++-- src/store/modules/user.js | 11 ++++------- src/utils/permission.js | 2 +- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/App.vue b/src/App.vue index a74dc4d..9cf122b 100644 --- a/src/App.vue +++ b/src/App.vue @@ -46,8 +46,9 @@ export default { // await this.handleDingtalkLogin() } }, - mounted () { - this.GET_DEPLIST() + async mounted () { + const a = await this.GET_DEPLIST() + console.log('a: ', a) }, methods: { onCancel () { diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 5c66d90..e6d3fff 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -37,13 +37,10 @@ const user = { return 0 } }, - GET_DEPLIST: ({ commit }) => { - getDepList({type: 1}).then(response => { - const data = response.code === 200 ? response.data : [] - commit('SET_DEPLIST', data) - }).catch(error => { - console.log(error) - }) + GET_DEPLIST: async ({ commit }) => { + let data = getDepList({type: 1}) + commit('SET_DEPLIST', data.code === 200 ? data.data : []) + return data } } } diff --git a/src/utils/permission.js b/src/utils/permission.js index 9463dd0..e1c92c1 100644 --- a/src/utils/permission.js +++ b/src/utils/permission.js @@ -38,7 +38,7 @@ function handleGetDingtalkCode () { }) } router.beforeEach(async (to, from, next) => { - console.log('dd: ', dd) + console.log('dd---: ', dd) if (!store.getters.userInfo.userNo && !dd.other) { let res = await handleGetDingtalkCode() console.log('res: ', res)