From 64187eb2f69e8152bfeca4a4aed5630199005065 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 15:29:31 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E5=BD=95=E9=AA=8C=E8=AF=81=E7=A0=81?= =?UTF-8?q?=E5=8E=BB=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/login.ts | 9 +---- src/pages/course/video.module.scss | 5 --- src/pages/login/index.tsx | 55 ++---------------------------- 3 files changed, 3 insertions(+), 66 deletions(-) diff --git a/src/api/login.ts b/src/api/login.ts index 0ff7cce..8b41e40 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("/api/v1/auth/login/password", { email: email, password: password, - captcha_key: captchaKey, - captcha_val: captchaVal, }); } diff --git a/src/pages/course/video.module.scss b/src/pages/course/video.module.scss index cd7fc84..40cffce 100644 --- a/src/pages/course/video.module.scss +++ b/src/pages/course/video.module.scss @@ -22,11 +22,6 @@ height: auto; position: relative; .alert-message { - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; width: 100%; height: 211px; background: rgba(0, 0, 0); diff --git a/src/pages/login/index.tsx b/src/pages/login/index.tsx index 075ab8c..131e162 100644 --- a/src/pages/login/index.tsx +++ b/src/pages/login/index.tsx @@ -19,27 +19,14 @@ const LoginPage = () => { 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 [bodyHeight, setBodyHeight] = useState(0); useEffect(() => { - fetchImageCaptcha(); document.title = "登录"; let value = document.documentElement.clientHeight; setBodyHeight(value); }, []); - const fetchImageCaptcha = () => { - setCaptchaLoading(true); - system.imageCaptcha().then((res: any) => { - setImage(res.data.image); - setCaptchaKey(res.data.key); - setCaptchaLoading(false); - }); - }; - const loginSubmit = async (e: any) => { if (!email) { Toast.show({ @@ -53,18 +40,6 @@ const LoginPage = () => { }); return; } - if (!captchaVal) { - Toast.show({ - content: "请输入图形验证码", - }); - return; - } - if (captchaVal.length < 4) { - Toast.show({ - content: "图形验证码错误", - }); - return; - } await handleSubmit(); }; @@ -74,7 +49,7 @@ const LoginPage = () => { } setLoading(true); try { - let res: any = await login.login(email, password, captchaKey, captchaVal); + let res: any = await login.login(email, password); setToken(res.data.token); //将token写入本地 await getSystemConfig(); //获取系统配置并写入store await getUser(); //获取登录用户的信息并写入store @@ -83,8 +58,6 @@ const LoginPage = () => { } catch (e) { console.error("错误信息", e); setLoading(false); - setCaptchaVal(""); - fetchImageCaptcha(); //刷新图形验证码 } }; @@ -155,34 +128,10 @@ const LoginPage = () => { }} /> -
- { - setCaptchaVal(val); - }} - /> -
- {captchaLoading && ( -
- -
- )} - {!captchaLoading && ( - - )} -
-