diff --git a/components/layout/PathnameRecorder.tsx b/components/layout/PathnameRecorder.tsx index 3e2dda6..2ae70ed 100644 --- a/components/layout/PathnameRecorder.tsx +++ b/components/layout/PathnameRecorder.tsx @@ -40,11 +40,14 @@ export function PathnameRecorder({ menu }: ComponentProps) { const { updateMenuDefaultRouter } = useAppLayoutStore() useEffect(() => { + let key = process.env.NEXT_PUBLIC_BASE_PATH + ? process.env.NEXT_PUBLIC_BASE_PATH + : `/${sideNavMenu?.url}` pathname.startsWith(`/${sideNavMenu?.url}`) && sideNavMenu?.url && `/${sideNavMenu?.url}` !== pathname && updateMenuDefaultRouter( - `/${sideNavMenu?.url}`, + key, queryString ? `${process.env.NEXT_PUBLIC_BASE_PATH}${pathname}?${queryString}` : `${process.env.NEXT_PUBLIC_BASE_PATH}${pathname}` diff --git a/components/layout/common.ts b/components/layout/common.ts index 3218196..d02508f 100644 --- a/components/layout/common.ts +++ b/components/layout/common.ts @@ -8,7 +8,44 @@ export interface MenuItem { export const withoutLayoutRoutes = ["/login"] -export const subPathList: MenuItem[] = [ +export const subConfigList: { source: string; url: string }[] = + process.env.NEXT_PUBLIC_ENV === "development" + ? [ + { + source: "/image", + url: "http://localhost:5532", + }, + { + source: "/video", + url: "http://localhost:5533", + }, + ] + : process.env.NEXT_PUBLIC_ENV === "standalone" + ? [] + : [] + +const currentComponentList: MenuItem[] = [ + { + title: "个人中心", + url: "person", + icon: "PersonalMenuIcon", + items: [ + { + title: "个人看板", + url: "dashboard", + icon: "TaskMenuIcon", + }, + { + title: "个人日报", + url: "report", + icon: "AuthMenuIcon", + }, + ], + }, +] + +export const componentList: MenuItem[] = [ + ...currentComponentList, { title: "图片标注", url: "image", @@ -31,41 +68,4 @@ export const subPathList: MenuItem[] = [ }, ] -export const subConfigList: { source: string; url: string }[] = - process.env.NEXT_PUBLIC_ENV === "development" - ? [ - { - source: "/image", - url: "http://localhost:5532", - }, - { - source: "/video", - url: "http://localhost:5533", - }, - ] - : process.env.NEXT_PUBLIC_ENV === "standalone" - ? [] - : [] - -export const componentList: MenuItem[] = [ - { - title: "个人中心", - url: "person", - icon: "PersonalMenuIcon", - items: [ - { - title: "个人看板", - url: "dashboard", - icon: "TaskMenuIcon", - }, - { - title: "个人日报", - url: "report", - icon: "AuthMenuIcon", - }, - ], - }, - ...subPathList, -] - export const showList: MenuItem[] = []