You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
1.2 KiB
81 lines
1.2 KiB
|
1 month ago
|
/**
|
||
|
|
* 全局类型定义
|
||
|
|
*/
|
||
|
|
|
||
|
|
/**
|
||
|
|
* API 响应基础接口
|
||
|
|
*/
|
||
|
|
export interface ApiResponse<T = any> {
|
||
|
|
code: number;
|
||
|
|
message: string;
|
||
|
|
data: T;
|
||
|
|
timestamp?: number;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 分页参数
|
||
|
|
*/
|
||
|
|
export interface PaginationParams {
|
||
|
|
page: number;
|
||
|
|
pageSize: number;
|
||
|
|
sortBy?: string;
|
||
|
|
sortOrder?: 'asc' | 'desc';
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 分页响应
|
||
|
|
*/
|
||
|
|
export interface PaginatedResponse<T> {
|
||
|
|
items: T[];
|
||
|
|
total: number;
|
||
|
|
page: number;
|
||
|
|
pageSize: number;
|
||
|
|
totalPages: number;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 错误响应
|
||
|
|
*/
|
||
|
|
export interface ErrorResponse {
|
||
|
|
code: number;
|
||
|
|
message: string;
|
||
|
|
errors?: Record<string, string[]>;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 上传文件响应
|
||
|
|
*/
|
||
|
|
export interface UploadResponse {
|
||
|
|
url: string;
|
||
|
|
filename: string;
|
||
|
|
size: number;
|
||
|
|
mimeType: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 导航参数类型
|
||
|
|
*/
|
||
|
|
export type RootStackParamList = {
|
||
|
|
Home: undefined;
|
||
|
|
Profile: { userId: string };
|
||
|
|
Settings: undefined;
|
||
|
|
Login: undefined;
|
||
|
|
Register: undefined;
|
||
|
|
// 添加更多路由...
|
||
|
|
};
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 环境变量类型
|
||
|
|
*/
|
||
|
|
declare global {
|
||
|
|
namespace NodeJS {
|
||
|
|
interface ProcessEnv {
|
||
|
|
EXPO_PUBLIC_API_URL: string;
|
||
|
|
EXPO_PUBLIC_APP_NAME: string;
|
||
|
|
EXPO_PUBLIC_APP_VERSION: string;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
export {};
|