更正前端权限插件的判断

This commit is contained in:
zhoumingfa 2025-02-20 23:00:34 +08:00
parent 9a6d758fc7
commit 2c70db1498
4 changed files with 6 additions and 4 deletions

View File

@ -21,7 +21,7 @@ export function privilegeDirective(el, binding) {
if (!userPointsList) {
return false;
}
// 如果有权限,删除节点
// 如果有权限,删除节点
if (!_.some(userPointsList, ['webPerms', binding.value])) {
el.parentNode.removeChild(el);
}

View File

@ -8,6 +8,7 @@
* @Copyright 1024创新实验室 https://1024lab.net Since 2012
*/
import { useUserStore } from '/@/store/modules/system/user';
import _ from 'lodash';
const privilege = (value) => {
// 超级管理员
@ -19,7 +20,7 @@ const privilege = (value) => {
if (!userPointsList) {
return false;
}
return userPointsList && userPointsList.includes(value);
return _.some(userPointsList, ['apiPerms', value]);
};
export default {

View File

@ -21,7 +21,7 @@ export function privilegeDirective(el: { parentNode: { removeChild: (arg0: any)
if (!userPointsList) {
return false;
}
// 如果有权限,删除节点
// 如果有权限,删除节点
if (!_.some(userPointsList, ['webPerms', binding.value])) {
el.parentNode.removeChild(el);
}

View File

@ -9,6 +9,7 @@
*/
import { useUserStore } from '/@/store/modules/system/user';
import { App } from 'vue';
import _ from 'lodash';
const privilege = (value: string) => {
// 超级管理员
@ -20,7 +21,7 @@ const privilege = (value: string) => {
if (!userPointsList) {
return false;
}
return userPointsList && userPointsList.includes(value);
return _.some(userPointsList, ['apiPerms', value]);
};
export default {