From fcd14680f007914b68d52a574837b1d61e01dec7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=86=8A=E6=88=90=E5=BC=BA?= Date: Tue, 10 Nov 2020 10:21:10 +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 | 1 + src/components/kpi-layout/NavBar.vue | 2 +- src/store/modules/user.js | 20 ++++++++++++++++++++ src/views/kpi/set/authority/index.vue | 5 +++++ src/views/kpi/workbench/index.vue | 2 +- 5 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/App.vue b/src/App.vue index cb73183..b6686c2 100644 --- a/src/App.vue +++ b/src/App.vue @@ -79,6 +79,7 @@ export default { console.log('获取用户信息res: ', res) if (res.code === 200) { this.SET_USER_INFO(res.user) + this.SET_USER_AUTH(res.data) } else { this.$message.error(res.msg0) } diff --git a/src/components/kpi-layout/NavBar.vue b/src/components/kpi-layout/NavBar.vue index 47d012c..7e71b13 100644 --- a/src/components/kpi-layout/NavBar.vue +++ b/src/components/kpi-layout/NavBar.vue @@ -9,7 +9,7 @@ :class="{active:title.includes(i.name)}" @click="handleToRouter(i.name)" > - {{i.meta.title}} + {{i.meta.title}} diff --git a/src/store/modules/user.js b/src/store/modules/user.js index b723734..679370d 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -1,4 +1,6 @@ import { getDepList } from '@/api/report' +import * as dd from 'dingtalk-jsapi' +import { apiDingtalkLogin, apiUserInfo } from '@/api/login' const user = { state: { deplist: [], @@ -18,8 +20,26 @@ const user = { SET_DEPLIST: (state, list = []) => { state.deplist = list } + }, actions: { + GET_USERINFO: async ({ commit }) => { + let res = await apiUserInfo() + console.log('获取用户信息res: ', res) + if (res.code === 200) { + commit('SET_USER_INFO', res.user) + } else { + this.$message.error(res.msg0) + } + }, + GET_PERMISSIONS: ({ commit }) => { + getDepList({type: 1}).then(response => { + const data = response.code === 200 ? response.data : [] + commit('SET_USER_AUTH', data) + }).catch(error => { + console.log(error) + }) + }, GET_DEPLIST: ({ commit }) => { getDepList({type: 1}).then(response => { const data = response.code === 200 ? response.data : [] diff --git a/src/views/kpi/set/authority/index.vue b/src/views/kpi/set/authority/index.vue index 584ed6d..35a852a 100644 --- a/src/views/kpi/set/authority/index.vue +++ b/src/views/kpi/set/authority/index.vue @@ -574,6 +574,7 @@ export default { console.log('编辑-----=====', row) apiSetPermissionsRoleDetail({ id: row.id }).then(res => { if (res.code !== 200) { + this.$message.error(res.msg) return } this.showPopupAddSub = true @@ -630,6 +631,8 @@ export default { }) // 刷新页面信息 this.rqInfoParameter.currPage = 1 this.handleGetSetPageInfo() + } else { + this.$message.error(res.msg) } }) }).catch(_ => { @@ -673,6 +676,8 @@ export default { this.showPopupAddSub = false // 管理员权限 修改成功 this.handleGetSetPageInfo() + } else { + this.$message.error(res.msg) } }) } diff --git a/src/views/kpi/workbench/index.vue b/src/views/kpi/workbench/index.vue index 2b7013f..9a6f285 100644 --- a/src/views/kpi/workbench/index.vue +++ b/src/views/kpi/workbench/index.vue @@ -48,12 +48,12 @@ export default { let res = await apiLogin(params) console.log('res: ', res) if (res.code === 200) { - this.SET_USER_AUTH(res.data) this.token = res.token this.$cookies.set('token', res.token, res.expire) let ress = await apiUserInfo() if (ress.code === 200) { this.SET_USER_INFO(ress.user) + this.SET_USER_AUTH(ress.data) } else { this.$message.error(ress.msg0) }