提交 | 用户 | 时间
|
820397
|
1 |
import request from '@/config/axios' |
H |
2 |
import { getRefreshToken } from '@/utils/auth' |
|
3 |
import type { UserLoginVO } from './types' |
|
4 |
|
|
5 |
export interface SmsCodeVO { |
|
6 |
mobile: string |
|
7 |
scene: number |
|
8 |
} |
|
9 |
|
|
10 |
export interface SmsLoginVO { |
|
11 |
mobile: string |
|
12 |
code: string |
|
13 |
} |
|
14 |
|
|
15 |
// 登录 |
|
16 |
export const login = (data: UserLoginVO) => { |
|
17 |
return request.post({ url: '/system/auth/login', data }) |
|
18 |
} |
|
19 |
|
|
20 |
// 刷新访问令牌 |
|
21 |
export const refreshToken = () => { |
|
22 |
return request.post({ url: '/system/auth/refresh-token?refreshToken=' + getRefreshToken() }) |
|
23 |
} |
|
24 |
|
|
25 |
// 使用租户名,获得租户编号 |
|
26 |
export const getTenantIdByName = (name: string) => { |
|
27 |
return request.get({ url: '/system/tenant/get-id-by-name?name=' + name }) |
|
28 |
} |
|
29 |
|
|
30 |
// 使用租户域名,获得租户信息 |
|
31 |
export const getTenantByWebsite = (website: string) => { |
|
32 |
return request.get({ url: '/system/tenant/get-by-website?website=' + website }) |
|
33 |
} |
|
34 |
|
|
35 |
// 登出 |
|
36 |
export const loginOut = () => { |
|
37 |
return request.post({ url: '/system/auth/logout' }) |
|
38 |
} |
|
39 |
|
|
40 |
// 获取用户权限信息 |
|
41 |
export const getInfo = () => { |
|
42 |
return request.get({ url: '/system/auth/get-permission-info' }) |
|
43 |
} |
|
44 |
|
39248b
|
45 |
// 获取用应用户权限信息 |
H |
46 |
export const getUserAppInfo = (id: number) => { |
|
47 |
return request.get({ url: '/system/auth/get-app-permission-info?id=' + id }) |
|
48 |
} |
|
49 |
|
820397
|
50 |
//获取登录验证码 |
H |
51 |
export const sendSmsCode = (data: SmsCodeVO) => { |
|
52 |
return request.post({ url: '/system/auth/send-sms-code', data }) |
|
53 |
} |
|
54 |
|
|
55 |
// 短信验证码登录 |
|
56 |
export const smsLogin = (data: SmsLoginVO) => { |
|
57 |
return request.post({ url: '/system/auth/sms-login', data }) |
|
58 |
} |
|
59 |
|
|
60 |
// 社交快捷登录,使用 code 授权码 |
|
61 |
export function socialLogin(type: string, code: string, state: string) { |
|
62 |
return request.post({ |
|
63 |
url: '/system/auth/social-login', |
|
64 |
data: { |
|
65 |
type, |
|
66 |
code, |
|
67 |
state |
|
68 |
} |
|
69 |
}) |
|
70 |
} |
|
71 |
|
|
72 |
// 社交授权的跳转 |
|
73 |
export const socialAuthRedirect = (type: number, redirectUri: string) => { |
|
74 |
return request.get({ |
|
75 |
url: '/system/auth/social-auth-redirect?type=' + type + '&redirectUri=' + redirectUri |
|
76 |
}) |
|
77 |
} |
|
78 |
// 获取验证图片以及 token |
|
79 |
export const getCode = (data) => { |
|
80 |
return request.postOriginal({ url: 'system/captcha/get', data }) |
|
81 |
} |
|
82 |
|
|
83 |
// 滑动或者点选验证 |
|
84 |
export const reqCheck = (data) => { |
|
85 |
return request.postOriginal({ url: 'system/captcha/check', data }) |
|
86 |
} |