|
@@ -34,9 +34,11 @@ import SmallLoading from "@components/SmallLoading";
|
|
|
import {REQ_STATUS} from "@api/config";
|
|
import {REQ_STATUS} from "@api/config";
|
|
|
import {reqForgetPass, reqLogin, reqRegister, reqSendCode, reqSMSLogin} from "@features/api";
|
|
import {reqForgetPass, reqLogin, reqRegister, reqSendCode, reqSMSLogin} from "@features/api";
|
|
|
import {ROUTE_PATH} from "@constants/routes";
|
|
import {ROUTE_PATH} from "@constants/routes";
|
|
|
-import {APP_THEME} from "@constants/app";
|
|
|
|
|
|
|
+import {APP_LOGIN_TYPE, APP_THEME} from "@constants/app";
|
|
|
import {validateCountryPhone} from "@utils/helpers";
|
|
import {validateCountryPhone} from "@utils/helpers";
|
|
|
import {CircularProgress} from "@mui/material";
|
|
import {CircularProgress} from "@mui/material";
|
|
|
|
|
+import area from "@db/area";
|
|
|
|
|
+import SvgIcon from "@components/SvgIcon";
|
|
|
|
|
|
|
|
const i18n=global.i18n;
|
|
const i18n=global.i18n;
|
|
|
const TYPE_LOGIN="login";
|
|
const TYPE_LOGIN="login";
|
|
@@ -193,11 +195,49 @@ const LoginForm = ({close}) => {
|
|
|
objInfo.inSubmit=true;
|
|
objInfo.inSubmit=true;
|
|
|
}
|
|
}
|
|
|
const onSubmitAccountLogin=(data)=>{
|
|
const onSubmitAccountLogin=(data)=>{
|
|
|
-
|
|
|
|
|
|
|
+ if (loginStatus===REQ_STATUS.LOADING)return;
|
|
|
|
|
+ if (objInfo.inSubmit)return;
|
|
|
|
|
+ // acc_account:"",
|
|
|
|
|
+ // acc_password:"",
|
|
|
|
|
+ // acc_repassword:""
|
|
|
|
|
+ //data.type=APP_LOGIN_TYPE.ID;
|
|
|
|
|
+ let ndata={
|
|
|
|
|
+ account:data.acc_account,
|
|
|
|
|
+ password:data.acc_password,
|
|
|
|
|
+ type:APP_LOGIN_TYPE.ID
|
|
|
|
|
+ }
|
|
|
|
|
+ ndata.callback=onCallback;
|
|
|
|
|
+ dispatch(reqLogin(ndata));
|
|
|
|
|
+ objInfo.inSubmit=true;
|
|
|
|
|
+ }
|
|
|
|
|
+ const onSubmitAccountReg=(data)=>{
|
|
|
|
|
+ if (regStatus===REQ_STATUS.LOADING)return;
|
|
|
|
|
+ if (objInfo.inSubmit)return;
|
|
|
|
|
+ let ndata={
|
|
|
|
|
+ account:data.acc_account,
|
|
|
|
|
+ password:data.acc_password,
|
|
|
|
|
+ repassword:data.acc_repassword,
|
|
|
|
|
+ type:APP_LOGIN_TYPE.ID
|
|
|
|
|
+ }
|
|
|
|
|
+ ndata.callback=onCallback;
|
|
|
|
|
+ dispatch(reqRegister(ndata));
|
|
|
|
|
+ objInfo.inSubmit=true;
|
|
|
}
|
|
}
|
|
|
const validatePhone=(value)=>{
|
|
const validatePhone=(value)=>{
|
|
|
return validateCountryPhone(country,value);
|
|
return validateCountryPhone(country,value);
|
|
|
}
|
|
}
|
|
|
|
|
+ const getAreaItem=()=>{
|
|
|
|
|
+ let areaID=global.getLocalAreaID();
|
|
|
|
|
+ let item=null;
|
|
|
|
|
+ for (let i = 0; i < area.length; i++) {
|
|
|
|
|
+ let aitem=area[i];
|
|
|
|
|
+ if (aitem.id===areaID){
|
|
|
|
|
+ item=aitem;
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return item;
|
|
|
|
|
+ }
|
|
|
const renderLoading=()=>{
|
|
const renderLoading=()=>{
|
|
|
return (<SmallLoading fill={"#fff"}/>)
|
|
return (<SmallLoading fill={"#fff"}/>)
|
|
|
}
|
|
}
|
|
@@ -208,21 +248,36 @@ const LoginForm = ({close}) => {
|
|
|
</div>
|
|
</div>
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
+ const renderAreaSelect=()=>{
|
|
|
|
|
+ let item=getAreaItem();
|
|
|
|
|
+ if (item==null)return (<></>);
|
|
|
|
|
+ return (
|
|
|
|
|
+ <button type={"button"} className={styles.area_btn} onClick={()=>{
|
|
|
|
|
+ global.showAreaSelect();
|
|
|
|
|
+ }}>
|
|
|
|
|
+ <span>{i18n.t(item.name)}</span>
|
|
|
|
|
+ <SvgIcon className={styles.icon} herf={"icon_Arrow"}></SvgIcon>
|
|
|
|
|
+ </button>
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
const renderLoginToReg=()=>{
|
|
const renderLoginToReg=()=>{
|
|
|
return (
|
|
return (
|
|
|
- <div className={styles.l_reg_new}>
|
|
|
|
|
- <div>{i18n.t("login.reg_new_des")}</div>
|
|
|
|
|
- <div className={styles.reg_btn} onClick={() => {
|
|
|
|
|
- // setShowType(TYPE_REGISTER);
|
|
|
|
|
- if (isMobile()) navigatRoute(ROUTE_PATH.SIGN_UP)
|
|
|
|
|
- else setShowType(TYPE_REGISTER);
|
|
|
|
|
- }}>
|
|
|
|
|
- {i18n.t("sign_up")}
|
|
|
|
|
|
|
+ <div className={"d-flex flex-row align-items-center justify-content-between"}>
|
|
|
|
|
+ <div className={styles.l_reg_new}>
|
|
|
|
|
+ <div>{i18n.t("login.reg_new_des")}</div>
|
|
|
|
|
+ <div className={styles.reg_btn} onClick={() => {
|
|
|
|
|
+ // setShowType(TYPE_REGISTER);
|
|
|
|
|
+ if (isMobile()) navigatRoute(ROUTE_PATH.SIGN_UP)
|
|
|
|
|
+ else setShowType(TYPE_REGISTER);
|
|
|
|
|
+ }}>
|
|
|
|
|
+ {i18n.t("sign_up")}
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+ {renderAreaSelect()}
|
|
|
</div>
|
|
</div>
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
- const renderGuestLogin=()=>{
|
|
|
|
|
|
|
+ const renderGuestLogin = () => {
|
|
|
// return (
|
|
// return (
|
|
|
// <button type={"button"} className={styles.guest_btn}>
|
|
// <button type={"button"} className={styles.guest_btn}>
|
|
|
// {i18n.t("login.guest_login")}
|
|
// {i18n.t("login.guest_login")}
|
|
@@ -451,15 +506,18 @@ const LoginForm = ({close}) => {
|
|
|
//register_______________
|
|
//register_______________
|
|
|
const renderRegToLogin=()=>{
|
|
const renderRegToLogin=()=>{
|
|
|
return (
|
|
return (
|
|
|
- <div className={styles.l_reg_new}>
|
|
|
|
|
- <div>{i18n.t("login.login_des")}</div>
|
|
|
|
|
- <div className={styles.reg_btn} onClick={() => {
|
|
|
|
|
- // setShowType(TYPE_LOGIN);
|
|
|
|
|
- if (isMobile()) navigatRoute(ROUTE_PATH.SIGN_IN)
|
|
|
|
|
- else setShowType(TYPE_LOGIN);
|
|
|
|
|
- }}>
|
|
|
|
|
- {i18n.t("login.sign_in_btn")}
|
|
|
|
|
|
|
+ <div className={"d-flex flex-row align-items-center justify-content-between"}>
|
|
|
|
|
+ <div className={styles.l_reg_new}>
|
|
|
|
|
+ <div>{i18n.t("login.login_des")}</div>
|
|
|
|
|
+ <div className={styles.reg_btn} onClick={() => {
|
|
|
|
|
+ // setShowType(TYPE_LOGIN);
|
|
|
|
|
+ if (isMobile()) navigatRoute(ROUTE_PATH.SIGN_IN)
|
|
|
|
|
+ else setShowType(TYPE_LOGIN);
|
|
|
|
|
+ }}>
|
|
|
|
|
+ {i18n.t("login.sign_in_btn")}
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+ {renderAreaSelect()}
|
|
|
</div>
|
|
</div>
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
@@ -524,6 +582,7 @@ const LoginForm = ({close}) => {
|
|
|
return (
|
|
return (
|
|
|
<form key={"reg_account"} autoComplete="off" className={styles.l_form} onSubmit={handleSubmit((data) => {
|
|
<form key={"reg_account"} autoComplete="off" className={styles.l_form} onSubmit={handleSubmit((data) => {
|
|
|
// onSubmitReg(data);
|
|
// onSubmitReg(data);
|
|
|
|
|
+ onSubmitAccountReg(data);
|
|
|
})}>
|
|
})}>
|
|
|
<Controller control={control}
|
|
<Controller control={control}
|
|
|
name="acc_account"
|
|
name="acc_account"
|