From 5f008b04c8897c66275acf78cd1a7bc3896b69d0 Mon Sep 17 00:00:00 2001 From: zhaoxiao Date: Mon, 20 Dec 2021 13:39:57 +0800 Subject: [PATCH] =?UTF-8?q?[update]=20=E8=8F=9C=E5=8D=95=E6=9D=83=E9=99=90?= =?UTF-8?q?=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/user.js | 85 ++++++++++++++++++++++++++------------- 1 file changed, 57 insertions(+), 28 deletions(-) diff --git a/src/store/modules/user.js b/src/store/modules/user.js index f846eb5..2a2a386 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -158,34 +158,64 @@ const user = { */ GetPermissionList({ commit }) { return new Promise((resolve, reject) => { + console.log(111) let menuData = [] - // // 这里可以拿到Vue.ls.get(USER_INFO),暂定identity:0---不是标协会员;1---是标协会员企业管理员;2---是标协会员但不是企业管理员; - // let userIdentity = '1' - // switch (userIdentity) { - // // 不是标协会员,则不显示标协会员的全部菜单 - // case '0': - // menuData = routerData.filter(tt => tt.id.indexOf('4') === -1) - // break - // // 是标协会员企业管理员,显示系统全部菜单 - // case '1': - // menuData = routerData - // break - // // 是标协会员但不是企业管理员,不显示标协会员下的会员管理、证书管理、缴费信息、理事会四个菜单 - // case '2': - // routerData.forEach(item => { - // if (item.children && item.children.length > 0) { - // let tt = item - // tt.children = item.children.filter(aa => (aa.meta.title !== '会员管理' && aa.meta.title !== '证书管理' && aa.meta.title !== '缴费信息' && aa.meta.title !== '理事会')) - // menuData.push(tt) - // } else { - // menuData.push(item) - // } - // }) - // break - // default: - // menuData = routerData - // } - menuData = routerData + /**判断用户角色**/ + let userIdentity + let userInfo = Vue.ls.get(USER_INFO) + // userInfo.companyRole,企业角色:1--普通企业;2--会员企业 + if (userInfo.companyRole.toString() === '1') { + userIdentity = '0' + } else { + // userInfo.roleCode,企业用户角色:1--企业联系人、--企业管理员 + if (userInfo.roleCode.toString() === '2') { + userIdentity = '1' + } else { + // userInfo.isCouncil,是否理事会成员:1--是;0--否 + if (userInfo.isCouncil.toString() === '1') { + userIdentity = '3' + } else { + userIdentity = '2' + } + } + } + /**判断用户角色-end*/ + switch (userIdentity) { + // 不是标协会员,则不显示标协会员的全部菜单 + case '0': + menuData = routerData.filter(tt => tt.id.indexOf('4') === -1) + break + // 是标协会员企业管理员,显示系统全部菜单 + case '1': + menuData = routerData + break + // 是标协会员但不是企业管理员,不显示标协会员下的会员管理、证书管理、缴费信息、理事会四个菜单 + case '2': + routerData.forEach(item => { + if (item.children && item.children.length > 0) { + let tt = item + tt.children = item.children.filter(aa => (aa.meta.title !== '会员管理' && aa.meta.title !== '证书管理' && aa.meta.title !== '缴费信息' && aa.meta.title !== '理事会')) + menuData.push(tt) + } else { + menuData.push(item) + } + }) + break + // 是标协会员理事,不显示标协会员下的会员管理、证书管理、缴费信息三个菜单 + case '3' : + routerData.forEach(item => { + if (item.children && item.children.length > 0) { + let tt = item + tt.children = item.children.filter(aa => (aa.meta.title !== '会员管理' && aa.meta.title !== '证书管理' && aa.meta.title !== '缴费信息')) + menuData.push(tt) + } else { + menuData.push(item) + } + }) + break + default: + menuData = routerData + } const authData = [] const allAuthData = [] sessionStorage.setItem(USER_AUTH, JSON.stringify(authData)) @@ -208,7 +238,6 @@ const user = { } }) }, - // 登出 Logout({ commit, state }) { return new Promise((resolve) => {