-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/// <reference path="./types/index.d.ts" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/** 基础对象 */ | ||
interface BaseObj<T = string|number|boolean> { | ||
[key: string]: T | ||
} | ||
|
||
/** 分页信息 */ | ||
interface PageInfo { | ||
/** 每页数据 */ | ||
pageSize: number | ||
/** 当前页,从1开始 */ | ||
currentPage: number | ||
/** 后端返回总数字段 */ | ||
totalCount?: number | ||
} | ||
|
||
/** API响应 */ | ||
type ApiResponse<T extends Array<BaseObj<any>> | BaseObj<any>> = { | ||
/** 是否成功 */ | ||
success: false | ||
/** 状态码, 不同状态码代表不同含义 */ | ||
code: string | ||
/** 错误信息 */ | ||
msg: string | ||
/** 弹窗时间 */ | ||
msgTimeout?: number | ||
} | { | ||
/** 是否成功 */ | ||
success: true | ||
/** 成功为json[] 或者 json格式数据 */ | ||
data: T | ||
} | ||
|
||
/** API响应(分页数据) */ | ||
type ApiPageResponse<T extends BaseObj<any>> = ApiResponse<Required<PageInfo> & { | ||
/** 分页数据 */ | ||
list: Array<T> | ||
}>; |