Former-commit-id: aa51daa7da98e896e69b709433eabd5ea5b3d8f6
This commit is contained in:
郝先瑞
2023-06-25 18:28:49 +08:00
3 changed files with 28 additions and 23 deletions

View File

@@ -148,15 +148,15 @@ server {
![](https://oss.youlai.tech/youlai-boot/2023/05/21/d9863c6ded9e4363824b0d8c4c1f0642.png) ![](https://oss.youlai.tech/youlai-boot/2023/05/21/d9863c6ded9e4363824b0d8c4c1f0642.png)
## 公众号🎉
> 无广告,佛系公众号,随缘更新开源组织成员技术分享,期待您的关注!
![](https://s2.loli.net/2023/05/28/JaG4L8ZHmkIgRQC.png)
## 交流群🚀 ## 交流群🚀
> 如果交流群二维码过期,请加我微信,备注「前端」、「后端」或「全栈」即可,我将邀请您加入对应的微信群 > 关注「有来技术」公众号,获取交流群二维码。
>
> 如果交流群的二维码过期,加我微信,备注「前端」、「后端」或「全栈」即可。
>
> 为了避免营销广告人群混入,此举无奈,望理解!
![](https://s2.loli.net/2023/05/28/7vNjHTotb2h9zBD.png)
|公众号|交流群|
|-|-|
|<img src="https://s2.loli.net/2023/05/28/JaG4L8ZHmkIgRQC.png" height="180px"/>|<img src="https://s2.loli.net/2023/06/21/oikXZGOEDJMHpn5.png" height="180px"/>|

View File

@@ -1,6 +1,6 @@
import request from '@/utils/request'; import request from "@/utils/request";
import { AxiosPromise } from 'axios'; import { AxiosPromise } from "axios";
import { CaptchaResult, LoginData, LoginResult } from './types'; import { CaptchaResult, LoginData, LoginResult } from "./types";
/** /**
* 登录API * 登录API
@@ -9,10 +9,18 @@ import { CaptchaResult, LoginData, LoginResult } from './types';
* @returns * @returns
*/ */
export function loginApi(data: LoginData): AxiosPromise<LoginResult> { export function loginApi(data: LoginData): AxiosPromise<LoginResult> {
const formData = new FormData();
formData.append("username", data.username);
formData.append("password", data.password);
formData.append("verifyCodeKey", data.verifyCodeKey || "");
formData.append("verifyCode", data.verifyCode || "");
return request({ return request({
url: '/api/v1/auth/login', url: "/api/v1/auth/login",
method: 'post', method: "post",
params: data data: formData,
headers: {
"Content-Type": "multipart/form-data",
},
}); });
} }
@@ -21,19 +29,17 @@ export function loginApi(data: LoginData): AxiosPromise<LoginResult> {
*/ */
export function logoutApi() { export function logoutApi() {
return request({ return request({
url: '/api/v1/auth/logout', url: "/api/v1/auth/logout",
method: 'delete' method: "delete",
}); });
} }
/** /**
* 获取验证码 * 获取验证码
*/ */
export function getCaptchaApi(): AxiosPromise<CaptchaResult> { export function getCaptchaApi(): AxiosPromise<CaptchaResult> {
return request({ return request({
url: '/api/v1/auth/captcha', url: "/api/v1/auth/captcha",
method: 'get' method: "get",
}); });
} }

View File

@@ -5,11 +5,11 @@ export interface LoginData {
/** /**
* 用户名 * 用户名
*/ */
username?: string; username: string;
/** /**
* 密码 * 密码
*/ */
password?: string; password: string;
/** /**
* 验证码缓存key * 验证码缓存key
@@ -57,4 +57,3 @@ export interface CaptchaResult {
*/ */
verifyCodeBase64: string; verifyCodeBase64: string;
} }