|
@@ -6,8 +6,10 @@ import HeaderBack from "@/components/HeaderBack";
|
|
|
import { useRouter } from "@/i18n";
|
|
|
import { Toast } from "antd-mobile";
|
|
|
import { useSearchParams } from "next/navigation";
|
|
|
-import { FC, useMemo, useState } from "react";
|
|
|
+import { FC, useEffect, useMemo, useState } from "react";
|
|
|
+import { getSendCodeApi } from "@/api/user";
|
|
|
import "./page.scss";
|
|
|
+import { useGlobalStore } from "@/stores";
|
|
|
|
|
|
interface Props {}
|
|
|
|
|
@@ -23,6 +25,21 @@ const ResetPhone: FC<Props> = () => {
|
|
|
againPwd: "",
|
|
|
});
|
|
|
|
|
|
+ let alter = searchParams.get("alter");
|
|
|
+ const sendCodeRequest = () => {
|
|
|
+ if (!user_phone) return;
|
|
|
+ getSendCodeApi({ user_phone }).then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ setMsgError(res.msg);
|
|
|
+ });
|
|
|
+ };
|
|
|
+ useEffect(() => {
|
|
|
+ alter && sendCodeRequest()
|
|
|
+ // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
+ },[alter])
|
|
|
+
|
|
|
const setInputVal = (e: { target: { name: any; value: any } }) => {
|
|
|
const { name, value } = e.target;
|
|
|
setFromParam({
|
|
@@ -45,6 +62,7 @@ const ResetPhone: FC<Props> = () => {
|
|
|
return false;
|
|
|
}, [fromParam]);
|
|
|
|
|
|
+ const { setToken, setUserInfo } = useGlobalStore();
|
|
|
let [msgError, setMsgError] = useState("");
|
|
|
const findPwdRequest = () => {
|
|
|
let { pwd, againPwd } = fromParam;
|
|
@@ -56,6 +74,8 @@ const ResetPhone: FC<Props> = () => {
|
|
|
setMsgError(res.msg || "");
|
|
|
if (res.code == 200) {
|
|
|
Toast.show({ icon: "success", content: "修改成功", maskClickable: false });
|
|
|
+ setUserInfo('')
|
|
|
+ setToken('')
|
|
|
setTimeout(() => {
|
|
|
router.replace("/login");
|
|
|
}, 1000);
|
|
@@ -68,8 +88,8 @@ const ResetPhone: FC<Props> = () => {
|
|
|
<HeaderBack />
|
|
|
<div className="main">
|
|
|
<div className="title">
|
|
|
- <h2>Ativa a sua conta por entrar a Senha de Verificação!</h2>
|
|
|
- <div>A senha de verificação foi enviado para o teu telemóvel 16982013895</div>
|
|
|
+ <h2>Mudar a Contrasinha</h2>
|
|
|
+ {/* <div>修改密码 {user_phone}</div> */}
|
|
|
</div>
|
|
|
<div className="phoneInput">
|
|
|
<input
|
|
@@ -78,7 +98,7 @@ const ResetPhone: FC<Props> = () => {
|
|
|
value={fromParam.pwd}
|
|
|
onChange={setInputVal}
|
|
|
onInput={verifyPwd}
|
|
|
- placeholder="Senha"
|
|
|
+ placeholder="Por favor, introduz uma nova senha"
|
|
|
maxLength={12}
|
|
|
/>
|
|
|
</div>
|
|
@@ -88,7 +108,7 @@ const ResetPhone: FC<Props> = () => {
|
|
|
type="password"
|
|
|
value={fromParam.againPwd}
|
|
|
onChange={setInputVal}
|
|
|
- placeholder="Senha"
|
|
|
+ placeholder="Por favor, introduz a nova senha novamente"
|
|
|
maxLength={12}
|
|
|
/>
|
|
|
</div>
|