diff --git a/src/pages/Payment/Details_Public/PaymentDetails.js b/src/pages/Payment/Details_Public/PaymentDetails.js index e12965d..b7e6037 100644 --- a/src/pages/Payment/Details_Public/PaymentDetails.js +++ b/src/pages/Payment/Details_Public/PaymentDetails.js @@ -35,7 +35,7 @@ const PaymentDetails = ({ formData,doPrint }) => { }, [data]); const getPaymentMethod=()=>{ - let paymentmethod = data.payload.paymentdetail.paymentmethod; + let paymentmethod = data?.payload?.paymentdetail?.paymentmethod; if("01" == paymentmethod) return "PPS"; if("02" == paymentmethod || "03" == paymentmethod) return "Credit Card"; if("04" == paymentmethod) return "FPS"; diff --git a/src/pages/Payment/FPS/AckPage.js b/src/pages/Payment/FPS/AckPage.js index ba0b67c..86eed41 100644 --- a/src/pages/Payment/FPS/AckPage.js +++ b/src/pages/Payment/FPS/AckPage.js @@ -90,7 +90,7 @@ const AckPage = () => { }, onSuccess: function(responseData){ setResponeDataData(responseData) - setPaymentId(responseData.paymentdetail.paymentid) + if (responseData.paymentdetail?.result?.paymentstatuscode === "APPR") { localStorage.removeItem("webtoken"); localStorage.removeItem("transactionid"); @@ -111,6 +111,7 @@ const AckPage = () => { setItemList(responseData2.paymentItemList) setPaymentData(responseData2.data); localStorage.removeItem("paymentId"); + setPaymentId(responseData2.id) } }); } diff --git a/src/pages/Payment/FPS/FPS.js b/src/pages/Payment/FPS/FPS.js index 1c4c0e2..7250439 100644 --- a/src/pages/Payment/FPS/FPS.js +++ b/src/pages/Payment/FPS/FPS.js @@ -176,6 +176,7 @@ const Index = () => { + encodeURIComponent("https://"+window.location.hostname+ '/paymentPage/fps/fpscallback?TRANSACTION_ID='+paymentData.transactionid+"&WEB_TOKEN="+paymentData.webtoken+"&PAYMENT_ID="+localStorage.getItem("paymentId")); setFpsqrcodeurl(openPASGUrl) setFpsqrcodeurlPrd(openPASGUrlPrd) + } }); diff --git a/src/pages/Payment/PaymentCallback.js b/src/pages/Payment/PaymentCallback.js index 987f2cb..1bcdb4d 100644 --- a/src/pages/Payment/PaymentCallback.js +++ b/src/pages/Payment/PaymentCallback.js @@ -113,7 +113,6 @@ const Index = () => { }, onSuccess: function (responseData) { setResponeDataData(responseData) - setPaymentId(responseData.paymentdetail.paymentid) if (responseData.paymentdetail?.result?.paymentstatuscode === "APPR") { localStorage.removeItem("webtoken"); localStorage.removeItem("transactionid"); @@ -134,6 +133,7 @@ const Index = () => { setItemList(responseData2.paymentItemList) setPaymentData(responseData2.data); localStorage.removeItem("paymentId"); + setPaymentId(responseData2.id) } }); } diff --git a/src/pages/authentication/RegisterCustom.js b/src/pages/authentication/RegisterCustom.js index b64074e..33d236f 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, iAmSmartAppPath, clientId, getBowserType, isAppBowser, iAmSmartCallbackPath} from 'auth/utils' +import { iAmSmartPath, clientId, getBowserType, isAppBowser, iAmSmartCallbackPath} from 'auth/utils' import * as React from 'react'; import {FormattedMessage, useIntl} from "react-intl"; @@ -48,20 +48,17 @@ const RegisterCustom = () => { } const openApp = () => { - setTimeout(function () { - openQR(); - }, 1000); - let callbackUrl = "https://" + iAmSmartCallbackPath() + "/iamsmart/registrycallback"; - let url = iAmSmartAppPath + "auth" + let callbackUrl = "https://"+iAmSmartCallbackPath()+"/iamsmart/registrycallback"; + let url = iAmSmartPath + "/api/v1/auth/getQR" + "?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 + +"&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; + +"&brokerPage=true" + window.location.assign(url); } return ( diff --git a/src/pages/authentication/auth-forms/AuthLoginCustom.js b/src/pages/authentication/auth-forms/AuthLoginCustom.js index fe4a2af..0784c6a 100644 --- a/src/pages/authentication/auth-forms/AuthLoginCustom.js +++ b/src/pages/authentication/auth-forms/AuthLoginCustom.js @@ -6,7 +6,8 @@ import React, { import { Link as RouterLink } from 'react-router-dom'; import { useNavigate } from 'react-router-dom'; import { useForm, } from 'react-hook-form' -import { iAmSmartPath, iAmSmartAppPath, clientId, getBowserType, isAppBowser, iAmSmartCallbackPath } from 'auth/utils' +import { iAmSmartPath, clientId, getBowserType, isAppBowser, iAmSmartCallbackPath } from 'auth/utils' +//iAmSmartAppPath // material-ui import { @@ -193,11 +194,26 @@ const AuthLoginCustom = () => { } const openApp = () => { - setTimeout(function () { - openQR(); - }, 1000); + // setTimeout(function () { + // openQR(); + // }, 1000); + // let callbackUrl = "https://" + iAmSmartCallbackPath() + "/iamsmart/authcallback"; + + // let source = getBowserType() + // console.log(source) + // 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=true" + // window.location=url; + let callbackUrl = "https://" + iAmSmartCallbackPath() + "/iamsmart/authcallback"; - let url = iAmSmartAppPath + "auth" + let url = iAmSmartPath + "/api/v1/auth/getQR" + "?clientID=" + clientId + "&responseType=code" + "&source=" + getBowserType() @@ -205,8 +221,9 @@ const AuthLoginCustom = () => { + "&scope=" + encodeURIComponent("eidapi_auth eidapi_profiles") + "&lang=zh-HK"//en-US, zh-HK, or zh-CN //+"&state=" - + "&brokerPage=false" - window.location=url; + + "&brokerPage=true" + window.location=url; + } diff --git a/src/pages/dashboard/Public/Message.js b/src/pages/dashboard/Public/Message.js new file mode 100644 index 0000000..39f5168 --- /dev/null +++ b/src/pages/dashboard/Public/Message.js @@ -0,0 +1,30 @@ +// material-ui +import { + Stack, + Typography +} from '@mui/material'; +import MainCard from "components/MainCard"; +import * as React from "react"; + +// ==============================|| DASHBOARD - DEFAULT ||============================== // + + +const SearchDemandNoteForm = () => { + + return ( + + + + + + + + + ); +}; + +export default SearchDemandNoteForm; diff --git a/src/pages/dashboard/Public/Notice.js b/src/pages/dashboard/Public/Notice.js new file mode 100644 index 0000000..b7a1029 --- /dev/null +++ b/src/pages/dashboard/Public/Notice.js @@ -0,0 +1,31 @@ +// material-ui +import { + Typography, + Stack +} from '@mui/material'; +import MainCard from "components/MainCard"; +import * as React from "react"; + +// ==============================|| DASHBOARD - DEFAULT ||============================== // + + +const SearchDemandNoteForm = () => { + + return ( + + + + + + + + + + ); +}; + +export default SearchDemandNoteForm; diff --git a/src/pages/dashboard/Public/index.js b/src/pages/dashboard/Public/index.js index c2db5de..4b49340 100644 --- a/src/pages/dashboard/Public/index.js +++ b/src/pages/dashboard/Public/index.js @@ -4,13 +4,19 @@ import { Grid, Typography, - Stack + Stack, + Button, + Box } from '@mui/material'; -import { - isORGLoggedIn, -} from "utils/Utils"; +import { isORGLoggedIn, } from "utils/Utils"; import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' import {FormattedMessage} from "react-intl"; +import AdsClickRoundedIcon from '@mui/icons-material/AdsClickRounded'; +import * as React from "react"; +import Loadable from 'components/Loadable'; +const Message = Loadable(React.lazy(() => import('./Message'))); +const Notice = Loadable(React.lazy(() => import('./Notice'))); + // ==============================|| DASHBOARD - DEFAULT ||============================== // const DashboardDefault = () => { @@ -20,13 +26,13 @@ const DashboardDefault = () => { backgroundImage: `url(${titleBackgroundImg})`, width: '100%', height: '100%', - backgroundSize:'contain', + backgroundSize: 'contain', backgroundRepeat: 'no-repeat', backgroundColor: '#0C489E', backgroundPosition: 'right' } return ( - +
@@ -37,6 +43,39 @@ const DashboardDefault = () => {
+ + + + + + + + 提交公共啟事申請 + 提供你的啟事內容作排版,校對及計價。 + + + + + 公告 + + + + + + + + + 系統消息 + + + + + + + +
); }; diff --git a/src/pages/iAmSmart/AuthCallback/index.js b/src/pages/iAmSmart/AuthCallback/index.js index 5f30bb6..b83ba04 100644 --- a/src/pages/iAmSmart/AuthCallback/index.js +++ b/src/pages/iAmSmart/AuthCallback/index.js @@ -56,9 +56,11 @@ const Index = () => { }, onError:(error)=>{ console.log(error); - //window.location.assign("/iamsmart/loginFail"); + window.location.assign("/iamsmart/loginFail"); } }); + }else{ + window.location.assign("/iamsmart/loginFail"); } } diff --git a/src/pages/iAmSmart/FallCallback/index.js b/src/pages/iAmSmart/DirectLoginCallback/index.js similarity index 78% rename from src/pages/iAmSmart/FallCallback/index.js rename to src/pages/iAmSmart/DirectLoginCallback/index.js index 7716ad5..89208b8 100644 --- a/src/pages/iAmSmart/FallCallback/index.js +++ b/src/pages/iAmSmart/DirectLoginCallback/index.js @@ -18,24 +18,22 @@ const Index = () => { const navigate = useNavigate() React.useEffect(() => { - getPrfile(); + goLogin(); }, []); - function getPrfile(){ + function goLogin(){ dispatch(handleLogoutFunction()); let params = new URLSearchParams(window.location.search) if(params.get("code")){ HttpUtils.post({ - url: UrlUtils.GET_SMART_LOGIN, + url: UrlUtils.GET_SMART_DIRECT_LOGIN, params:{ code: params.get("code") }, onSuccess: (responseData) => { - - //navigate('/iAmSmartRegisterFrom', { state: { responseData: responseData } }); - - console.log(response) + console.log("responseData"); + console.log(responseData); const userData = { id: responseData.id, fullenName: responseData.name, @@ -48,17 +46,16 @@ const Index = () => { //avatar: require('src/assets/images/users/avatar-3.png').default, } const data = { ...userData, accessToken: responseData.accessToken, refreshToken: responseData.refreshToken } - // setSuccess(true) dispatch(handleLogin(data)) navigate('/dashboard'); - location.reload() - }, - onFail: ()=>{ - window.location.assign("/login"); + onFail: (response)=>{ + console.log("Fail"); + console.log(response); + window.location.assign("/iamsmart/loginFail"); }, - onError:()=>{ - window.location.assign("/login"); + onError:(error)=>{ + console.log(error); } }); } diff --git a/src/pages/iAmSmart/RegistryCallback/index.js b/src/pages/iAmSmart/RegistryCallback/index.js index 0c03fbe..ab69b32 100644 --- a/src/pages/iAmSmart/RegistryCallback/index.js +++ b/src/pages/iAmSmart/RegistryCallback/index.js @@ -27,14 +27,22 @@ const Index = () => { }, onSuccess: (responseData) => { navigate('/iAmSmartRegisterFrom', { state: { responseData: responseData } }); + }, + onFail: (response)=>{ + console.log("Fail"); + console.log(response); + window.location.assign("/register"); + }, + onError:(error)=>{ + console.log(error); + window.location.assign("/register"); } }); + }else{ + window.location.assign("/register"); } } - - - return ( ); diff --git a/src/routes/LoginRoutes.js b/src/routes/LoginRoutes.js index 0a745f0..b3c7533 100644 --- a/src/routes/LoginRoutes.js +++ b/src/routes/LoginRoutes.js @@ -12,7 +12,8 @@ const RegisterForm = Loadable(lazy(() => import('pages/authentication/Register') const BusRegisterForm = Loadable(lazy(() => import('pages/authentication/BusRegister'))); const IAmSmartRegister = Loadable(lazy(() => import('pages/authentication/IAmSmartRegister'))); const ErrorPage = Loadable(lazy(() => import('pages/extra-pages/ErrorPage'))); -const IAmSmart_FallCallback = Loadable(lazy(() => import('pages/iAmSmart/FallCallback'))); +const IAmSmart_DirectLoginCallback = Loadable(lazy(() => import('pages/iAmSmart/DirectLoginCallback'))); +//const IAmSmart_FallCallback = Loadable(lazy(() => import('pages/iAmSmart/FallCallback'))); const IAmSmart_FailCallback = Loadable(lazy(() => import('pages/iAmSmart/FailCallback'))); const IAmSmart_SuccessCallback = Loadable(lazy(() => import('pages/iAmSmart/SuccessCallback'))); const IAmSmart_AuthCallback = Loadable(lazy(() => import('pages/iAmSmart/AuthCallback'))); @@ -60,11 +61,11 @@ const LoginRoutes = { }, { path: 'iamsmart/logincallback', - element: + element: }, { path: 'iamsmart/loginfallback', - element: + element: }, { path: 'iamsmart/authcallback', diff --git a/src/themes/palette.js b/src/themes/palette.js index 80eda43..ea3f267 100644 --- a/src/themes/palette.js +++ b/src/themes/palette.js @@ -53,6 +53,12 @@ const Palette = (mode) => { paper: paletteColor.grey[0], default: paletteColor.grey.A50 }, + gray: { + main: '#777', + light: '#777', + dark: '#777', + contrastText: '#FFF', + }, white: { main: '#fff', light: '#fff', diff --git a/src/utils/ApiPathConst.js b/src/utils/ApiPathConst.js index 316270e..77fd0e6 100644 --- a/src/utils/ApiPathConst.js +++ b/src/utils/ApiPathConst.js @@ -124,6 +124,7 @@ export const DELETE_EMAIL = apiPath+'/email/delete'; //iAmSmart export const GET_SMART_PROFILE = apiPath+'/smart/getProfile'; //POST export const GET_SMART_LOGIN = apiPath+'/smart/login'; //POST +export const GET_SMART_DIRECT_LOGIN = apiPath+'/smart/directLogin'; //POST //gen report