fix(layout): fix common

This commit is contained in:
2026-03-10 16:55:51 +08:00
parent 933ffbb06f
commit 928f64a5f0
2 changed files with 42 additions and 39 deletions

View File

@@ -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}`

View File

@@ -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[] = []