diff --git a/package.json b/package.json index 04c0c09..e756fcf 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "neer-app-h5", "private": true, - "version": "1.0.4", + "version": "1.0.5", "type": "module", "scripts": { "dev": "vite", diff --git a/src/api/index.ts b/src/api/index.ts index 7cee2dd..0a38028 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -43,6 +43,7 @@ export const signUp = ( district?: string; // 二级区域:具体的区域 shareCode: string; // invitation code userName: string; // 用户名称 + password?: string; }, config: AxiosRequestConfig ) => diff --git a/src/api/request.ts b/src/api/request.ts index ada7700..44b358c 100644 --- a/src/api/request.ts +++ b/src/api/request.ts @@ -32,7 +32,7 @@ service.interceptors.request.use( config.headers = { ...config.headers, ...customHeaders, - appVersion: "1.0.4", + appVersion: "1.0.5", } as AxiosRequestHeaders; return config; diff --git a/src/components/EmailForm.tsx b/src/components/EmailForm.tsx index 011c879..cdfe9a3 100644 --- a/src/components/EmailForm.tsx +++ b/src/components/EmailForm.tsx @@ -21,6 +21,8 @@ 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(null); @@ -75,7 +77,7 @@ function EmailForm() { // start(60 * 1000); }, }); - if (res.data.code == 1014) { + if (res.data.code == 1021 || res.data.code == 1015) { SilderVertifyRef.current?._init(); return; } @@ -122,6 +124,7 @@ function EmailForm() { authCode: authCode, shareCode: shareCode || formRef.current?.getFieldValue("shareCode"), userName: "", + password: Md5.hashStr(password), }, config ); @@ -167,11 +170,14 @@ function EmailForm() { type="submit" color="primary" size="large" - onClick={handleSignUp} + // onClick={handleSignUp} > {t("register")} } + onFinish={() => { + handleSignUp(); + }} > setEmail(text)} /> + { + 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(); + }, + }, + ]} + > + setPassword(v)} + /> + + { + if (v != password) { + return Promise.reject(new Error(t("Passwords do not match"))); + } + return Promise.resolve(); + }, + }, + ]} + > + setConfirmPassword(v)} + /> + (null); const gotoSelectCountry = () => { @@ -105,7 +113,7 @@ function PhoneForm() { // start(60 * 1000); }, }); - if (res.data.code == 1014) { + if (res.data.code == 1021 || res.data.code == 1015) { SilderVertifyRef.current?._init(); return; } @@ -151,6 +159,7 @@ function PhoneForm() { authCode: authCode, shareCode: shareCode || formRef.current?.getFieldValue("shareCode"), userName: "", + password: Md5.hashStr(password), }, config ); @@ -195,11 +204,14 @@ function PhoneForm() { type="submit" color="primary" size="large" - onClick={handleSignUp} + // onClick={handleSignUp} > {t("register")} } + onFinish={() => { + handleSignUp(); + }} > + { + 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(); + }, + }, + ]} + > + setPassword(v)} + /> + + { + if (v != password) { + return Promise.reject(new Error(t("Passwords do not match"))); + } + return Promise.resolve(); + }, + }, + ]} + > + setConfirmPassword(v)} + /> + (1); const { previousPathName, UpdatePreviousPathName } = useUserStore(); const navigate = useNavigate(); - const { UpdateLang } = useUserStore(); + const { UpdateLang, UpdateSelectCountry } = useUserStore(); const handleTabs = (num: number) => { return () => { UpdatePreviousPathName("/"); @@ -69,6 +73,8 @@ function SignIn() { i18n.changeLanguage("cn"); setVisible(false); UpdateLang("zh-TW"); + const areaItem = Area.find((v) => v.code == "+86"); + if (areaItem) UpdateSelectCountry(areaItem); }} > 中文(繁体) @@ -100,13 +106,13 @@ function SignIn() {
- {/*
{t("E-mail")} -
*/} +
{t("phone")}
- {/* {selectIndex === 0 && } */} + {selectIndex === 0 && } {selectIndex === 1 && }