| @@ -1,5 +1,5 @@ | |||||
| body{ | body{ | ||||
| padding-top: 43px; | |||||
| padding-top: 53px; | |||||
| font-family: 微軟正黑體; | font-family: 微軟正黑體; | ||||
| } | } | ||||
| /* main{ | /* main{ | ||||
| @@ -4,7 +4,7 @@ import { useDispatch, useSelector } from 'react-redux'; | |||||
| // material-ui | // material-ui | ||||
| import { useTheme } from '@mui/material/styles'; | import { useTheme } from '@mui/material/styles'; | ||||
| import { Box, Toolbar, useMediaQuery } from '@mui/material'; | |||||
| import { Box, useMediaQuery } from '@mui/material'; | |||||
| // import { Toolbar, useMediaQuery } from '@mui/material'; | // import { Toolbar, useMediaQuery } from '@mui/material'; | ||||
| // project import | // project import | ||||
| @@ -17,7 +17,7 @@ import Footer from 'components/cards/AuthFooter'; | |||||
| // types | // types | ||||
| import { openDrawer } from 'store/reducers/menu'; | import { openDrawer } from 'store/reducers/menu'; | ||||
| // import "assets/style/styles.css"; | |||||
| import "assets/style/styles.css"; | |||||
| // ==============================|| MAIN LAYOUT ||============================== // | // ==============================|| MAIN LAYOUT ||============================== // | ||||
| @@ -54,7 +54,7 @@ const MainLayout = () => { | |||||
| <Header/> | <Header/> | ||||
| {/* <Drawer open={open} handleDrawerToggle={handleDrawerToggle} /> */} | {/* <Drawer open={open} handleDrawerToggle={handleDrawerToggle} /> */} | ||||
| <div style={{ width: '100%', flexGrow: 1, p: { xs: 2, sm: 3 } }}> | <div style={{ width: '100%', flexGrow: 1, p: { xs: 2, sm: 3 } }}> | ||||
| <Toolbar /> | |||||
| {/* <Toolbar /> */} | |||||
| {/* <Breadcrumbs navigation={navigation} title /> */} | {/* <Breadcrumbs navigation={navigation} title /> */} | ||||
| <Outlet /> | <Outlet /> | ||||
| </div> | </div> | ||||
| @@ -20,7 +20,7 @@ const BackgroundHead = { | |||||
| width: '100%', | width: '100%', | ||||
| height: '100%', | height: '100%', | ||||
| backgroundSize:'cover' | backgroundSize:'cover' | ||||
| } | |||||
| } | |||||
| // ==============================|| AUTHENTICATION - WRAPPER ||============================== // | // ==============================|| AUTHENTICATION - WRAPPER ||============================== // | ||||
| @@ -57,6 +57,7 @@ const AuthLoginCustom = () => { | |||||
| const [isValid, setisValid] = useState(false); | const [isValid, setisValid] = useState(false); | ||||
| const [open, setOpen] = React.useState(false); | const [open, setOpen] = React.useState(false); | ||||
| const [isButtonDisabled, setIsButtonDisabled] = useState(true); | const [isButtonDisabled, setIsButtonDisabled] = useState(true); | ||||
| const [errorMassage, setErrorMassage] = useState(''); | |||||
| const handleMouseDownPassword = (event) => { | const handleMouseDownPassword = (event) => { | ||||
| event.preventDefault(); | event.preventDefault(); | ||||
| @@ -68,7 +69,7 @@ const AuthLoginCustom = () => { | |||||
| useJwt | useJwt | ||||
| .login({username: values.username, password: values.password}) | .login({username: values.username, password: values.password}) | ||||
| .then((response) => { | .then((response) => { | ||||
| console.log("123") | |||||
| // console.log("123") | |||||
| const userData = { | const userData = { | ||||
| id: response.data.id, | id: response.data.id, | ||||
| fullenName: response.data.name, | fullenName: response.data.name, | ||||
| @@ -87,8 +88,10 @@ const AuthLoginCustom = () => { | |||||
| }) | }) | ||||
| .catch((error) => { | .catch((error) => { | ||||
| // setSuccess(false) | // setSuccess(false) | ||||
| setOpen(true) | |||||
| console.error(error) | console.error(error) | ||||
| console.error(error.response.data.error) | |||||
| setErrorMassage(error.response.data.error) | |||||
| setOpen(true) | |||||
| console.log("321") | console.log("321") | ||||
| }); | }); | ||||
| }else{ | }else{ | ||||
| @@ -271,7 +274,7 @@ const AuthLoginCustom = () => { | |||||
| </Stack> | </Stack> | ||||
| </Grid> | </Grid> | ||||
| </Grid> | </Grid> | ||||
| <PasswordAlertDialog open={open} handleClose={handleClose}/> | |||||
| <PasswordAlertDialog open={open} handleClose={handleClose} errorMassage={errorMassage}/> | |||||
| </form> | </form> | ||||
| </FormikProvider> | </FormikProvider> | ||||
| ); | ); | ||||
| @@ -117,7 +117,8 @@ const BusCustomFormWizard = (props) => { | |||||
| fileList.length!==0&& | fileList.length!==0&& | ||||
| handlePassword(data.password)&& | handlePassword(data.password)&& | ||||
| handleEmail(data.email)&& | handleEmail(data.email)&& | ||||
| handlePhone(data.phone) | |||||
| handlePhone(data.phone)&& | |||||
| handleUserName(data.username) | |||||
| ) | ) | ||||
| { | { | ||||
| setisValid(true) | setisValid(true) | ||||
| @@ -307,6 +308,14 @@ const BusCustomFormWizard = (props) => { | |||||
| } | } | ||||
| } | } | ||||
| function handleUserName(username) { | |||||
| if (username.length < 6) { | |||||
| return false; | |||||
| } else { | |||||
| return true; | |||||
| } | |||||
| } | |||||
| function handlePassword(password) { | function handlePassword(password) { | ||||
| let new_pass = password; | let new_pass = password; | ||||
| // regular expressions to validate password | // regular expressions to validate password | ||||
| @@ -123,7 +123,7 @@ const CustomFormWizard = (props) => { | |||||
| handleEmail(data.email)&& | handleEmail(data.email)&& | ||||
| handleIdNo(data.idNo,selectedIdDocType.type)&& | handleIdNo(data.idNo,selectedIdDocType.type)&& | ||||
| handle8Digi(data.phone)&& | handle8Digi(data.phone)&& | ||||
| handle8Digi(data.username) | |||||
| handle6Digi(data.username) | |||||
| ) | ) | ||||
| { | { | ||||
| setisValid(true) | setisValid(true) | ||||
| @@ -317,6 +317,14 @@ const CustomFormWizard = (props) => { | |||||
| } | } | ||||
| } | } | ||||
| function handle6Digi(value) { | |||||
| if (value.length < 6) { | |||||
| return false; | |||||
| } else { | |||||
| return true; | |||||
| } | |||||
| } | |||||
| function handleIdNo(idNo,selectedIdDocType) { | function handleIdNo(idNo,selectedIdDocType) { | ||||
| var upperCase = /[A-Z]/g; | var upperCase = /[A-Z]/g; | ||||
| if (!idNo.match(upperCase)&&selectedIdDocType=="HKID") { | if (!idNo.match(upperCase)&&selectedIdDocType=="HKID") { | ||||
| @@ -28,7 +28,19 @@ const PasswordAlertDialog = (props) => { | |||||
| <DialogTitle id="alert-dialog-title"> | <DialogTitle id="alert-dialog-title"> | ||||
| <Stack mt={1} mr={4} direction="row" justifyContent="flex-start" alignItems="center" spacing={2}> | <Stack mt={1} mr={4} direction="row" justifyContent="flex-start" alignItems="center" spacing={2}> | ||||
| <CancelOutlinedIcon color="error" sx={{width:"35px",height:"40px"}}/> | <CancelOutlinedIcon color="error" sx={{width:"35px",height:"40px"}}/> | ||||
| <Typography display="inline" variant="h4">用戶名或密碼錯誤</Typography> | |||||
| {props.errorMassage==='ACCOUNT_LOCKED_ERROR'? | |||||
| <Stack direction="column"> | |||||
| <Typography display="inline"> | |||||
| 帳戶將被封鎖 | |||||
| </Typography> | |||||
| <Typography display="inline"> | |||||
| 帳戶連續五次登入錯誤,請與系統管理員聯絡 | |||||
| </Typography> | |||||
| </Stack>: | |||||
| <Typography display="inline"> | |||||
| 用戶名或密碼錯誤 | |||||
| </Typography> | |||||
| } | |||||
| </Stack> | </Stack> | ||||
| </DialogTitle> | </DialogTitle> | ||||
| <DialogContent> | <DialogContent> | ||||
| @@ -17,22 +17,33 @@ import { | |||||
| // TextField, | // TextField, | ||||
| Typography | Typography | ||||
| } from '@mui/material'; | } from '@mui/material'; | ||||
| import { Stack } from '../../../node_modules/@mui/material/index'; | |||||
| // project import | // project import | ||||
| // import Loadable from 'components/Loadable'; | // import Loadable from 'components/Loadable'; | ||||
| // import { lazy } from 'react'; | // import { lazy } from 'react'; | ||||
| // import backbroundImg from 'assets/images/bg_ml.jpg' | |||||
| // ==============================|| DASHBOARD - DEFAULT ||============================== // | // ==============================|| DASHBOARD - DEFAULT ||============================== // | ||||
| const DashboardDefault = () => { | const DashboardDefault = () => { | ||||
| const userData = JSON.parse(localStorage.getItem("userData")); | const userData = JSON.parse(localStorage.getItem("userData")); | ||||
| const BackgroundHead = { | |||||
| backgroundColor: '#0d47a1', | |||||
| width: '100%', | |||||
| height: '100%', | |||||
| backgroundSize:'cover' | |||||
| } | |||||
| return ( | return ( | ||||
| <Grid container rowSpacing={4.5} columnSpacing={2.75} sx={{minHeight: '80vh'}}> | |||||
| <Grid item xs={12} ml={2} mt={1}> | |||||
| <Typography variant="h5">Moring, {userData.fullenName}</Typography> | |||||
| </Grid> | |||||
| <Grid container sx={{minHeight: '85vh'}}> | |||||
| <div style={BackgroundHead}> | |||||
| <Grid item xs={12} ml={2} height='60px'> | |||||
| <Stack direction="row" justifyContent="flex-start" alignItems="center"> | |||||
| <Typography color='#FFF'variant="h4">Moring, {userData.fullenName}</Typography> | |||||
| </Stack> | |||||
| </Grid> | |||||
| </div> | |||||
| </Grid> | </Grid> | ||||
| ); | ); | ||||