From 05b2cd59596baebaebe1773c4ca3ba45deacf2e8 Mon Sep 17 00:00:00 2001
From: zzzz <690498789@qq.com>
Date: Sun, 21 Apr 2024 17:40:41 +0800
Subject: [PATCH] first

---
 src/API/login.js |  111 ++++++++++++++++++++++++++++++++++---------------------
 1 files changed, 68 insertions(+), 43 deletions(-)

diff --git a/src/API/login.js b/src/API/login.js
index faa7ae2..7d81bb5 100644
--- a/src/API/login.js
+++ b/src/API/login.js
@@ -1,69 +1,94 @@
 import { httpJson } from "@/request/http";
-// 网络请求demo 列子
+import requestHttp from "@/request/httpAxios";
 
-// 获取当前项目信息
-// export const getCurrentProjectInfo = {
-//     url: "projectInfoApp/getCurrentProjectInfo",
-//     method: "get",
-//     isLoading: true
-// }
-
+function objectToFormData(obj) {
+  const formData = new FormData();
+  for (let key of Object.keys(obj)) {
+    let value = obj[key];
+    // 如果值是文件,我们直接添加,否则将其转换为字符串
+    if (value instanceof File) {
+      formData.append(key, value);
+    } else {
+      formData.append(key, String(value));
+    }
+  }
+  return formData;
+}
 const getCurrentProjectInfo = (params) => {
-    return httpJson({
-        url: "projectInfoApp/getCurrentProjectInfo",
-        method: "get",
-        isLoading: true
-    }, params)
+  return httpJson(
+    {
+      url: "projectInfoApp/getCurrentProjectInfo",
+      method: "get",
+      isLoading: true,
+    },
+    params
+  );
 };
 //注册用户
 ///
 const registerUser = (params) => {
-    return httpJson({
-        url: "/api/localuser!registerNoVerifcode.action",
-        method: "get",
-        isLoading: true
-    }, params)
+  return httpJson(
+    {
+      url: "/api/localuser!registerNoVerifcode.action",
+      method: "get",
+      isLoading: true,
+    },
+    params
+  );
 };
 //登录
 const loginUser = (params) => {
-    return httpJson({
-        url: "/api/user!login.action",
-        method: "get",
-        isLoading: true
-    }, params)
+  return httpJson(
+    {
+      url: "/api/user!login.action",
+      method: "get",
+      isLoading: true,
+    },
+    params
+  );
 };
-
 
 /// 发送邮箱 手机验证码
 const sendVerifyCode = (params) => {
-    return httpJson({
-        url: "/api/idcode!execute.action",
-        method: "get",
-        isLoading: false
-    }, params)
+  return httpJson(
+    {
+      url: "/api/idcode!execute.action",
+      method: "get",
+      isLoading: false,
+    },
+    params
+  );
 };
 
 /// 帮助中心
 const helpCenter = (params) => {
-    return httpJson({
-        url: "/api/cms!list.action",
-        method: "get",
-        isLoading: false
-    }, params)
+  return httpJson(
+    {
+      url: "/api/cms!list.action",
+      method: "get",
+      isLoading: false,
+    },
+    params
+  );
 };
 
 //试用注册登录
 const registerTest = (params) => {
-    return httpJson({
-        url: "/api/localuser!registerTest.action",
-        method: "get",
-        isLoading: true
-    }, params)
+  return requestHttp({
+    url: "api/user/updateUser",
+    method: "post",
+    isLoading: true,
+    data: objectToFormData(params),
+  });
 };
 
-
 const apiList = {
-    getCurrentProjectInfo, registerUser, sendVerifyCode, loginUser, helpCenter, registerTest
-}
+  getCurrentProjectInfo,
+  registerUser,
+  sendVerifyCode,
+  loginUser,
+  helpCenter,
+  registerTest,
+};
 
-export default apiList
+export default apiList;

--
Gitblit v1.9.3