From 19994b680cc1981a806ce749ee8f326b5e219d71 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=A6=BA=E7=8B=A8?= <18119604035@163.com>
Date: Mon, 3 Jul 2023 14:16:13 +0800
Subject: [PATCH 1/6] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E9=85=8D=E7=BD=AE?=
=?UTF-8?q?=E5=A2=9E=E5=8A=A0pc=E9=87=91=E9=A2=9Dh5URl?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/pages/system/config/index.tsx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/pages/system/config/index.tsx b/src/pages/system/config/index.tsx
index 3d20988..4fce7e1 100644
--- a/src/pages/system/config/index.tsx
+++ b/src/pages/system/config/index.tsx
@@ -308,7 +308,7 @@ const SystemConfigPage = () => {
placeholder="请填写网站页脚"
/>
- {/*
+
{
name="system.h5_url"
>
- */}
+
Date: Mon, 3 Jul 2023 15:50:17 +0800
Subject: [PATCH 2/6] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E9=AA=8C=E8=AF=81?=
=?UTF-8?q?=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/login.ts | 9 +-----
src/pages/login/index.tsx | 63 ++-------------------------------------
2 files changed, 3 insertions(+), 69 deletions(-)
diff --git a/src/api/login.ts b/src/api/login.ts
index 43e0290..66e7324 100644
--- a/src/api/login.ts
+++ b/src/api/login.ts
@@ -1,16 +1,9 @@
import client from "./internal/httpClient";
-export function login(
- email: string,
- password: string,
- captchaKey: string,
- captchaVal: string
-) {
+export function login(email: string, password: string) {
return client.post("/backend/v1/auth/login", {
email: email,
password: password,
- captcha_key: captchaKey,
- captcha_value: captchaVal,
});
}
diff --git a/src/pages/login/index.tsx b/src/pages/login/index.tsx
index f3fe4d7..a7eefb4 100644
--- a/src/pages/login/index.tsx
+++ b/src/pages/login/index.tsx
@@ -1,6 +1,6 @@
import { useState, useEffect } from "react";
import styles from "./index.module.less";
-import { Spin, Input, Button, message } from "antd";
+import { Input, Button, message } from "antd";
import { login as loginApi, system } from "../../api/index";
import { setToken } from "../../utils/index";
import { useDispatch } from "react-redux";
@@ -18,22 +18,8 @@ const LoginPage = () => {
const dispatch = useDispatch();
const navigate = useNavigate();
const [loading, setLoading] = useState(false);
- const [image, setImage] = useState("");
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
- const [captchaVal, setCaptchaVal] = useState("");
- const [captchaKey, setCaptchaKey] = useState("");
- const [captchaLoading, setCaptchaLoading] = useState(true);
-
- const fetchImageCaptcha = () => {
- setCaptchaVal("");
- setCaptchaLoading(true);
- system.getImageCaptcha().then((res: any) => {
- setImage(res.data.image);
- setCaptchaKey(res.data.key);
- setCaptchaLoading(false);
- });
- };
const loginSubmit = async () => {
if (!email) {
@@ -44,14 +30,6 @@ const LoginPage = () => {
message.error("请输入密码");
return;
}
- if (!captchaVal) {
- message.error("请输入图形验证码");
- return;
- }
- if (captchaVal.length !== 4) {
- message.error("图形验证码错误");
- return;
- }
await handleSubmit();
};
@@ -61,12 +39,7 @@ const LoginPage = () => {
}
setLoading(true);
try {
- let res: any = await loginApi.login(
- email,
- password,
- captchaKey,
- captchaVal
- );
+ let res: any = await loginApi.login(email, password);
setToken(res.data.token); //将token写入本地
await getSystemConfig(); //获取系统配置并写入store
await getUser(); //获取登录用户的信息并写入store
@@ -75,7 +48,6 @@ const LoginPage = () => {
} catch (e) {
console.error("错误信息", e);
setLoading(false);
- fetchImageCaptcha(); //刷新图形验证码
}
};
@@ -104,10 +76,6 @@ const LoginPage = () => {
}
};
- useEffect(() => {
- fetchImageCaptcha();
- }, []);
-
return (
@@ -142,33 +110,6 @@ const LoginPage = () => {
placeholder="请输入密码"
/>
-
-
{
- setCaptchaVal(e.target.value);
- }}
- allowClear
- onKeyUp={(e) => keyUp(e)}
- />
-
- {captchaLoading && (
-
-
-
- )}
-
- {!captchaLoading && (
-

- )}
-
-