消息角标开发
Some checks failed
Node CI / build (14.x, macOS-latest) (push) Has been cancelled
Node CI / build (14.x, ubuntu-latest) (push) Has been cancelled
Node CI / build (14.x, windows-latest) (push) Has been cancelled
Node CI / build (16.x, macOS-latest) (push) Has been cancelled
Node CI / build (16.x, ubuntu-latest) (push) Has been cancelled
Node CI / build (16.x, windows-latest) (push) Has been cancelled
coverage CI / build (push) Has been cancelled
Node pnpm CI / build (16.x, macOS-latest) (push) Has been cancelled
Node pnpm CI / build (16.x, ubuntu-latest) (push) Has been cancelled
Node pnpm CI / build (16.x, windows-latest) (push) Has been cancelled

This commit is contained in:
francis-fh
2026-07-20 20:50:35 +08:00
parent dfe22c6307
commit 86e70a38d0
5 changed files with 99 additions and 2 deletions

View File

@@ -20,15 +20,23 @@ import {
patchRouteWithRemoteMenus,
setRemoteMenu,
} from './services/session';
import {
fetchAndUpdateBadge,
patchMenuBadge,
clearBadgeCount,
} from './services/Management/interviewBadge';
import { PageEnum } from './enums/pagesEnums';
import { stringify } from 'querystring';
import { message } from 'antd';
import React from 'react';
import { getProductionApiBaseUrl } from './utils/publicUrl';
const isDev = process.env.NODE_ENV === 'development';
const loginOut = async () => {
clearSessionToken();
setRemoteMenu(null);
clearBadgeCount();
const { search, pathname } = window.location;
const urlParams = new URL(window.location.href).searchParams;
/** 此方法会跳转到 redirect 参数所在的位置 */
@@ -112,6 +120,7 @@ export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) =
// content: initialState?.currentUser?.nickName,
},
// actionRef: layoutActionRef,
postMenuData: (menuData: any[]) => patchMenuBadge(menuData),
menu: {
locale: false,
// // 每当 initialState?.currentUser?.userid 发生修改时重新执行 request
@@ -122,7 +131,7 @@ export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) =
if (!initialState?.currentUser?.userId) {
return [];
}
return getRemoteMenu();
return getRemoteMenu() || [];
},
},
footerRender: () => <Footer />,
@@ -254,6 +263,7 @@ export async function render(oldRender: () => void) {
try {
const routers = await getRoutersInfo();
setRemoteMenu(routers);
await fetchAndUpdateBadge();
} catch (error) {
console.error('获取路由失败:', error);
}