Compare commits

..

No commits in common. "84d566b7877ba1e4b958052a8bdb40d60c5b3fd1" and "b0933231700d5b447ad2f3bfb18f633ed6920ec2" have entirely different histories.

8 changed files with 13 additions and 152 deletions

View File

@ -1,7 +1,7 @@
{
"name": "neer-app-h5",
"private": true,
"version": "1.0.5",
"version": "1.0.4",
"type": "module",
"scripts": {
"dev": "vite",

View File

@ -43,7 +43,6 @@ export const signUp = <T>(
district?: string; // 二级区域:具体的区域
shareCode: string; // invitation code
userName: string; // 用户名称
password?: string;
},
config: AxiosRequestConfig
) =>

View File

@ -32,7 +32,7 @@ service.interceptors.request.use(
config.headers = {
...config.headers,
...customHeaders,
appVersion: "1.0.5",
appVersion: "1.0.4",
} as AxiosRequestHeaders;
return config;

View File

@ -21,8 +21,6 @@ function EmailForm() {
const [email, setEmail] = useState("");
const [authCode, setAuthCode] = useState("");
const [shareCode, setShareCode] = useState("");
const [password, setPassword] = useState("");
const [confirmPassword, setConfirmPassword] = useState("");
const [remainingTime, setRemainingTime] = useState(0);
const { Lang } = useUserStore();
const SilderVertifyRef = useRef<SilderVertify_handleType>(null);
@ -77,7 +75,7 @@ function EmailForm() {
// start(60 * 1000);
},
});
if (res.data.code == 1021 || res.data.code == 1015) {
if (res.data.code == 1014) {
SilderVertifyRef.current?._init();
return;
}
@ -124,7 +122,6 @@ function EmailForm() {
authCode: authCode,
shareCode: shareCode || formRef.current?.getFieldValue("shareCode"),
userName: "",
password: Md5.hashStr(password),
},
config
);
@ -170,14 +167,11 @@ function EmailForm() {
type="submit"
color="primary"
size="large"
// onClick={handleSignUp}
onClick={handleSignUp}
>
{t("register")}
</Button>
}
onFinish={() => {
handleSignUp();
}}
>
<Form.Item
name="account"
@ -191,60 +185,6 @@ function EmailForm() {
onChange={(text) => setEmail(text)}
/>
</Form.Item>
<Form.Item
name="password"
rules={[
{
required: true,
message: t("Please enter password"),
},
{
validator: (_, v: string) => {
if (v && (v.length < 6 || v.length > 30)) {
return Promise.reject(
new Error(
t(
"Please ensure your password length is between 6 and 30 characters."
)
)
);
}
return Promise.resolve();
},
},
]}
>
<Input
type="password"
placeholder={t("Please enter password")}
value={password}
onChange={(v) => setPassword(v)}
/>
</Form.Item>
<Form.Item
name="confirmPassword"
rules={[
{
required: true,
message: t("Please enter confirm password"),
},
{
validator: (_, v: string) => {
if (v != password) {
return Promise.reject(new Error(t("Passwords do not match")));
}
return Promise.resolve();
},
},
]}
>
<Input
type="password"
placeholder={t("Please enter confirm password")}
value={confirmPassword}
onChange={(v) => setConfirmPassword(v)}
/>
</Form.Item>
<Form.Item
name="authCode"
rules={[

View File

@ -1,13 +1,7 @@
/*
* @LastEditors: John
* @Date: 2024-06-06 21:23:46
* @LastEditTime: 2024-06-13 16:31:54
* @Author: John
*/
/*
* @LastEditors: John
* @Date: 2024-06-03 18:43:16
* @LastEditTime: 2024-06-13 15:56:56
* @LastEditTime: 2024-06-06 18:59:13
* @Author: John
*/
import { useState, useEffect, useRef } from "react";
@ -55,8 +49,6 @@ function PhoneForm() {
const [authCode, setAuthCode] = useState("");
const [shareCode, setShareCode] = useState("");
const [remainingTime, setRemainingTime] = useState(0);
const [password, setPassword] = useState("");
const [confirmPassword, setConfirmPassword] = useState("");
const SilderVertifyRef = useRef<SilderVertify_handleType>(null);
const gotoSelectCountry = () => {
@ -113,7 +105,7 @@ function PhoneForm() {
// start(60 * 1000);
},
});
if (res.data.code == 1021 || res.data.code == 1015) {
if (res.data.code == 1014) {
SilderVertifyRef.current?._init();
return;
}
@ -159,7 +151,6 @@ function PhoneForm() {
authCode: authCode,
shareCode: shareCode || formRef.current?.getFieldValue("shareCode"),
userName: "",
password: Md5.hashStr(password),
},
config
);
@ -204,14 +195,11 @@ function PhoneForm() {
type="submit"
color="primary"
size="large"
// onClick={handleSignUp}
onClick={handleSignUp}
>
{t("register")}
</Button>
}
onFinish={() => {
handleSignUp();
}}
>
<Form.Item
name="account"
@ -238,58 +226,6 @@ function PhoneForm() {
/>
</div>
</Form.Item>
<Form.Item
name="password"
rules={[
{
required: true,
message: t("Please enter password"),
},
{
validator: (_, v: string) => {
if (v && (v.length < 6 || v.length > 30)) {
return Promise.reject(
new Error(
t("password length is between 6 and 30 characters.")
)
);
}
return Promise.resolve();
},
},
]}
>
<Input
type="password"
placeholder={t("Please enter password")}
value={password}
onChange={(v) => setPassword(v)}
/>
</Form.Item>
<Form.Item
name="confirmPassword"
rules={[
{
required: true,
message: t("Please enter confirm password"),
},
{
validator: (_, v: string) => {
if (v != password) {
return Promise.reject(new Error(t("Passwords do not match")));
}
return Promise.resolve();
},
},
]}
>
<Input
type="password"
placeholder={t("Please enter confirm password")}
value={confirmPassword}
onChange={(v) => setConfirmPassword(v)}
/>
</Form.Item>
<Form.Item
name="authCode"
rules={[

View File

@ -22,9 +22,5 @@
"Send failure": "發送失敗",
"Invalid phone number": "無效手機號碼",
"Invalid email": "無效電子郵件",
"Complete security verification": "完成安全驗證",
"Please enter password": "請輸入密碼",
"Please enter confirm password": "確認密碼",
"password length is between 6 and 30 characters.": "請確保您的密碼長度在6位到30位之間",
"Passwords do not match": "密碼不一致"
"Complete security verification": "完成安全驗證"
}

View File

@ -22,9 +22,5 @@
"Send failure": "Send failure",
"Invalid phone number": "Invalid phone number",
"Invalid email": "Invalid email",
"Complete security verification": "Complete security verification",
"Please enter password": "Please enter password",
"Please enter confirm password": "Please enter confirm password",
"password length is between 6 and 30 characters.": "password length is between 6 and 30 characters.",
"Passwords do not match": "Passwords do not match"
"Complete security verification": "Complete security verification"
}

View File

@ -2,16 +2,12 @@ import { useState, useEffect } from "react";
import { useTranslation, getI18n } from "react-i18next";
import phoneIconSelect from "../assets/iconfont/phone_Select.svg";
import phoneIcon from "../assets/iconfont/phone.svg";
import emailIconSelect from "../assets/iconfont/email_Select.svg";
import emailIcon from "../assets/iconfont/email.svg";
import Logo from "../assets/img/logo.png";
import "./SignIn.scss";
import PhoneForm from "../components/PhoneForm";
import { useNavigate } from "react-router-dom";
import useUserStore from "../store/user.ts";
import { Popover } from "antd-mobile";
import EmailForm from "../components/EmailForm.tsx";
import Area from "../i18n/area/area.json";
function SignIn() {
const { t, i18n } = useTranslation();
@ -21,7 +17,7 @@ function SignIn() {
const [selectIndex, setSelectIndex] = useState<number>(1);
const { previousPathName, UpdatePreviousPathName } = useUserStore();
const navigate = useNavigate();
const { UpdateLang, UpdateSelectCountry } = useUserStore();
const { UpdateLang } = useUserStore();
const handleTabs = (num: number) => {
return () => {
UpdatePreviousPathName("/");
@ -73,8 +69,6 @@ function SignIn() {
i18n.changeLanguage("cn");
setVisible(false);
UpdateLang("zh-TW");
const areaItem = Area.find((v) => v.code == "+86");
if (areaItem) UpdateSelectCountry(areaItem);
}}
>
@ -106,13 +100,13 @@ function SignIn() {
<img src={Logo} alt="" />
</div>
<div className="tabs">
<div
{/* <div
className={`tabs-button ${selectIndex === 0 && "selected"}`}
onClick={handleTabs(0)}
>
<img src={selectIndex === 0 ? emailIconSelect : emailIcon} alt="" />
<span>{t("E-mail")}</span>
</div>
</div> */}
<div
className={`tabs-button ${selectIndex === 1 && "selected"}`}
onClick={handleTabs(1)}
@ -121,7 +115,7 @@ function SignIn() {
<span>{t("phone")}</span>
</div>
</div>
{selectIndex === 0 && <EmailForm></EmailForm>}
{/* {selectIndex === 0 && <EmailForm></EmailForm>} */}
{selectIndex === 1 && <PhoneForm></PhoneForm>}
<div className="to-download">
<p style={{ color: "#999999" }}>