From b16b860b63cfeaea13fab89459e26866f1aa0889 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Sat, 30 May 2020 12:13:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BE=A7=E8=BE=B9=E6=A0=8Fkey=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/layout/components/Sidebar/index.vue | 4 ++-- .../service/impl/SysMenuServiceImpl.java | 19 ++++++++++++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/ruoyi-ui/src/layout/components/Sidebar/index.vue b/ruoyi-ui/src/layout/components/Sidebar/index.vue index 342dbbe..1004f53 100644 --- a/ruoyi-ui/src/layout/components/Sidebar/index.vue +++ b/ruoyi-ui/src/layout/components/Sidebar/index.vue @@ -13,8 +13,8 @@ mode="vertical" > diff --git a/ruoyi/src/main/java/com/ruoyi/project/system/service/impl/SysMenuServiceImpl.java b/ruoyi/src/main/java/com/ruoyi/project/system/service/impl/SysMenuServiceImpl.java index d8562a3..56900ef 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/system/service/impl/SysMenuServiceImpl.java +++ b/ruoyi/src/main/java/com/ruoyi/project/system/service/impl/SysMenuServiceImpl.java @@ -140,7 +140,7 @@ public class SysMenuServiceImpl implements ISysMenuService { RouterVo router = new RouterVo(); router.setHidden("1".equals(menu.getVisible())); - router.setName(StringUtils.capitalize(menu.getPath())); + router.setName(getRouteName(menu)); router.setPath(getRouterPath(menu)); router.setComponent(getComponent(menu)); router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon())); @@ -299,6 +299,23 @@ public class SysMenuServiceImpl implements ISysMenuService return UserConstants.UNIQUE; } + /** + * 获取路由名称 + * + * @param menu 菜单信息 + * @return 路由名称 + */ + public String getRouteName(SysMenu menu) + { + String routerName = StringUtils.capitalize(menu.getPath()); + // 非外链并且是一级目录(类型为目录) + if (isMeunFrame(menu)) + { + routerName = StringUtils.EMPTY; + } + return routerName; + } + /** * 获取路由地址 *