feat: 1. 完善全局路由的访问权限的验证。 2. 完善接口返回的树形路由结构 3.优化评查点列表的查询,改用表连接的方式,废弃使用数据库的rpc函数,同时进行地区隔离和权限隔离。
4. 删除冗余的评查文件列表。 5.完善上传文档 页面初始化查询数据的时候 查询文件类型(改成动态指定) 6. 添加获取入口模块的查询接口。 7.完善服务端中判断token的有效性,失效则跳转到登录页。 8. 重构layout和sidebar的页面,改成由动态权限路由来渲染对应的菜单栏。 9.重构入口页面,通过动态查询根据不同地区的人返回不同的入口。
This commit is contained in:
+16
-2
@@ -106,6 +106,13 @@ axiosInstance.interceptors.response.use(
|
||||
if (isAxiosError(error) && error.response?.status === 401) {
|
||||
// Token 过期或无效
|
||||
console.warn('⚠️ Token 已过期或无效,请重新登录');
|
||||
console.warn('⚠️ 401 错误详情:', {
|
||||
url: error.config?.url,
|
||||
status: error.response?.status,
|
||||
statusText: error.response?.statusText,
|
||||
data: error.response?.data,
|
||||
headers: error.response?.headers
|
||||
});
|
||||
|
||||
if (typeof window !== 'undefined') {
|
||||
// 🌐 客户端环境:清除 localStorage 并跳转
|
||||
@@ -328,13 +335,20 @@ export async function apiRequest<T>(
|
||||
// 确保使用默认超时时间
|
||||
timeout: options.timeout || DEFAULT_TIMEOUT
|
||||
};
|
||||
|
||||
// 🔍 调试:打印 Authorization 头
|
||||
if (headers['Authorization']) {
|
||||
// console.log('🔑 [apiRequest] 请求包含 Authorization 头:', headers['Authorization'].substring(0, 20) + '...');
|
||||
} else {
|
||||
console.warn('⚠️ [apiRequest] 请求缺少 Authorization 头!headers:', Object.keys(headers));
|
||||
}
|
||||
// console.log(`📦 axios-client.ts->请求配置: \n${JSON.stringify(config)}`);
|
||||
|
||||
|
||||
// 删除body属性,避免axios警告
|
||||
if ('body' in config) {
|
||||
delete (config as ExtendedAxiosRequestConfig).body;
|
||||
}
|
||||
|
||||
|
||||
// 使用带重试功能的请求方法
|
||||
const response: AxiosResponse = await axiosRetry(config);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user