fix(menu): fix menudefault
This commit is contained in:
@@ -8,6 +8,7 @@ interface AppLayoutState {
|
|||||||
[key: string]: string
|
[key: string]: string
|
||||||
}
|
}
|
||||||
updateMenuDefaultRouter: (headerMenu: string, defaultRouter: string) => void
|
updateMenuDefaultRouter: (headerMenu: string, defaultRouter: string) => void
|
||||||
|
resetMenuDefaultRouter: () => void
|
||||||
linksOpenStatus: {
|
linksOpenStatus: {
|
||||||
[key: string]: boolean
|
[key: string]: boolean
|
||||||
}
|
}
|
||||||
@@ -40,6 +41,13 @@ export const useAppLayoutStore = create(
|
|||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
resetMenuDefaultRouter: () =>
|
||||||
|
set((state) => {
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
menuDefaultRouter: initialAppLayoutState.menuDefaultRouter,
|
||||||
|
}
|
||||||
|
}),
|
||||||
linksOpenStatus: initialAppLayoutState.linksOpenStatus,
|
linksOpenStatus: initialAppLayoutState.linksOpenStatus,
|
||||||
updateLinksOpenStatus: (key, opened) =>
|
updateLinksOpenStatus: (key, opened) =>
|
||||||
set((state) => {
|
set((state) => {
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import { useLoginStore } from "./store"
|
|||||||
import tabClasses from "./Tab.module.css"
|
import tabClasses from "./Tab.module.css"
|
||||||
// import { useSearchParams } from "next/navigation"
|
// import { useSearchParams } from "next/navigation"
|
||||||
import { usePermissionStore } from "../label/store/auth"
|
import { usePermissionStore } from "../label/store/auth"
|
||||||
|
import { useAppLayoutStore } from "../layout/store"
|
||||||
import Feishu from "./feishu/auto-login"
|
import Feishu from "./feishu/auto-login"
|
||||||
import DarkBgImage from "./resource/images/dark-login-bg.png"
|
import DarkBgImage from "./resource/images/dark-login-bg.png"
|
||||||
import LightBgImage from "./resource/images/light-login-bg.png"
|
import LightBgImage from "./resource/images/light-login-bg.png"
|
||||||
@@ -177,6 +178,8 @@ export default function LoginPage({ useUserStore }: { useUserStore: any }) {
|
|||||||
|
|
||||||
const { setUserPermissionInfo } = usePermissionStore()
|
const { setUserPermissionInfo } = usePermissionStore()
|
||||||
|
|
||||||
|
const { resetMenuDefaultRouter } = useAppLayoutStore()
|
||||||
|
|
||||||
// 表单提交处理
|
// 表单提交处理
|
||||||
const handleAccountSubmit = accountForm.onSubmit(
|
const handleAccountSubmit = accountForm.onSubmit(
|
||||||
async (values) => {
|
async (values) => {
|
||||||
@@ -209,6 +212,7 @@ export default function LoginPage({ useUserStore }: { useUserStore: any }) {
|
|||||||
access_token: res.token || "",
|
access_token: res.token || "",
|
||||||
refresh_token: res.refresh_token || "",
|
refresh_token: res.refresh_token || "",
|
||||||
})
|
})
|
||||||
|
resetMenuDefaultRouter()
|
||||||
window.location.href = `${process.env.NEXT_PUBLIC_BASE_PATH}/`
|
window.location.href = `${process.env.NEXT_PUBLIC_BASE_PATH}/`
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error) {
|
if (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user