From 5bee3b98a7f80ad04c6ebb5d572bdc055f86e828 Mon Sep 17 00:00:00 2001 From: lijiahang Date: Sat, 29 Jul 2023 13:11:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20ui=20=E5=8C=85=E7=BB=93?= =?UTF-8?q?=E6=9E=84.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- orion-ops-ui/src/api/user.ts | 11 -- orion-ops-ui/src/api/user/auth.ts | 21 +++ orion-ops-ui/src/assets/style/global.less | 33 +++++ .../src/components/menu/use-menu-tree.ts | 24 ++-- orion-ops-ui/src/components/navbar/index.vue | 5 +- .../src/directive/permission/index.ts | 8 +- orion-ops-ui/src/hooks/chart-option.ts | 1 - orion-ops-ui/src/layout/default-layout.vue | 19 +-- orion-ops-ui/src/locale/zh-CN.ts | 14 -- orion-ops-ui/src/mock/index.ts | 4 +- orion-ops-ui/src/mock/message-box.ts | 85 ------------- orion-ops-ui/src/mock/user.ts | 120 +++--------------- orion-ops-ui/src/router/guard/index.ts | 3 + orion-ops-ui/src/router/routes/base.ts | 5 - .../src/router/routes/modules/dashboard.ts | 13 +- .../src/router/routes/modules/user.ts | 22 ++-- orion-ops-ui/src/router/routes/types.ts | 2 +- orion-ops-ui/src/router/typings.d.ts | 16 ++- orion-ops-ui/src/store/modules/app/types.ts | 2 + .../src/store/modules/tab-bar/index.ts | 23 +--- orion-ops-ui/src/store/modules/user/types.ts | 2 +- orion-ops-ui/src/types/mock.ts | 5 - orion-ops-ui/src/utils/index.ts | 31 ----- orion-ops-ui/src/utils/setup-mock.ts | 2 - .../src/views/dashboard/workplace/index.vue | 8 +- orion-ops-ui/src/views/user/child/index.vue | 13 -- .../src/views/user/{ => child1}/index.vue | 6 +- orion-ops-ui/src/views/user/child2/index.vue | 16 +++ 28 files changed, 149 insertions(+), 365 deletions(-) delete mode 100644 orion-ops-ui/src/api/user.ts delete mode 100644 orion-ops-ui/src/mock/message-box.ts delete mode 100644 orion-ops-ui/src/types/mock.ts delete mode 100644 orion-ops-ui/src/views/user/child/index.vue rename orion-ops-ui/src/views/user/{ => child1}/index.vue (59%) create mode 100644 orion-ops-ui/src/views/user/child2/index.vue diff --git a/orion-ops-ui/src/api/user.ts b/orion-ops-ui/src/api/user.ts deleted file mode 100644 index 984abd8a..00000000 --- a/orion-ops-ui/src/api/user.ts +++ /dev/null @@ -1,11 +0,0 @@ -import axios from 'axios'; -import type { RouteRecordNormalized } from 'vue-router'; -import { UserState } from '@/store/modules/user/types'; - -export function getUserInfo() { - return axios.post('/api/user/info'); -} - -export function getMenuList() { - return axios.post('/api/user/menu'); -} diff --git a/orion-ops-ui/src/api/user/auth.ts b/orion-ops-ui/src/api/user/auth.ts index b08d106a..c22670b6 100644 --- a/orion-ops-ui/src/api/user/auth.ts +++ b/orion-ops-ui/src/api/user/auth.ts @@ -1,4 +1,5 @@ import axios from 'axios'; +import { UserState } from '@/store/modules/user/types'; export interface LoginRequest { username: string; @@ -9,10 +10,30 @@ export interface LoginResponse { token: string; } +/** + * 登陆 + */ export function login(data: LoginRequest) { return axios.post('/infra/auth/login', data); } +/** + * 登出 + */ export function logout() { return axios.get('/infra/auth/logout'); } + +/** + * 获取用户信息 + */ +export function getUserPermission() { + return axios.get('/infra/permission/user'); +} + +/** + * 获取菜单列表 + */ +export function getMenuList() { + return axios.get('/infra/permission/menu'); +} diff --git a/orion-ops-ui/src/assets/style/global.less b/orion-ops-ui/src/assets/style/global.less index f90b206f..00c9c218 100644 --- a/orion-ops-ui/src/assets/style/global.less +++ b/orion-ops-ui/src/assets/style/global.less @@ -12,6 +12,8 @@ body { background-color: var(--color-bg-1); -moz-osx-font-smoothing: grayscale; -webkit-font-smoothing: antialiased; + --color-scrollbar-track: var(--color-neutral-1); + --color-scrollbar-thumb: #959FAB; } .echarts-tooltip-diy { @@ -25,6 +27,7 @@ body { /* Note: backdrop-filter has minimal browser support */ border-radius: 6px !important; + .content-panel { display: flex; justify-content: space-between; @@ -37,12 +40,15 @@ body { border-radius: 4px; margin-bottom: 4px; } + .tooltip-title { margin: 0 0 10px 0; } + p { margin: 0; } + .tooltip-title, .tooltip-value { font-size: 13px; @@ -53,6 +59,7 @@ body { color: #1d2129; font-weight: bold; } + .tooltip-item-icon { display: inline-block; margin-right: 8px; @@ -65,11 +72,13 @@ body { .general-card { border-radius: 4px; border: none; + & > .arco-card-header { height: auto; padding: 20px; border: none; } + & > .arco-card-body { padding: 0 20px 20px 20px; } @@ -87,8 +96,32 @@ body { height: 6px; border-radius: 50%; background-color: rgb(var(--blue-6)); + &.pass { background-color: rgb(var(--green-6)); } } } + +#app { + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +::-webkit-scrollbar-track { + background-color: var(--color-scrollbar-track); + border-radius: 8px; +} + +::-webkit-scrollbar { + -webkit-appearance: none; + width: 5px; + height: 5px; +} + +::-webkit-scrollbar-thumb { + cursor: pointer; + border-radius: 8px; + background-color: var(--color-scrollbar-thumb); + transition: color .2s ease; +} diff --git a/orion-ops-ui/src/components/menu/use-menu-tree.ts b/orion-ops-ui/src/components/menu/use-menu-tree.ts index 22915b76..becb3bc0 100644 --- a/orion-ops-ui/src/components/menu/use-menu-tree.ts +++ b/orion-ops-ui/src/components/menu/use-menu-tree.ts @@ -5,7 +5,6 @@ import { useAppStore } from '@/store'; import { cloneDeep } from 'lodash'; export default function useMenuTree() { - const permission = usePermission(); const appStore = useAppStore(); const appRoute = computed(() => { return appStore.appAsyncMenus; @@ -20,39 +19,40 @@ export default function useMenuTree() { if (!_routes) return null; const collector: any = _routes.map((element) => { - // no access - if (!permission.accessRouter(element)) { - return null; - } - - // leaf node + // 隐藏子目录 if (element.meta?.hideChildrenInMenu || !element.children) { element.children = []; - return element; + + if (element.meta?.hideInMenu) { + // 如果隐藏菜单 则不显示 + return null; + } else { + return element; + } } - // route filter hideInMenu true + // 过滤不显示的菜单 element.children = element.children.filter( (x) => x.meta?.hideInMenu !== true ); - // Associated child node + // 关联子节点 const subItem = travel(element.children, layer + 1); if (subItem.length) { element.children = subItem; return element; } - // the else logic + // 第二层 (子目录) if (layer > 1) { element.children = subItem; return element; } + // 是否隐藏目录 if (element.meta?.hideInMenu === false) { return element; } - return null; }); return collector.filter(Boolean); diff --git a/orion-ops-ui/src/components/navbar/index.vue b/orion-ops-ui/src/components/navbar/index.vue index 3832ccc3..7368488a 100644 --- a/orion-ops-ui/src/components/navbar/index.vue +++ b/orion-ops-ui/src/components/navbar/index.vue @@ -185,9 +185,8 @@ @@ -83,13 +83,16 @@ border-radius: 4px; overflow: auto; } + :deep(.panel-border) { margin-bottom: 0; border-bottom: 1px solid rgb(var(--gray-2)); } + .moduler-wrap { border-radius: 4px; background-color: var(--color-bg-2); + :deep(.text) { font-size: 12px; text-align: center; @@ -106,11 +109,13 @@ margin-bottom: 0; } } + &:hover { .icon { color: rgb(var(--arcoblue-6)); background-color: #e8f3ff; } + .text { color: rgb(var(--arcoblue-6)); } @@ -138,6 +143,7 @@ .container { display: block; } + .right-side { // display: none; width: 100%; diff --git a/orion-ops-ui/src/views/user/child/index.vue b/orion-ops-ui/src/views/user/child/index.vue deleted file mode 100644 index 0f78a73c..00000000 --- a/orion-ops-ui/src/views/user/child/index.vue +++ /dev/null @@ -1,13 +0,0 @@ - - - - - diff --git a/orion-ops-ui/src/views/user/index.vue b/orion-ops-ui/src/views/user/child1/index.vue similarity index 59% rename from orion-ops-ui/src/views/user/index.vue rename to orion-ops-ui/src/views/user/child1/index.vue index 212b5009..7ba4a8c7 100644 --- a/orion-ops-ui/src/views/user/index.vue +++ b/orion-ops-ui/src/views/user/child1/index.vue @@ -1,10 +1,12 @@ diff --git a/orion-ops-ui/src/views/user/child2/index.vue b/orion-ops-ui/src/views/user/child2/index.vue new file mode 100644 index 00000000..5c1a7002 --- /dev/null +++ b/orion-ops-ui/src/views/user/child2/index.vue @@ -0,0 +1,16 @@ + + + + +