修复页面bug

This commit is contained in:
2025-09-23 16:12:43 +08:00
parent 408b500b6a
commit 84b6a87ca8
9 changed files with 144 additions and 25 deletions
+4 -4
View File
@@ -1,4 +1,3 @@
// 避免类型耦合,使用 any 降级
import './global.less';
import React from 'react';
import { ThemeProvider } from './theme';
@@ -8,11 +7,12 @@ export function rootContainer(container: React.ReactNode, _args?: any) {
return React.createElement(ThemeProvider, null, container);
}
// 使用简化的 request 配置,避免与类型强绑定(兼容 umi 3)
const API_PREFIX = process.env.API_PREFIX || '';
export const request: any = {
prefix: API_PREFIX,
errorConfig: {
errorHandler(error: any) {
// 可在此处统一处理错误,如通知等
// 统一错误处理
throw error;
},
},
@@ -47,7 +47,6 @@ export const request: any = {
],
};
// 简单路由守卫:未登录访问受保护路由时跳回登录;已登录访问登录页时跳到欢迎页
export function onRouteChange({ location }: any) {
try {
const token = sessionStorage.getItem('access_token');
@@ -59,3 +58,4 @@ export function onRouteChange({ location }: any) {
}
} catch {}
}