From 4aa42f5c20d56661a3d7dbaad8a9d0a21bbb5f73 Mon Sep 17 00:00:00 2001
From: bleachtred <bleachtred@163.com>
Date: 星期四, 18 四月 2024 11:29:57 +0800
Subject: [PATCH] fix  角色必填*号

---
 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