create app
This commit is contained in:
45
src/types/api.d.ts
vendored
Normal file
45
src/types/api.d.ts
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
// 全局API响应类型定义
|
||||
declare global {
|
||||
// 基础API响应结构
|
||||
interface ApiResponse<T = any> {
|
||||
success: boolean
|
||||
message: string
|
||||
data?: T
|
||||
code?: number
|
||||
errMsg?: string
|
||||
}
|
||||
|
||||
// 登录/注册相关响应
|
||||
interface LoginResponse {
|
||||
token?: string
|
||||
user?: {
|
||||
id: string
|
||||
name: string
|
||||
email: string
|
||||
}
|
||||
}
|
||||
|
||||
// 通用列表响应
|
||||
interface ListResponse<T> {
|
||||
list: T[]
|
||||
total: number
|
||||
page: number
|
||||
pageSize: number
|
||||
}
|
||||
|
||||
// 分页参数
|
||||
interface PaginationParams {
|
||||
page: number
|
||||
pageSize: number
|
||||
}
|
||||
|
||||
// 通用错误响应
|
||||
interface ErrorResponse {
|
||||
success: false
|
||||
message: string
|
||||
code?: number
|
||||
errMsg?: string
|
||||
}
|
||||
}
|
||||
|
||||
export {}
|
||||
5
src/types/define-options.d.ts
vendored
Normal file
5
src/types/define-options.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
declare global {
|
||||
const defineOptions: <T = Record<string, any>>(options: T) => T
|
||||
}
|
||||
|
||||
export {}
|
||||
18
src/types/enum.ts
Normal file
18
src/types/enum.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
/** 流程类型 */
|
||||
export const FlowType = {
|
||||
/** 主流程 */
|
||||
MAIN: 'main',
|
||||
/** 历史流程 */
|
||||
HISTORY: 'history',
|
||||
/** 历史流程-Outfit */
|
||||
H_OUTFIT: 'history-outfit',
|
||||
/** 历史流程-Tryon */
|
||||
H_TRYON: 'history-tryon',
|
||||
/** 历史流程-AI */
|
||||
H_AI: 'history-ai',
|
||||
}
|
||||
/** 是否是历史流程 */
|
||||
export const IsHistoryFlow = (flowType: any) => {
|
||||
const arr = [FlowType.HISTORY, FlowType.H_OUTFIT, FlowType.H_TRYON, FlowType.H_AI]
|
||||
return arr.some((v) => v === flowType)
|
||||
}
|
||||
Reference in New Issue
Block a user