// request.js 的 TypeScript 声明文件 export interface ApiResponse { code: number msg: string data: T rows?: T[] total?: number } export interface RequestOptions { url: string method?: 'GET' | 'POST' | 'PUT' | 'DELETE' data?: any header?: Record timeout?: number clientId?: string responseType?: 'text' | 'json' | 'arraybuffer' | 'blob' } export interface LoginData { username: string password: string tenantId?: string clientId?: string grantType?: string } export interface UploadResponse { code: number msg: string data: { url: string ossId: string fileName: string } } export interface DownloadResponse { statusCode: number tempFilePath: string errMsg: string } // 主要导出函数 export function request(options: RequestOptions): Promise // 便捷请求方法 export function get(url: string, data?: any, header?: Record): Promise> export function post(url: string, data?: any, header?: Record): Promise> export function put(url: string, data?: any, header?: Record): Promise> export function del(url: string, data?: any, header?: Record): Promise> // 文件操作方法 export function uploadFile(url: string, filePath: string, formData?: Record): Promise export function downloadFile(url: string): Promise export function download(url: string, params: any, fileName: string): Promise // API对象 export const api: { login: (data: LoginData) => Promise getUserInfo: () => Promise getTenantList: (isToken?: boolean) => Promise logout: () => Promise }