This commit is contained in:
2026-09-15 23:04:38 +08:00
parent 6be3f083cc
commit 592fa9be64
21 changed files with 1323 additions and 77 deletions
+2 -1
View File
@@ -24,6 +24,7 @@ export interface RequestOptions {
auth?: boolean // 默认 true,需要鉴权
showError?: boolean // 默认 true,业务错误自动 toast
silentAuth?: boolean // 非关键请求(如未读红点轮询):401 只失败,不触发全局跳登录
timeout?: number // 单次请求超时(毫秒),默认 REQUEST_TIMEOUT;AI 生成等慢接口可放宽
}
// 未登录错误码:调用方可通过 e.code === NOT_LOGIN_CODE 区分
@@ -196,7 +197,7 @@ export function request<T = any>(options: RequestOptions): Promise<T> {
method,
data,
header: finalHeader,
timeout: REQUEST_TIMEOUT,
timeout: options.timeout || REQUEST_TIMEOUT,
success: (res) => {
const body = res.data as { code: number; msg: string; data?: T; details?: string[] }