feat(user.ts):用户登录接口

This commit is contained in:
有来技术
2021-11-18 23:57:42 +08:00
parent 6d911771dc
commit a4fe3987c3
4 changed files with 118 additions and 14 deletions

45
src/api/login/index.ts Normal file
View File

@@ -0,0 +1,45 @@
import request from "@utils/request";
/**
* 登录
* @param data
*/
export function login(data: object) {
return request({
url: '/youlai-auth/oauth/token',
params: data,
headers: {
'Authorization': 'Basic bWFsbC1hZG1pbi13ZWI6MTIzNDU2' // 客户端信息加密摘要认证明文mall-admin-web:123456
}
})
}
/**
* 登录成功后获取用户信息(包括用户头像、权限列表等)
*/
export function getUserInfo() {
return request({
url: '/youlai-admin/api/v1/users/me',
method: 'get'
})
}
/**
* 注销
*/
export function logout() {
return request({
url: '/youlai-auth/oauth/logout',
method: 'delete'
})
}
/**
* 获取图片验证码
*/
export function getCaptcha() {
return request({
url: '/captcha',
method: 'get'
})
}