diff --git a/src/auth/utils.js b/src/auth/utils.js index 2abfd45..869d555 100644 --- a/src/auth/utils.js +++ b/src/auth/utils.js @@ -9,10 +9,20 @@ import useJwt from 'auth/jwt/coreUseJwt'; export const hostname = 'localhost'; const hostPort = '8090'; export const hostPath = `http://${hostname}:${hostPort}`; -//export const apiPath = `http://192.168.0.112:8090/api`; export const apiPath = window.location.href.match("localhost:3000")?`${hostPath}/api`:(window.location.href.match(":3000")? "http://"+window.location.hostname+":8090/api":`/api`); export const paymentPath = window.location.href.match("localhost:3000")?`${hostPath}/payment`:`/payment`; + +/** + * Testing: + * Domain: apigw-isit.staging-eid.gov.hk + * URL: hk.gov.iamsmart.testapp:// + * + * Production + * Domain: apigw.iamsmart.gov.hk + * URL: hk.gov.iamsmart:// + */ export const iAmSmartPath = `https://apigw-isit.staging-eid.gov.hk`; +export const iAmSmartAppPath = `hk.gov.iamsmart.testapp://`; export const clientId = "cf61fa7c121e4869966f69c8694b1cd2"; export const iAmSmartCallbackPath = () => { diff --git a/src/pages/Payment/Details_GLD/index.js b/src/pages/Payment/Details_GLD/index.js index b5fd143..a0cd8e3 100644 --- a/src/pages/Payment/Details_GLD/index.js +++ b/src/pages/Payment/Details_GLD/index.js @@ -3,7 +3,8 @@ import { Grid, Typography, Stack, - Box + Box, + Button } from '@mui/material'; import * as UrlUtils from "utils/ApiPathConst"; import * as React from "react"; @@ -36,15 +37,24 @@ const Index = () => { const [record, setRecord] = React.useState(); const [itemList, setItemList] = React.useState([]); const [onReady, setOnReady] = React.useState(false); + const [detailsOrder, setDetailsOrder] = React.useState(2); React.useEffect(() => { loadForm(); + window.addEventListener('resize', handleResize); }, []); React.useEffect(() => { setOnReady(true); }, [record]); + const handleResize = () => { + setDetailsOrder(window.innerWidth > 1023 ? 2 : -1); + } + + const doPrint = () => { + window.print(); + }; const loadForm = () => { if (params.id > 0) { @@ -69,41 +79,48 @@ const Index = () => { : ( - - -
- - Payment Details - -
-
- {/*row 1*/} - - - - - - - - - - - +
+ + + +
+ + Payment Details + +
+
+ {/*row 1*/} + + + + + + + + + + + + + -
- {/*row 2*/} - - + {/*row 2*/} + +
) diff --git a/src/pages/Payment/Details_Public/index.js b/src/pages/Payment/Details_Public/index.js index d6d5dca..e5be45b 100644 --- a/src/pages/Payment/Details_Public/index.js +++ b/src/pages/Payment/Details_Public/index.js @@ -3,7 +3,8 @@ import { Grid, Typography, Stack, - Box + Box, + Button } from '@mui/material'; import * as UrlUtils from "utils/ApiPathConst"; import * as React from "react"; @@ -36,15 +37,26 @@ const Index = () => { const [record, setRecord] = React.useState(); const [itemList, setItemList] = React.useState([]); const [onReady, setOnReady] = React.useState(false); + const [detailsOrder, setDetailsOrder] = React.useState(2); React.useEffect(() => { loadForm(); + + window.addEventListener('resize', handleResize) }, []); React.useEffect(() => { setOnReady(true); }, [record]); + const handleResize = () => { + setDetailsOrder(window.innerWidth > 1023 ? 2 : -1); + } + + const doPrint = () => { + window.print(); + }; + const loadForm = () => { if (params.id > 0) { @@ -69,41 +81,49 @@ const Index = () => { : ( - - -
- - 付款詳情 - -
-
- {/*row 1*/} - - - - - - - - - - - +
+ + + + +
+ + 付款詳情 + +
+
+ {/*row 1*/} + + + + + + + + + + + + + -
- {/*row 2*/} - - + {/*row 2*/} + +
) diff --git a/src/pages/authentication/RegisterCustom.js b/src/pages/authentication/RegisterCustom.js index 5ae50c2..5f99f19 100644 --- a/src/pages/authentication/RegisterCustom.js +++ b/src/pages/authentication/RegisterCustom.js @@ -9,7 +9,7 @@ import Typography from '@mui/material/Typography'; import iAmSmartICon from 'assets/images/icons/icon_iAmSmart.png'; import banner from 'assets/images/bg_ml.jpg'; import { Stack } from '../../../node_modules/@mui/material/index'; -import { iAmSmartPath, clientId, getBowserType , iAmSmartCallbackPath} from 'auth/utils' +import { iAmSmartPath, iAmSmartAppPath, clientId, getBowserType, isAppBowser, iAmSmartCallbackPath} from 'auth/utils' import * as React from 'react'; @@ -25,6 +25,14 @@ const RegisterCustom = () => { } const getQRWithIAmSmart = () => { + if ((isAppBowser())) { + openApp(); + } else { + openQR(); + } + } + + const openQR =()=>{ let callbackUrl = "https://"+iAmSmartCallbackPath()+"/iamsmart/registrycallback"; let url = iAmSmartPath + "/api/v1/auth/getQR" + "?clientID=" + clientId @@ -38,6 +46,22 @@ const RegisterCustom = () => { window.location.assign(url); } + const openApp = () => { + setTimeout(function () { + openQR(); + }, 1000); + let callbackUrl = "https://" + iAmSmartCallbackPath() + "/iamsmart/registrycallback"; + let url = iAmSmartAppPath + "auth" + + "?clientID=" + clientId + + "&responseType=code" + + "&source=" + getBowserType() + + "&redirectURI=" + encodeURIComponent(callbackUrl) + + "&scope=" + encodeURIComponent("eidapi_auth eidapi_profiles") + + "&lang=zh-HK"//en-US, zh-HK, or zh-CN + //+"&state=" + + "&brokerPage=false" + window.location=url; + } return ( @@ -66,7 +90,7 @@ const RegisterCustom = () => { 個人用戶 - + diff --git a/src/pages/authentication/auth-forms/AuthLoginCustom.js b/src/pages/authentication/auth-forms/AuthLoginCustom.js index 8db112d..7358440 100644 --- a/src/pages/authentication/auth-forms/AuthLoginCustom.js +++ b/src/pages/authentication/auth-forms/AuthLoginCustom.js @@ -6,7 +6,7 @@ import React, { import { Link as RouterLink } from 'react-router-dom'; import { useNavigate } from 'react-router-dom'; import { useForm, } from 'react-hook-form' -import { iAmSmartPath, clientId, getBowserType, isAppBowser, iAmSmartCallbackPath } from 'auth/utils' +import { iAmSmartPath, iAmSmartAppPath, clientId, getBowserType, isAppBowser, iAmSmartCallbackPath } from 'auth/utils' // material-ui import { @@ -195,7 +195,7 @@ const AuthLoginCustom = () => { openQR(); }, 1000); let callbackUrl = "https://" + iAmSmartCallbackPath() + "/iamsmart/authcallback"; - let url = "hk.gov.iamsmart.testapp://" + "auth" + let url = iAmSmartAppPath + "auth" + "?clientID=" + clientId + "&responseType=code" + "&source=" + getBowserType() diff --git a/src/pages/iAmSmart/AuthCallback/index.js b/src/pages/iAmSmart/AuthCallback/index.js index 790f0f0..7716ad5 100644 --- a/src/pages/iAmSmart/AuthCallback/index.js +++ b/src/pages/iAmSmart/AuthCallback/index.js @@ -55,10 +55,10 @@ const Index = () => { }, onFail: ()=>{ - window.location.assign("/iamsmart/loginFall"); + window.location.assign("/login"); }, onError:()=>{ - window.location.assign("/iamsmart/loginFall"); + window.location.assign("/login"); } }); } diff --git a/src/pages/iAmSmart/FallCallback/index.js b/src/pages/iAmSmart/FallCallback/index.js index 790f0f0..7716ad5 100644 --- a/src/pages/iAmSmart/FallCallback/index.js +++ b/src/pages/iAmSmart/FallCallback/index.js @@ -55,10 +55,10 @@ const Index = () => { }, onFail: ()=>{ - window.location.assign("/iamsmart/loginFall"); + window.location.assign("/login"); }, onError:()=>{ - window.location.assign("/iamsmart/loginFall"); + window.location.assign("/login"); } }); }