From 829b5f2c57cccbd68fbb44c478791f4e53c428d7 Mon Sep 17 00:00:00 2001 From: liyongde <1419499670@qq.com> Date: Fri, 30 Dec 2022 08:57:42 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E5=BD=95=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lms/nladmin-ui/src/store/modules/user.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lms/nladmin-ui/src/store/modules/user.js b/lms/nladmin-ui/src/store/modules/user.js index 35bfd8db4..0a62cc11e 100644 --- a/lms/nladmin-ui/src/store/modules/user.js +++ b/lms/nladmin-ui/src/store/modules/user.js @@ -89,13 +89,12 @@ export const logOut = (commit) => { export const setUserInfo = (res, commit) => { // 如果没有任何权限,则赋予一个默认的权限,避免请求死循环 - if (res.roles.length === 0) { + if (res.roles && res.roles.length > 0) { + commit('SET_ROLES', res.roles) + } else if (res.permissions.length === 0) { commit('SET_ROLES', ['ROLE_SYSTEM_DEFAULT']) } else { - commit('SET_ROLES', res.roles) - } - if (res.depts && res.roles.length > 0) { - commit('SET_DEPTS', res.depts) + commit('SET_ROLES', res.permissions) } commit('SET_USER', res.user) }