From b7bcd04a12d22ba95cc53f0c5c61d03a6851a123 Mon Sep 17 00:00:00 2001 From: shijing Date: Fri, 22 Sep 2023 09:25:10 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E6=80=BB=E9=83=A8=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=8E=A7=E6=9D=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/dist/index.html | 2 +- client/src/api/org.js | 6 ++++++ client/src/store/modules/user.js | 23 +++++++++++++---------- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/client/dist/index.html b/client/dist/index.html index b34300f..9772179 100644 --- a/client/dist/index.html +++ b/client/dist/index.html @@ -1 +1 @@ -vue Admin Template
\ No newline at end of file +vue Admin Template
\ No newline at end of file diff --git a/client/src/api/org.js b/client/src/api/org.js index 3ee4928..8c535b4 100644 --- a/client/src/api/org.js +++ b/client/src/api/org.js @@ -42,3 +42,9 @@ export function deleteOrg(id) { method: 'delete' }) } +export function getOrgItem(id) { + return request({ + url: `/system/organization/${id}/`, + method: 'get' + }) +} diff --git a/client/src/store/modules/user.js b/client/src/store/modules/user.js index 1b23525..8766130 100644 --- a/client/src/store/modules/user.js +++ b/client/src/store/modules/user.js @@ -1,5 +1,6 @@ import { login, logout, getInfo, login2, fulllogin } from '@/api/user' import { getToken, setToken, removeToken } from '@/utils/auth' +import { getOrgItem} from "@/api/org"; import { resetRouter } from '@/router' const getDefaultState = () => { @@ -68,7 +69,6 @@ const actions = { } const { perms, name, avatar } = data.user - // perms must be a non-empty array if (!perms || perms.length <= 0) { reject('没有任何权限!') @@ -104,23 +104,26 @@ const actions = { return new Promise((resolve, reject) => { getInfo(state.token).then(response => { const { data } = response - if (!data) { reject('验证失败,重新登陆.') } - - const { perms, name, avatar, dept, dept_name} = data - + const { perms, name, avatar, dept, dept_name} = data; // perms must be a non-empty array - if (!perms || perms.length <= 0) { - reject('没有任何权限!') - } - - commit('SET_PERMS', perms) commit('SET_NAME', name) commit('SET_AVATAR', avatar) commit('SET_DEPT', dept) commit('SET_DEPTNAME', dept_name) + if (!perms || perms.length <= 0) { + reject('没有任何权限!') + }else{ + if(dept==5||dept==33||dept==34||dept==55||dept==36||dept==37||dept==38 + ||dept==39||dept==40||dept==41||dept==42||dept==67||dept==97){ + perms.push('test') + commit('SET_PERMS', perms); + }else{ + commit('SET_PERMS', perms); + } + } resolve(data) }).catch(error => { reject(error)