feat: 新增登录验证码

Former-commit-id: 9a297d1986ed6ea92b39abc0538cfe29be0636a1
This commit is contained in:
haoxr
2023-03-24 22:40:29 +08:00
parent 66499d06e9
commit e41715d426
6 changed files with 114 additions and 54 deletions

View File

@@ -1,6 +1,6 @@
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { LoginData, LoginResult } from './types';
import { CaptchaResult, LoginData, LoginResult } from './types';
/**
* 登录API
@@ -25,3 +25,15 @@ export function logoutApi() {
method: 'delete'
});
}
/**
* 获取验证码
*/
export function getCaptchaApi(): AxiosPromise<CaptchaResult> {
return request({
url: '/api/v1/auth/captcha',
method: 'get'
});
}

View File

@@ -5,11 +5,21 @@ export interface LoginData {
/**
* 用户名
*/
username: string;
username?: string;
/**
* 密码
*/
password: string;
password?: string;
/**
* 验证码缓存key
*/
verifyCodeKey?: string;
/**
* 验证码
*/
verifyCode?: string;
}
/**
@@ -33,3 +43,18 @@ export interface LoginResult {
*/
tokenType?: string;
}
/**
* 验证码响应
*/
export interface CaptchaResult {
/**
* 验证码缓存key
*/
verifyCodeKey: string;
/**
* 验证码图片Base64字符串
*/
verifyCodeBase64: string;
}