types.ts 821 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /**
  2. * 在 uniapp 的 RequestOptions 和 IUniUploadFileOptions 基础上,添加自定义参数
  3. */
  4. export type CustomRequestOptions = UniApp.RequestOptions & {
  5. query?: Record<string, any>
  6. /** 出错时是否隐藏错误提示 */
  7. hideErrorToast?: boolean
  8. } & IUniUploadFileOptions // 添加uni.uploadFile参数类型
  9. // 通用响应格式(兼容 msg + message 字段)
  10. export type IResponse<T = any> = {
  11. code: number
  12. data: T
  13. message: string
  14. [key: string]: any // 允许额外属性
  15. } | {
  16. code: number
  17. data: T
  18. msg: string
  19. [key: string]: any // 允许额外属性
  20. }
  21. // 分页请求参数
  22. export interface PageParams {
  23. page: number
  24. pageSize: number
  25. [key: string]: any
  26. }
  27. // 分页响应数据
  28. export interface PageResult<T> {
  29. list: T[]
  30. total: number
  31. page: number
  32. pageSize: number
  33. }