feat:增加 social-login.vue 社交登录

This commit is contained in:
YunaiV
2025-04-10 22:23:41 +08:00
parent 2c105a21aa
commit 9fc51f085d
8 changed files with 310 additions and 14 deletions

View File

@@ -7,6 +7,10 @@ export namespace AuthApi {
password?: string;
username?: string;
captchaVerification?: string;
// 绑定社交登录时,需要传递如下参数
socialType?: number;
socialCode?: string;
socialState?: string;
}
/** 登录接口返回值 */
@@ -49,6 +53,12 @@ export namespace AuthApi {
code: string;
}
/** 社交快捷登录接口参数 */
export interface SocialLoginParams {
type: number;
code: string;
state: string;
}
}
/** 登录 */
@@ -117,4 +127,19 @@ export const register = (data: AuthApi.RegisterParams) => {
/** 通过短信重置密码 */
export const smsResetPassword = (data: AuthApi.ResetPasswordParams) => {
return requestClient.post('/system/auth/reset-password', data)
}
}
/** 社交授权的跳转 */
export const socialAuthRedirect = (type: number, redirectUri: string) => {
return requestClient.get('/system/auth/social-auth-redirect', {
params: {
type,
redirectUri,
},
});
}
/** 社交快捷登录 */
export const socialLogin = (data: AuthApi.SocialLoginParams) => {
return requestClient.post<AuthApi.LoginResult>('/system/auth/social-login', data);
}