From fd7360e6f463fc10ce3c57b558f8cf0da3f2d7da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A9=99=E5=AD=90?= <454313500@qq.com> Date: Fri, 6 May 2022 22:47:26 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=84=E6=B7=BB=E5=8A=A0=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E6=9D=83=E9=99=90=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AttributeExtend/PermissionAttribute.cs | 3 ++ Yi.Vue2.x/src/util/menuDic.js | 29 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 Yi.Vue2.x/src/util/menuDic.js diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/AttributeExtend/PermissionAttribute.cs b/Yi.Framework.Net6/Yi.Framework.WebCore/AttributeExtend/PermissionAttribute.cs index 2e17d62f..dfc4dfa8 100644 --- a/Yi.Framework.Net6/Yi.Framework.WebCore/AttributeExtend/PermissionAttribute.cs +++ b/Yi.Framework.Net6/Yi.Framework.WebCore/AttributeExtend/PermissionAttribute.cs @@ -45,6 +45,9 @@ namespace Yi.Framework.WebCore.AttributeExtend Regex regex = new Regex($"{permission.ToLower()}"); foreach (var p in perList) { + //过滤多余的标签 + p.Replace("Entity",""); + p.Replace("entity",""); if (regex.IsMatch(p)) { result = true; diff --git a/Yi.Vue2.x/src/util/menuDic.js b/Yi.Vue2.x/src/util/menuDic.js new file mode 100644 index 00000000..bd179894 --- /dev/null +++ b/Yi.Vue2.x/src/util/menuDic.js @@ -0,0 +1,29 @@ +//匹配菜单,让code变成路由 +const menuDic= +{ + "user:get:list": "/admuser", + "role:get:list": "/admrole", + "menu:get:list":"/admmenu", + "rolemenu:set:list":"/admrolemenu" +} +//匹配按钮,判断是否有按钮存在 +const btnDic= +{ + "user:add":"", + "user:update":"", + "user:del":"", +} +export default {menuDic,btnDic}; +//菜单可以区分使用code来进行匹配 +//记得:关于*的使用,要单独判断 +//比如, + +//按钮是user:*或者*:*:*直接全部放行即可 + +//菜单就不一样了,如果是*:*:* +//有两种方案: +//1:直接使用一个默认的全部菜单(会和后端给的菜单冲突) +//2:前端直接无视,*:*:*相当于只管后端权限(如果后端没有配置菜单前端将没有菜单了) + + +//如果查询找到的是user:*,可以先把*全部替换成get:list再进行比对即可 \ No newline at end of file