diff --git a/src/auth/utils.js b/src/auth/utils.js index 442053c..2e18ea2 100644 --- a/src/auth/utils.js +++ b/src/auth/utils.js @@ -7,10 +7,10 @@ import useJwt from 'auth/jwt/coreUseJwt'; */ // eslint-disable-next-line arrow-body-style export const hostname = 'localhost'; -const hostPort = '8080'; +const hostPort = '8090'; export const hostPath = `http://${hostname}:${hostPort}`; export const apiPath = `${hostPath}/api`; -//export const apiPath = `/api`; +// export const apiPath = `/api`; export const isUserLoggedIn = () => { return localStorage.getItem('userData') && localStorage.getItem(useJwt.jwtConfig.storageTokenKeyName); diff --git a/src/pages/authentication/BusRegister.js b/src/pages/authentication/BusRegister.js index 4cd86b0..128bebd 100644 --- a/src/pages/authentication/BusRegister.js +++ b/src/pages/authentication/BusRegister.js @@ -163,13 +163,13 @@ {activeStep === totalSteps() - 2 ? ( ) : ( activeStep === totalSteps() - 1 ? ( ): ( diff --git a/src/pages/authentication/Register.js b/src/pages/authentication/Register.js index 0e671dc..f9885c3 100644 --- a/src/pages/authentication/Register.js +++ b/src/pages/authentication/Register.js @@ -69,6 +69,7 @@ }; const handleNext = () => { + scrollToTop() const newActiveStep = isLastStep() && !allStepsCompleted() ? // It's the last step, but not all steps have been completed, @@ -76,24 +77,17 @@ steps.findIndex((step, i) => !(i in completed)) : activeStep + 1; setActiveStep(newActiveStep); - console.log(newActiveStep) - + // console.log(newActiveStep) }; const handleBack = () => { + scrollToTop() setActiveStep((prevActiveStep) => prevActiveStep - 1); }; - // const handleStep = (step) => () => { - // setActiveStep(step); - // }; - - // const handleComplete = () => { - // const newCompleted = completed; - // newCompleted[activeStep] = true; - // setCompleted(newCompleted); - // handleNext(); - // }; + const scrollToTop = () => { + window.scrollTo({ top: 0, left: 0, behavior: 'smooth' }); + }; const handleReset = () => { setActiveStep(0); @@ -166,13 +160,13 @@ {activeStep === totalSteps() - 2 ? ( ) : ( activeStep === totalSteps() - 1 ? ( ): ( diff --git a/src/pages/authentication/auth-forms/BusCustomFormWizard.js b/src/pages/authentication/auth-forms/BusCustomFormWizard.js index ceaf032..f463a56 100644 --- a/src/pages/authentication/auth-forms/BusCustomFormWizard.js +++ b/src/pages/authentication/auth-forms/BusCustomFormWizard.js @@ -32,6 +32,7 @@ import axios from "axios"; import {POST_PUBLIC_USER_REGISTER} from "utils/ApiPathConst"; import * as HttpUtils from 'utils/HttpUtils'; import UploadFileTable from './UploadFileTable'; +import LoadingComponent from "../../extra-pages/LoadingComponent"; // assets import { EyeInvisibleOutlined, EyeOutlined } from '@ant-design/icons'; @@ -50,6 +51,7 @@ const BusCustomFormWizard = (props) => { const [fileList, setFileList] = useState([]); const [fileListData, setFileListData] = useState([]); const [checkUpload, setCheckUpload] = useState(false); + const [isLoading, setLoding] = useState(true); const handleClickShowPassword = () => { setShowPassword(!showPassword); @@ -164,6 +166,7 @@ const BusCustomFormWizard = (props) => { const {handleSubmit} = useForm({}) const _onSubmit = () => { + setLoding(true); values.address4 = selectedAddress4 values.address5 = selectedAddress5 // console.log(values) @@ -222,6 +225,7 @@ const BusCustomFormWizard = (props) => { file: fileList[0], onSuccess: (response)=>{ console.log(response); + setLoding(false); // setOpen(true); } } @@ -229,7 +233,10 @@ const BusCustomFormWizard = (props) => { }) .catch(error => { console.error(error); + setLoding(false); }); + }else{ + setLoding(false); } } @@ -261,13 +268,14 @@ const BusCustomFormWizard = (props) => { } function handleEmail(email) { - var reg = /^\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,3}$/; - var result = reg.test(email); - - if (result == false) { - return false; - } - return true; + var validRegex = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/; + // var result = reg.test(email); + var result = email.match(validRegex); + console.log("test1: "+result) + if (result == false) { + return false; + } + return true; } const formik = useFormik({ @@ -824,7 +832,7 @@ const BusCustomFormWizard = (props) => { name="phoneCountryCode" // onBlur={formik.handleBlur} onChange={formik.handleChange} - placeholder="eg:852" + placeholder="國際區號" error={Boolean(formik.touched.phone && formik.errors.phone)} onBlur={formik.handleBlur} inputProps={{ @@ -880,7 +888,7 @@ const BusCustomFormWizard = (props) => { name="faxCountryCode" // onBlur={formik.handleBlur} onChange={formik.handleChange} - placeholder="eg:852" + placeholder="國際區號" inputProps={{ maxLength: 3, onKeyDown: (e) => { @@ -928,7 +936,7 @@ const BusCustomFormWizard = (props) => { - - : - // ERROR page - - {/* */} - - 申請失敗,請稍後嘗試 - - - } - + {isLoading ? + : + + {checkUpload? + // SUCCESS page + + + 帳戶申請已成功提交。 + 驗證電郵將發送到你的電郵地址,請要指示完成驗證及登入系統。 + + + : + // ERROR page + + {/* */} + + 申請失敗,請稍後嘗試 + + + } + + } diff --git a/src/pages/authentication/auth-forms/CustomFormWizard.js b/src/pages/authentication/auth-forms/CustomFormWizard.js index 8fa130d..a1d21bd 100644 --- a/src/pages/authentication/auth-forms/CustomFormWizard.js +++ b/src/pages/authentication/auth-forms/CustomFormWizard.js @@ -275,14 +275,14 @@ const CustomFormWizard = (props) => { } function handleEmail(email) { - var validRegex = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/; - // var result = reg.test(email); - var result = email.match(validRegex); - console.log("test1: "+result) - if (result == false) { - return false; - } - return true; + var validRegex = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/; + // var result = reg.test(email); + var result = email.match(validRegex); + console.log("test1: "+result) + if (result == false) { + return false; + } + return true; } const formik = useFormik({ @@ -503,7 +503,7 @@ const CustomFormWizard = (props) => { - 你的個人資料 + 你的個人資料 {/* Already have an account? */} @@ -534,6 +534,9 @@ const CustomFormWizard = (props) => { onBlur={formik.handleBlur} onChange={(event, newValue) => { setSelectedIdDocType(newValue); + if (newValue!="HKID"){ + formik.setFieldValue("checkDigit","") + } }} sx={{"& .MuiInputBase-root": { height: "41px" },"#idDocType":{padding: "0px 0px 0px 0px"}, "& .MuiAutocomplete-endAdornment": { top: "auto" },}} renderInput={(params) => } @@ -877,7 +880,7 @@ const CustomFormWizard = (props) => { name="phoneCountryCode" // onBlur={formik.handleBlur} onChange={formik.handleChange} - placeholder="eg:852" + placeholder="國際區號" error={Boolean(formik.touched.phone && formik.errors.phone)} onBlur={formik.handleBlur} inputProps={{ @@ -933,7 +936,7 @@ const CustomFormWizard = (props) => { value={formik.values.faxCountryCode} name="faxCountryCode" onChange={formik.handleChange} - placeholder="eg:852" + placeholder="國際區號" onBlur={formik.handleBlur} inputProps={{ maxLength: 3, @@ -980,7 +983,7 @@ const CustomFormWizard = (props) => {