From 0358dc233a46363d7864d882e0146e56d10ffb27 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期五, 21 十月 2022 13:02:52 +0800 Subject: [PATCH] update springboot 2.7.4 => 2.7.5 update springboot-admin 2.7.5 => 2.7.6 update springdoc 1.6.11 => 1.6.12 update poi 5.2.2 => 5.2.3 update hutool 5.8.7=>5.8.8 update aws-s3 1.12.300 => 1.12.324 update aliyun-sms 2.0.18 => 2.0.22 update tencent-sms 3.1.591 => 3.1.611 --- ruoyi-ui/src/directive/permission/hasPermi.js | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+), 0 deletions(-) diff --git a/ruoyi-ui/src/directive/permission/hasPermi.js b/ruoyi-ui/src/directive/permission/hasPermi.js new file mode 100644 index 0000000..7101e3e --- /dev/null +++ b/ruoyi-ui/src/directive/permission/hasPermi.js @@ -0,0 +1,28 @@ + /** + * v-hasPermi 鎿嶄綔鏉冮檺澶勭悊 + * Copyright (c) 2019 ruoyi + */ + +import store from '@/store' + +export default { + inserted(el, binding, vnode) { + const { value } = binding + const all_permission = "*:*:*"; + const permissions = store.getters && store.getters.permissions + + if (value && value instanceof Array && value.length > 0) { + const permissionFlag = value + + const hasPermissions = permissions.some(permission => { + return all_permission === permission || permissionFlag.includes(permission) + }) + + if (!hasPermissions) { + el.parentNode && el.parentNode.removeChild(el) + } + } else { + throw new Error(`璇疯缃搷浣滄潈闄愭爣绛惧�糮) + } + } +} -- Gitblit v1.9.3