From f5a5aaa255d2dfd63c5cf68ee3ff6657240fa3ba Mon Sep 17 00:00:00 2001 From: 疯狂的狮子Li <15040126243@163.com> Date: 星期一, 29 七月 2024 12:32:05 +0800 Subject: [PATCH] reset 回滚 代码修改 采用其他方案 --- src/api/login.ts | 52 ++++++++++++++++++++++++++++------------------------ 1 files changed, 28 insertions(+), 24 deletions(-) diff --git a/src/api/login.ts b/src/api/login.ts index f60406c..b6955de 100644 --- a/src/api/login.ts +++ b/src/api/login.ts @@ -3,24 +3,25 @@ import { LoginData, LoginResult, VerifyCodeResult, TenantInfo } from './types'; import { UserInfo } from '@/api/system/user/types'; +// pc绔浐瀹氬鎴风鎺堟潈id +const clientId = import.meta.env.VITE_APP_CLIENT_ID; + /** * @param data {LoginData} * @returns */ export function login(data: LoginData): AxiosPromise<LoginResult> { 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 || clientId, + grantType: data.grantType || 'password' }; return request({ url: '/auth/login', headers: { - isToken: false + isToken: false, + isEncrypt: true, + repeatSubmit: false }, method: 'post', data: params @@ -29,13 +30,20 @@ // 娉ㄥ唽鏂规硶 export function register(data: any) { + const params = { + ...data, + clientId: clientId, + grantType: 'password' + }; return request({ url: '/auth/register', headers: { - isToken: false + isToken: false, + isEncrypt: true, + repeatSubmit: false }, method: 'post', - data: data + data: params }); } @@ -54,7 +62,7 @@ */ export function getCodeImg(): AxiosPromise<VerifyCodeResult> { return request({ - url: '/code', + url: '/auth/code', headers: { isToken: false }, @@ -62,24 +70,20 @@ timeout: 20000 }); } + /** * 绗笁鏂圭櫥褰� - * @param source 绗笁鏂圭櫥褰曠被鍨� - * */ -export function socialLogin(source: string, tenantId: string, loginType: string, code: any, state: any): AxiosPromise<any> { - const data = { - code, - state, - source, - tenantId, - loginType, - clientId: 'e5cd7e4891bf95d1d19206ce24a7b32e', + */ +export function callback(data: LoginData): AxiosPromise<any> { + const LoginData = { + ...data, + clientId: clientId, grantType: 'social' }; return request({ - url: '/auth/social-login', - method: 'get', - params: data + url: '/auth/social/callback', + method: 'post', + data: LoginData }); } -- Gitblit v1.9.3