fix(layout): fix common
This commit is contained in:
@@ -40,11 +40,14 @@ export function PathnameRecorder({ menu }: ComponentProps) {
|
|||||||
|
|
||||||
const { updateMenuDefaultRouter } = useAppLayoutStore()
|
const { updateMenuDefaultRouter } = useAppLayoutStore()
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
let key = process.env.NEXT_PUBLIC_BASE_PATH
|
||||||
|
? process.env.NEXT_PUBLIC_BASE_PATH
|
||||||
|
: `/${sideNavMenu?.url}`
|
||||||
pathname.startsWith(`/${sideNavMenu?.url}`) &&
|
pathname.startsWith(`/${sideNavMenu?.url}`) &&
|
||||||
sideNavMenu?.url &&
|
sideNavMenu?.url &&
|
||||||
`/${sideNavMenu?.url}` !== pathname &&
|
`/${sideNavMenu?.url}` !== pathname &&
|
||||||
updateMenuDefaultRouter(
|
updateMenuDefaultRouter(
|
||||||
`/${sideNavMenu?.url}`,
|
key,
|
||||||
queryString
|
queryString
|
||||||
? `${process.env.NEXT_PUBLIC_BASE_PATH}${pathname}?${queryString}`
|
? `${process.env.NEXT_PUBLIC_BASE_PATH}${pathname}?${queryString}`
|
||||||
: `${process.env.NEXT_PUBLIC_BASE_PATH}${pathname}`
|
: `${process.env.NEXT_PUBLIC_BASE_PATH}${pathname}`
|
||||||
|
|||||||
@@ -8,7 +8,44 @@ export interface MenuItem {
|
|||||||
|
|
||||||
export const withoutLayoutRoutes = ["/login"]
|
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: "图片标注",
|
title: "图片标注",
|
||||||
url: "image",
|
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[] = []
|
export const showList: MenuItem[] = []
|
||||||
|
|||||||
Reference in New Issue
Block a user