|
|
@@ -2,67 +2,68 @@ import React, { useState } from "react";
|
|
|
import { Form, Input, Button, Tabs, message } from "antd";
|
|
|
import Icon from "@ant-design/icons";
|
|
|
import styles from "./login.module.css";
|
|
|
-import { sendCode, loginBySendCode, login } from "../../http/sso";
|
|
|
+// import { sendCode, loginBySendCode, login } from "../../http/sso";
|
|
|
+import { login } from "../../http/sso";
|
|
|
import LogoIcon from "@src/assets/images/login/logo.svg?react";
|
|
|
import GonganIcon from "@src/assets/images/login/gongan.png";
|
|
|
|
|
|
const LoginPage: React.FC = () => {
|
|
|
- const [form] = Form.useForm();
|
|
|
- const [loading, setLoading] = useState(false);
|
|
|
- const [sendingCode, setSendingCode] = useState(false);
|
|
|
- const [countdown, setCountdown] = useState(0);
|
|
|
+ // const [form] = Form.useForm();
|
|
|
+ // const [loading, setLoading] = useState(false);
|
|
|
+ // const [sendingCode, setSendingCode] = useState(false);
|
|
|
+ // const [countdown, setCountdown] = useState(0);
|
|
|
const [accountForm] = Form.useForm();
|
|
|
const [accountLoading, setAccountLoading] = useState(false);
|
|
|
|
|
|
- const handlePhoneLogin = async (values: any) => {
|
|
|
- try {
|
|
|
- setLoading(true);
|
|
|
- const { phone, code } = values;
|
|
|
- const success = await loginBySendCode(phone, code);
|
|
|
- if (success) {
|
|
|
- // Redirect will be handled by the login function
|
|
|
- }
|
|
|
- } catch (error) {
|
|
|
- message.error((error as Error)?.message || "登录失败,请重试");
|
|
|
- } finally {
|
|
|
- setLoading(false);
|
|
|
- }
|
|
|
- };
|
|
|
+ // const handlePhoneLogin = async (values: any) => {
|
|
|
+ // try {
|
|
|
+ // setLoading(true);
|
|
|
+ // const { phone, code } = values;
|
|
|
+ // const success = await loginBySendCode(phone, code);
|
|
|
+ // if (success) {
|
|
|
+ // // Redirect will be handled by the login function
|
|
|
+ // }
|
|
|
+ // } catch (error) {
|
|
|
+ // message.error((error as Error)?.message || "登录失败,请重试");
|
|
|
+ // } finally {
|
|
|
+ // setLoading(false);
|
|
|
+ // }
|
|
|
+ // };
|
|
|
|
|
|
- const handleSendCode = async () => {
|
|
|
- try {
|
|
|
- const phone = form.getFieldValue("phone");
|
|
|
- if (!phone) {
|
|
|
- message.error("请输入手机号");
|
|
|
- return;
|
|
|
- }
|
|
|
- if (!/^1[3-9]\d{9}$/.test(phone)) {
|
|
|
- message.error("请输入正确的手机号");
|
|
|
- return;
|
|
|
- }
|
|
|
+ // const handleSendCode = async () => {
|
|
|
+ // try {
|
|
|
+ // const phone = form.getFieldValue("phone");
|
|
|
+ // if (!phone) {
|
|
|
+ // message.error("请输入手机号");
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // if (!/^1[3-9]\d{9}$/.test(phone)) {
|
|
|
+ // message.error("请输入正确的手机号");
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
|
|
|
- setSendingCode(true);
|
|
|
- const success = await sendCode(phone);
|
|
|
- if (success) {
|
|
|
- let count = 60;
|
|
|
- setCountdown(count);
|
|
|
- const timer = setInterval(() => {
|
|
|
- count -= 1;
|
|
|
- setCountdown(count);
|
|
|
- if (count <= 0) {
|
|
|
- clearInterval(timer);
|
|
|
- setCountdown(0);
|
|
|
- }
|
|
|
- }, 1000);
|
|
|
- }
|
|
|
- } catch (error) {
|
|
|
- message.error(
|
|
|
- (error as Error)?.message || "发送验证码失败,请重试"
|
|
|
- );
|
|
|
- } finally {
|
|
|
- setSendingCode(false);
|
|
|
- }
|
|
|
- };
|
|
|
+ // setSendingCode(true);
|
|
|
+ // const success = await sendCode(phone);
|
|
|
+ // if (success) {
|
|
|
+ // let count = 60;
|
|
|
+ // setCountdown(count);
|
|
|
+ // const timer = setInterval(() => {
|
|
|
+ // count -= 1;
|
|
|
+ // setCountdown(count);
|
|
|
+ // if (count <= 0) {
|
|
|
+ // clearInterval(timer);
|
|
|
+ // setCountdown(0);
|
|
|
+ // }
|
|
|
+ // }, 1000);
|
|
|
+ // }
|
|
|
+ // } catch (error) {
|
|
|
+ // message.error(
|
|
|
+ // (error as Error)?.message || "发送验证码失败,请重试"
|
|
|
+ // );
|
|
|
+ // } finally {
|
|
|
+ // setSendingCode(false);
|
|
|
+ // }
|
|
|
+ // };
|
|
|
|
|
|
const handleAccountLogin = async (values: any) => {
|
|
|
try {
|