Blame view

Yi.Vben5.Vue3/apps/web-antd/src/api/core/user.ts 902 Bytes
515fceeb   “wangming”   框架初始化
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
  import { requestClient } from '#/api/request';
  
  export interface Role {
    dataScope: string;
    flag: boolean;
    roleId: number;
    roleKey: string;
    roleName: string;
    roleSort: number;
    status: string;
    superAdmin: boolean;
  }
  
  export interface User {
    avatar: string;
    creationTime: string;
    deptId: number;
    deptName: string;
    email: string;
    loginDate: string;
    loginIp: string;
    nick: string;
    phone: string;
    remark: string;
    roles: Role[];
    sex: string;
    status: string;
    tenantId: string;
    userId: number;
    userName: string;
    userType: string;
  }
  
  export interface UserInfoResp {
    permissionCodes: string[];
    roles: string[];
    roleCodes: string[];
    user: User;
  }
  
  /**
   * 获取用户信息
   * 存在返回null的情况(401) 不会抛出异常 需要手动抛异常
   */
  export async function getUserInfoApi() {
    return requestClient.get<null | UserInfoResp>('account');
  }