Blame view

src/types/index.ts 2.14 KB
532def1c   王彪总   新版本
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
  /**
   * 与后端 parking-cloud 的接口契约类型
   *
   * 契约要点(务必与后端 parking-framework 保持一致):
   *  - 地址前缀:管理后台 /admin-api,移动端 /app-api
   *  - 认证头:Authorization: Bearer <token>
   *  - 返回:CommonResult{code,msg,data},code === 0 表示成功
   *  - 业务错误码:0~999 全局(401 未登录、403 无权限、404 不存在、500 服务器异常),≥1000000000 业务错误
   */
  
  /** 统一返回结构 */
  export interface CommonResult<T = any> {
    code: number
    msg: string
    data: T
  }
  
  /** 分页请求基类 */
  export interface PageParam {
    pageNo: number
    pageSize: number
  }
  
  /** 分页返回结构 */
  export interface PageResult<T> {
    list: T[]
    total: number
  }
  
  /** 登录请求 */
  export interface LoginReqVO {
    username: string
    password: string
    captchaCode?: string
    captchaUuid?: string
  }
  
  /** 登录返回 */
  export interface LoginRespVO {
    accessToken: string
    refreshToken: string
    userId: number
    userType: number
    expiresTime: number
  }
  
  /** 图形验证码信息 */
  export interface CaptchaInfoRespVO {
    captchaEnable: boolean
    captchaImage?: string
    captchaUuid?: string
  }
  
  /** 当前用户信息 */
  export interface UserInfoVO {
    id: number
    username: string
    nickname: string
    orgId?: number
    deptId?: number
    avatar?: string
  }
  
  /** 后端下发的菜单(驱动前端动态路由) */
  export interface MenuVO {
    id: number
    parentId?: number | null
    name: string
    path: string
    /** 组件路径(相对 src/views),如 system/user/index;目录为 null */
    component?: string | null
    icon?: string
    visible: boolean
    sort?: number
    children?: MenuVO[]
  }
  
  /** get-permission-info 返回 */
  export interface PermissionInfoVO {
    user: UserInfoVO
    roles: string[]
    permissions: string[]
    menus: MenuVO[]
  }
  
  /** 前端内部使用的路由节点 */
  export interface AppRouteRecordRaw extends Record<string, any> {
    path: string
    name?: string
    component?: any
    meta?: {
      title?: string
      icon?: string
      hidden?: boolean
      noCache?: boolean
      affix?: boolean
      alwaysShow?: boolean
      [key: string]: any
    }
    children?: AppRouteRecordRaw[]
  }