|
@@ -26,7 +26,8 @@ import clsx from "clsx";
|
|
|
import dayjs from "dayjs";
|
|
|
import { useTranslations } from "next-intl";
|
|
|
import { useSearchParams } from "next/navigation";
|
|
|
-import { FC, RefObject, useRef, useState } from "react";
|
|
|
+import { FC, RefObject, useEffect, useRef, useState } from "react";
|
|
|
+import styles from "./style.module.scss";
|
|
|
interface MobileFieldProps {
|
|
|
value?: string;
|
|
|
onChange?: (value: string) => void;
|
|
@@ -133,7 +134,7 @@ interface FormInitStateTypes extends FormProps {
|
|
|
realValue: string;
|
|
|
};
|
|
|
}
|
|
|
-type FormType = "login" | "register";
|
|
|
+export type FormType = "login" | "register";
|
|
|
interface Props {
|
|
|
type?: FormType;
|
|
|
}
|
|
@@ -146,7 +147,7 @@ const FormComponent: FC<Props> = (props) => {
|
|
|
const [statusText, setStatusText] = useState("");
|
|
|
|
|
|
const { eventLogin, eventRegister } = useEventPoint();
|
|
|
-
|
|
|
+ const formRef = useRef<any>(null);
|
|
|
/// 密码可见
|
|
|
const [visible, setVisible] = useState(false);
|
|
|
const spanClassName = clsx("iconfont", {
|
|
@@ -169,6 +170,10 @@ const FormComponent: FC<Props> = (props) => {
|
|
|
referrer_code: undefined,
|
|
|
});
|
|
|
|
|
|
+ useEffect(() => {
|
|
|
+ formRef.current?.resetFields();
|
|
|
+ }, [type]);
|
|
|
+
|
|
|
const onFinish = (values: FormInitStateTypes) => {
|
|
|
const { mobile } = values;
|
|
|
const newValue = {
|
|
@@ -309,17 +314,18 @@ const FormComponent: FC<Props> = (props) => {
|
|
|
}
|
|
|
};
|
|
|
return (
|
|
|
- <Box className={"custom-form"}>
|
|
|
+ <Box className={clsx(styles.loginForm, "custom-form")}>
|
|
|
<Form
|
|
|
style={{
|
|
|
"--border-bottom": "none",
|
|
|
"--border-top": "none",
|
|
|
"--border-inner": "none",
|
|
|
}}
|
|
|
+ ref={formRef}
|
|
|
initialValues={params.current}
|
|
|
onFinish={onFinish}
|
|
|
footer={
|
|
|
- <ButtonOwn active>
|
|
|
+ <ButtonOwn active className={styles.btn}>
|
|
|
{type === "login" ? t("form.loginText") : t("form.registerText")}
|
|
|
</ButtonOwn>
|
|
|
}
|
|
@@ -330,10 +336,13 @@ const FormComponent: FC<Props> = (props) => {
|
|
|
|
|
|
<Form.Item
|
|
|
name="pwd"
|
|
|
- label=""
|
|
|
+ label={
|
|
|
+ <i className="iconfont icon-xiugaimima text-[.18rem] text-[#465461]"></i>
|
|
|
+ }
|
|
|
extra={
|
|
|
<span className={spanClassName} onClick={() => setVisible(!visible)}></span>
|
|
|
}
|
|
|
+ layout="horizontal"
|
|
|
rules={[
|
|
|
{ required: true, message: t("form.passwordReg") },
|
|
|
{ min: 6, max: 20, message: t("form.passwordMinReg") },
|
|
@@ -450,23 +459,19 @@ const FormComponent: FC<Props> = (props) => {
|
|
|
</div>
|
|
|
</>
|
|
|
) : null}
|
|
|
+ <div className="mb-[0.2rem] flex justify-end text-[0.12rem]">
|
|
|
+ {type == "login" && (
|
|
|
+ <>
|
|
|
+ <Link className={"text-[#677787]"} href="/resetPhone">
|
|
|
+ {t("LoginPage.forgetPwd")}
|
|
|
+ </Link>
|
|
|
+ {/* <Link className={"text-[#fff]"} href="/register">
|
|
|
+ {t("LoginPage.registerGo")}
|
|
|
+ </Link> */}
|
|
|
+ </>
|
|
|
+ )}
|
|
|
+ </div>
|
|
|
</Form>
|
|
|
- <div className="mb-[0.2rem] flex justify-between text-[0.12rem]">
|
|
|
- {type == "login" ? (
|
|
|
- <>
|
|
|
- <Link className={"text-[#fff]"} href="/resetPhone">
|
|
|
- {t("LoginPage.forgetPwd")}
|
|
|
- </Link>
|
|
|
- <Link className={"text-[#fff]"} href="/register">
|
|
|
- {t("LoginPage.registerGo")}
|
|
|
- </Link>
|
|
|
- </>
|
|
|
- ) : (
|
|
|
- <Link className={"w-[100%] text-center text-[#fff]"} href="/login" replace>
|
|
|
- {t("LoginPage.loginGo")}
|
|
|
- </Link>
|
|
|
- )}
|
|
|
- </div>
|
|
|
</Box>
|
|
|
);
|
|
|
};
|