From c160bfba9a2e5355ca3ecd3ea32ce7df3ecbcbe5 Mon Sep 17 00:00:00 2001 From: labbomb <739955946@qq.com> Date: Sat, 29 Jan 2022 11:58:14 +0800 Subject: [PATCH] Fix the routing problem of the user management module (#8251) --- .../src/layouts/content/components/user/use-dropdown.ts | 3 +++ dolphinscheduler-ui-next/src/layouts/content/index.tsx | 3 +-- dolphinscheduler-ui-next/src/store/menu/menu.ts | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/dolphinscheduler-ui-next/src/layouts/content/components/user/use-dropdown.ts b/dolphinscheduler-ui-next/src/layouts/content/components/user/use-dropdown.ts index abe62e60a6..634e59b103 100644 --- a/dolphinscheduler-ui-next/src/layouts/content/components/user/use-dropdown.ts +++ b/dolphinscheduler-ui-next/src/layouts/content/components/user/use-dropdown.ts @@ -18,14 +18,17 @@ import { useRouter } from 'vue-router' import { logout } from '@/service/modules/logout' import { useUserStore } from '@/store/user/user' +import { useMenuStore } from '@/store/menu/menu' import type { Router } from 'vue-router' import { DropdownOption } from 'naive-ui' export function useDropDown() { const router: Router = useRouter() const userStore = useUserStore() + const menuStore = useMenuStore() const handleSelect = (key: string | number, option: DropdownOption) => { + menuStore.setMenuKey('') if (key === 'logout') { useLogout() } else if (key === 'password') { diff --git a/dolphinscheduler-ui-next/src/layouts/content/index.tsx b/dolphinscheduler-ui-next/src/layouts/content/index.tsx index 33b819a168..dfb2ca4c48 100644 --- a/dolphinscheduler-ui-next/src/layouts/content/index.tsx +++ b/dolphinscheduler-ui-next/src/layouts/content/index.tsx @@ -61,8 +61,7 @@ const Content = defineComponent({ const getSideMenu = (state: any) => { const key = menuStore.getMenuKey state.sideMenuOptions = - state.menuOptions.filter((menu: { key: string }) => menu.key === key)[0] - .children || [] + state.menuOptions.filter((menu: { key: string }) => menu.key === key)[0]?.children || state.menuOptions state.isShowSide = menuStore.getShowSideStatus } diff --git a/dolphinscheduler-ui-next/src/store/menu/menu.ts b/dolphinscheduler-ui-next/src/store/menu/menu.ts index 3034c7a2f1..c619bbabe6 100644 --- a/dolphinscheduler-ui-next/src/store/menu/menu.ts +++ b/dolphinscheduler-ui-next/src/store/menu/menu.ts @@ -28,7 +28,7 @@ export const useMenuStore = defineStore({ persist: true, getters: { getMenuKey(): string { - return this.menuKey || 'home' + return this.menuKey }, getShowSideStatus(): boolean { return this.isShowSide || false