diff --git a/src/api/login.ts b/src/api/login.ts index 9903f5b..d4ceb49 100644 --- a/src/api/login.ts +++ b/src/api/login.ts @@ -2,6 +2,7 @@ import request from '@/utils/request'; import { AxiosPromise } from 'axios'; import { LoginData, LoginResult, VerifyCodeResult, TenantInfo } from './types'; import { UserInfo } from '@/api/system/user/types'; +import { da } from 'element-plus/es/locale'; /** * @param data {LoginData} @@ -9,13 +10,9 @@ import { UserInfo } from '@/api/system/user/types'; */ export function login(data: LoginData): AxiosPromise { const params = { - tenantId: data.tenantId, - username: data.username.trim(), - password: data.password, - code: data.code, - uuid: data.uuid, - clientId: 'e5cd7e4891bf95d1d19206ce24a7b32e', - grantType: 'password' + ...data, + clientId: data.clientId || 'e5cd7e4891bf95d1d19206ce24a7b32e', + grantType: data.grantType || 'password' }; return request({ url: '/auth/login', @@ -66,16 +63,16 @@ export function getCodeImg(): AxiosPromise { * 第三方登录 * @param source 第三方登录类型 * */ -export function socialLogin(source: string, code: any, state: any): AxiosPromise { - const data = { - code, - state, - source +export function callback(data: LoginData): AxiosPromise { + const LoginData = { + ...data, + clientId: 'e5cd7e4891bf95d1d19206ce24a7b32e', + grantType: 'social' }; return request({ - url: '/auth/social-login', - method: 'get', - params: data + url: '/auth/social/callback', + method: 'post', + data: LoginData }); } diff --git a/src/api/types.ts b/src/api/types.ts index 8ca204f..e02e645 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -15,10 +15,13 @@ export type RegisterForm = { * 登录请求 */ export interface LoginData { - tenantId: string; - username: string; - password: string; + tenantId?: string; + username?: string; + password?: string; rememberMe?: boolean; + socialCode?: string, + socialState?: string, + source?: string, code?: string; uuid?: string; clientId: string; diff --git a/src/layout/components/SocialLogin/index.vue b/src/layout/components/SocialLogin/index.vue index 127007b..7656673 100644 --- a/src/layout/components/SocialLogin/index.vue +++ b/src/layout/components/SocialLogin/index.vue @@ -3,34 +3,80 @@ diff --git a/src/router/index.ts b/src/router/index.ts index 76a81bc..dfd0547 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -181,4 +181,5 @@ const router = createRouter({ } }); + export default router; diff --git a/src/views/login.vue b/src/views/login.vue index 9becbc3..3234864 100644 --- a/src/views/login.vue +++ b/src/views/login.vue @@ -4,7 +4,8 @@

RuoYi-Vue-Plus多租户管理系统

- + @@ -14,12 +15,14 @@ - + - +