Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 

206 rindas
7.7 KiB

  1. // material-ui
  2. import {
  3. Dialog, DialogTitle, DialogContent,
  4. Link, Button, Card, Box, Grid
  5. } from '@mui/material';
  6. import Typography from '@mui/material/Typography';
  7. import banner from 'assets/images/bg_ml.jpg';
  8. import { Stack } from '../../../node_modules/@mui/material/index';
  9. import { iAmSmartPath, clientId, getBowserType, isAppBowser, iAmSmartCallbackPath } from 'auth/utils'
  10. import { IAmSmartButton } from "components/iAmSmartButton";
  11. import * as React from 'react';
  12. import { FormattedMessage, useIntl } from "react-intl";
  13. // ================================|| LOGIN ||================================ //
  14. const RegisterCustom = () => {
  15. const [isPopUp, setIsPopUp] = React.useState(false);
  16. const intl = useIntl();
  17. const { locale } = intl;
  18. const registerWithIAmSmart = () => {
  19. setIsPopUp(true);
  20. }
  21. const getQRWithIAmSmart = () => {
  22. if ((isAppBowser())) {
  23. openApp();
  24. } else {
  25. openQR();
  26. }
  27. }
  28. const openQR = () => {
  29. let callbackUrl = "https://" + iAmSmartCallbackPath() + "/iamsmart/registrycallback";
  30. let url = iAmSmartPath + "/api/v1/auth/getQR"
  31. + "?clientID=" + clientId
  32. + "&responseType=code"
  33. + "&source=" + getBowserType()
  34. + "&redirectURI=" + encodeURIComponent(callbackUrl)
  35. + "&scope=" + encodeURIComponent("eidapi_auth eidapi_profiles")
  36. + "&lang=" + (locale === 'en' ? "en-US" : locale === 'zh-HK' ? "zh-HK" : "zh-CN")
  37. //+"&state="
  38. + "&brokerPage=false"
  39. window.location.assign(url);
  40. }
  41. const openApp = () => {
  42. let callbackUrl = "https://" + iAmSmartCallbackPath() + "/iamsmart/registrycallback";
  43. let url = iAmSmartPath + "/api/v1/auth/getQR"
  44. + "?clientID=" + clientId
  45. + "&responseType=code"
  46. + "&source=" + getBowserType()
  47. + "&redirectURI=" + encodeURIComponent(callbackUrl)
  48. + "&scope=" + encodeURIComponent("eidapi_auth eidapi_profiles")
  49. + "&lang=" + (locale === 'en' ? "en-US" : locale === 'zh-HK' ? "zh-HK" : "zh-CN")
  50. //+"&state="
  51. + "&brokerPage=true"
  52. window.location.assign(url);
  53. }
  54. return (
  55. <Stack justifyContent="center" sx={{ minHeight: '100vh', bgcolor: 'backgroundColor.default' }}>
  56. <img src={banner} alt="banner" width="100%" height="200px" />
  57. <center>
  58. <Card
  59. sx={{
  60. maxWidth: { xs: 1, lg: 1000 },
  61. margin: { xs: 2.5, md: 3 },
  62. '& > *': {
  63. flexGrow: 1,
  64. flexBasis: '50%'
  65. },
  66. backgroundColor: "secondary"
  67. }}
  68. >
  69. <Box alignItems="center">
  70. <Grid container>
  71. <Grid item xs={12} md={12}>
  72. <Typography mt={4} variant="h3">
  73. <FormattedMessage id="registerTitle1" />
  74. <strong style={{ color: '#FF5733' }}>
  75. {" " + intl.formatMessage({ id: 'registerTitle2' }) + " "}
  76. </strong>
  77. <FormattedMessage id="registerTitle3" />
  78. </Typography>
  79. <Typography variant="body1">
  80. {intl.formatMessage({ id: 'registerSubTitle' })}
  81. </Typography>
  82. </Grid>
  83. </Grid>
  84. <Box mt={3} mb={3}>
  85. <Grid container >
  86. <Grid item xs={12} md={6} sx={{ borderRight: 1, borderColor: 'grey.500' }}>
  87. <Typography mb={4} variant="h3">
  88. <FormattedMessage id="personalUser" />
  89. </Typography>
  90. <IAmSmartButton
  91. label={intl.formatMessage({ id: 'continueWithIAmSmart' })}
  92. onClickFun={registerWithIAmSmart}
  93. />
  94. <Box mt={4} ml={2} mr={2} bgcolor="grey.100" p={1.5} >
  95. <Typography textAlign='justify' variant="body1" display="block" gutterBottom>
  96. <div dangerouslySetInnerHTML={{ __html: intl.formatMessage({ id: 'MSG.registerIAmSmart' }) }} />
  97. </Typography>
  98. <Link href={intl.formatMessage({ id: "iamsmartLink" })}>
  99. <FormattedMessage id="learnMore" />
  100. </Link>
  101. </Box>
  102. <Typography m={5}>
  103. <FormattedMessage id="or" />
  104. </Typography>
  105. <Button href="/registerFrom" variant="contained"><Typography variant="h5">
  106. <FormattedMessage id="registerNewPersonalUser" />
  107. </Typography></Button>
  108. <Typography ml={4} mr={4} mt={4} variant="body1" display="block" sx={{ fontWeight: 'bold' }} gutterBottom>
  109. <div dangerouslySetInnerHTML={{ __html: intl.formatMessage({ id: 'MSG.registerPersonal' }) }} />
  110. </Typography>
  111. </Grid>
  112. <Grid item xs={12} md={6} sx={{ borderLeft: 1, borderColor: 'grey.500' }}>
  113. <Typography mb={4} variant="h3">
  114. <FormattedMessage id="businessUser" />
  115. </Typography>
  116. <Button href="/registerFromOrganization" variant="contained" sx={{ mt: 0.5 }}><Typography variant="h5">
  117. <FormattedMessage id="registerNewBusinessUser" />
  118. </Typography></Button>
  119. <Typography ml={4} mr={4} mt={4} variant="body1" display="block" sx={{ fontWeight: 'bold' }} gutterBottom>
  120. <div dangerouslySetInnerHTML={{ __html: intl.formatMessage({ id: 'MSG.registerOrg' }) }} />
  121. </Typography>
  122. </Grid>
  123. </Grid>
  124. </Box>
  125. </Box>
  126. </Card >
  127. </center>
  128. <Dialog
  129. open={isPopUp}
  130. onClose={() => setIsPopUp(false)}
  131. PaperProps={{
  132. sx: {
  133. minWidth: '40vw',
  134. maxWidth: { xs: '90vw', s: '90vw', m: '70vw', lg: '70vw' },
  135. maxHeight: { xs: '90vh', s: '70vh', m: '70vh', lg: '60vh' }
  136. }
  137. }}
  138. >
  139. <DialogTitle></DialogTitle>
  140. <DialogContent>
  141. <Typography variant="h3" >
  142. <FormattedMessage id="authorizeIAmSmartForInfo" />
  143. </Typography>
  144. <Typography variant="h5" style={{ padding: '4px' }}>
  145. <FormattedMessage id="iAmSmartSubTitle" />
  146. </Typography>
  147. </DialogContent>
  148. <DialogContent >
  149. <Grid container style={{ paddingLeft: '16px' }}>
  150. <Grid item xs={6} >
  151. <Typography style={{ padding: '4px' }}>
  152. {"- " + intl.formatMessage({ id: 'userChineseName' })}
  153. </Typography>
  154. <Typography style={{ padding: '4px' }}>
  155. {"- " + intl.formatMessage({ id: 'userEnglishName' })}
  156. </Typography>
  157. <Typography style={{ padding: '4px' }}>
  158. {"- " + intl.formatMessage({ id: 'userIDNo' })}
  159. </Typography>
  160. </Grid>
  161. <Grid item xs={6} >
  162. <Typography style={{ padding: '4px' }}>
  163. {"- " + intl.formatMessage({ id: 'userEmailAddress' })}
  164. </Typography>
  165. <Typography style={{ padding: '4px' }}>
  166. {"- " + intl.formatMessage({ id: 'userPhoneNumber' })}
  167. </Typography>
  168. <Typography style={{ padding: '4px' }}>
  169. {"- " + intl.formatMessage({ id: 'userAddress' })}
  170. </Typography>
  171. </Grid>
  172. </Grid>
  173. </DialogContent>
  174. <DialogContent align="right">
  175. <IAmSmartButton
  176. label={intl.formatMessage({ id: 'iAmSmartAutoFillIn' })}
  177. onClickFun={getQRWithIAmSmart}
  178. />
  179. <br />
  180. <Link href={intl.formatMessage({ id: "iamsmartLink" })}>
  181. <FormattedMessage id="learnMore" />
  182. </Link>
  183. </DialogContent>
  184. </Dialog>
  185. </Stack>
  186. );
  187. };
  188. export default RegisterCustom;