From 7915198be43abe5296ac9cbf32a288b349c63068 Mon Sep 17 00:00:00 2001 From: lijiahang Date: Wed, 2 Aug 2023 17:08:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=8F=9C=E5=8D=95=E9=80=BB?= =?UTF-8?q?=E8=BE=91.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- orion-ops-ui/src/components/menu/index.vue | 30 ++++++++-- orion-ops-ui/src/components/tab-bar/index.vue | 23 +++++--- .../src/components/tab-bar/tab-item.vue | 28 +++++---- orion-ops-ui/src/hooks/permission.ts | 56 ++++++++++++------ orion-ops-ui/src/router/constants.ts | 38 +++++++++--- .../src/router/guard/router-permission.ts | 15 ++--- orion-ops-ui/src/router/routes/base.ts | 1 + .../src/router/routes/modules/dashboard.ts | 3 +- .../src/router/routes/modules/user.ts | 4 ++ orion-ops-ui/src/router/typings.d.ts | 19 +++--- orion-ops-ui/src/store/modules/app/index.ts | 58 ++++++++++++++++++- .../src/store/modules/tab-bar/index.ts | 3 +- orion-ops-ui/src/store/modules/user/index.ts | 21 ++++--- orion-ops-ui/src/utils/route-listener.ts | 12 ++-- .../src/views/login/components/login-form.vue | 2 + orion-ops-ui/src/views/user/child2/index.vue | 11 ++-- 16 files changed, 230 insertions(+), 94 deletions(-) diff --git a/orion-ops-ui/src/components/menu/index.vue b/orion-ops-ui/src/components/menu/index.vue index 1a4d5275..9e22cf4e 100644 --- a/orion-ops-ui/src/components/menu/index.vue +++ b/orion-ops-ui/src/components/menu/index.vue @@ -30,6 +30,9 @@ const openKeys = ref([]); const selectedKey = ref([]); + /** + * 跳转 + */ const goto = (item: RouteRecordRaw) => { // 打开外链 if (regexUrl.test(item.path)) { @@ -48,6 +51,7 @@ name: item.name, }); }; + const findMenuOpenKeys = (target: string) => { const result: string[] = []; let isFind = false; @@ -69,9 +73,14 @@ }); return result; }; + + /** + * 监听路由 设置打开的 key + */ listenerRouteChange((newRoute) => { - const { requiresAuth, activeMenu, hideInMenu } = newRoute.meta; - if (requiresAuth && (!hideInMenu || activeMenu)) { + // TODO + const { activeMenu, hideInMenu } = newRoute.meta; + if (!hideInMenu || activeMenu) { const menuOpenKeys = findMenuOpenKeys( (activeMenu || newRoute.name) as string ); @@ -84,11 +93,14 @@ ]; } }, true); + + // 展开菜单 const setCollapse = (val: boolean) => { if (appStore.device === 'desktop') appStore.updateSettings({ menuCollapse: val }); }; + // 渲染菜单 const renderSubMenu = () => { function travel(_route: RouteRecordRaw[], nodes = []) { if (_route) { @@ -103,7 +115,8 @@ key={element?.name} v-slots={{ icon, - title: () => h(compile(t(element?.meta?.locale || ''))), + // 去除国际化 title: () => h(compile(t(element?.meta?.locale || ''))), + title: () => h(compile(element?.meta?.locale || '')), }} > {travel(element?.children)} @@ -114,7 +127,7 @@ v-slots={{ icon }} onClick={() => goto(element)} > - {t(element?.meta?.locale || '')} + {element?.meta?.locale || ''} ); nodes.push(node as never); @@ -158,5 +171,14 @@ font-size: 18px; } } + + .arco-menu-icon { + margin-right: 10px !important; + } + + .arco-menu-indent-list { + width: 28px; + display: inline-block; + } } diff --git a/orion-ops-ui/src/components/tab-bar/index.vue b/orion-ops-ui/src/components/tab-bar/index.vue index 214bad93..6711c47b 100644 --- a/orion-ops-ui/src/components/tab-bar/index.vue +++ b/orion-ops-ui/src/components/tab-bar/index.vue @@ -4,7 +4,7 @@
-