From 31da01bdd1e4fe8fb8eec41f401d73bcf6cc18b7 Mon Sep 17 00:00:00 2001 From: ahao <liuhaoai545@gmail.com> Date: 星期六, 06 一月 2024 17:27:01 +0800 Subject: [PATCH] fix https://gitee.com/dromara/RuoYi-Vue-Plus/issues/I8TMAI --- src/api/login.ts | 27 ++++++++++++++++++--------- 1 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/api/login.ts b/src/api/login.ts index d4ceb49..100a5e9 100644 --- a/src/api/login.ts +++ b/src/api/login.ts @@ -2,7 +2,9 @@ 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'; + +// pc绔浐瀹氬鎴风鎺堟潈id +const clientId = import.meta.env.VITE_APP_CLIENT_ID; /** * @param data {LoginData} @@ -11,13 +13,14 @@ export function login(data: LoginData): AxiosPromise<LoginResult> { const params = { ...data, - clientId: data.clientId || 'e5cd7e4891bf95d1d19206ce24a7b32e', + clientId: data.clientId || clientId, grantType: data.grantType || 'password' }; return request({ url: '/auth/login', headers: { - isToken: false + isToken: false, + isEncrypt: true }, method: 'post', data: params @@ -26,13 +29,19 @@ // 娉ㄥ唽鏂规硶 export function register(data: any) { + const params = { + ...data, + clientId: clientId, + grantType: 'password' + }; return request({ url: '/auth/register', headers: { - isToken: false + isToken: false, + isEncrypt: true }, method: 'post', - data: data + data: params }); } @@ -51,7 +60,7 @@ */ export function getCodeImg(): AxiosPromise<VerifyCodeResult> { return request({ - url: '/code', + url: '/auth/code', headers: { isToken: false }, @@ -59,14 +68,14 @@ timeout: 20000 }); } + /** * 绗笁鏂圭櫥褰� - * @param source 绗笁鏂圭櫥褰曠被鍨� - * */ + */ export function callback(data: LoginData): AxiosPromise<any> { const LoginData = { ...data, - clientId: 'e5cd7e4891bf95d1d19206ce24a7b32e', + clientId: clientId, grantType: 'social' }; return request({ -- Gitblit v1.9.3