|
@@ -41,12 +41,12 @@ import createCache from '@emotion/cache';
|
|
|
import {BrowserRouter, HashRouter, Route, Routes, useLocation, useNavigate} from 'react-router-dom';
|
|
import {BrowserRouter, HashRouter, Route, Routes, useLocation, useNavigate} from 'react-router-dom';
|
|
|
import {ToastContainer} from 'react-toastify';
|
|
import {ToastContainer} from 'react-toastify';
|
|
|
import Layout from "@layout/Layout";
|
|
import Layout from "@layout/Layout";
|
|
|
-import {getBFP, getFetchStatus, getHallServerUrl, getUserID, getUserInfo} from '@features/mainSlice';
|
|
|
|
|
|
|
+import {getBFP, getFetchStatus, getHallServerUrl, getUserID, getUserInfo, isLogined} from '@features/mainSlice';
|
|
|
import {useDispatch, useSelector} from "react-redux";
|
|
import {useDispatch, useSelector} from "react-redux";
|
|
|
import {REQ_STATUS} from "@api/config";
|
|
import {REQ_STATUS} from "@api/config";
|
|
|
import {
|
|
import {
|
|
|
reqAgentCheck,
|
|
reqAgentCheck,
|
|
|
- reqCustomService, reqFirstPayConfig, reqGameActivity,
|
|
|
|
|
|
|
+ reqCustomService, reqFirstPayConfig, reqGameActivity, reqGameInfo,
|
|
|
reqGetRoutes,
|
|
reqGetRoutes,
|
|
|
reqMailCheck,
|
|
reqMailCheck,
|
|
|
reqRedpackCheck, reqRedpackConfig,
|
|
reqRedpackCheck, reqRedpackConfig,
|
|
@@ -66,6 +66,9 @@ import LoadingFull from "@components/Loading/LoadingFull";
|
|
|
import {ClickAwayListener} from "@mui/base/ClickAwayListener";
|
|
import {ClickAwayListener} from "@mui/base/ClickAwayListener";
|
|
|
import useGlobalClick from "@hooks/useGlobalClick";
|
|
import useGlobalClick from "@hooks/useGlobalClick";
|
|
|
import SoundHelp from "@utils/SoundManger";
|
|
import SoundHelp from "@utils/SoundManger";
|
|
|
|
|
+import usePreviousRoute from "@hooks/usePreviousRoute";
|
|
|
|
|
+import {ROUTE_PATH} from "@constants/routes";
|
|
|
|
|
+import {onChangeUser, onChangeUserID} from "@features/actions/mainAction";
|
|
|
const App = () => {
|
|
const App = () => {
|
|
|
const dispatch = useDispatch();
|
|
const dispatch = useDispatch();
|
|
|
const fetchStatus=useSelector(getFetchStatus);
|
|
const fetchStatus=useSelector(getFetchStatus);
|
|
@@ -83,6 +86,7 @@ const App = () => {
|
|
|
const plugins = direction === 'rtl' ? [rtlPlugin] : [];
|
|
const plugins = direction === 'rtl' ? [rtlPlugin] : [];
|
|
|
const hallServerUrl=useSelector(getHallServerUrl);
|
|
const hallServerUrl=useSelector(getHallServerUrl);
|
|
|
useGlobalClick();
|
|
useGlobalClick();
|
|
|
|
|
+ const prevLocation=usePreviousRoute();
|
|
|
const muiTheme = createTheme({
|
|
const muiTheme = createTheme({
|
|
|
direction: direction,
|
|
direction: direction,
|
|
|
});
|
|
});
|
|
@@ -172,6 +176,7 @@ const App = () => {
|
|
|
// dispatch(reqAgentCheck());
|
|
// dispatch(reqAgentCheck());
|
|
|
//activity
|
|
//activity
|
|
|
// dispatch(reqGameActivity());
|
|
// dispatch(reqGameActivity());
|
|
|
|
|
+ dispatch(onChangeUser(userInfo));
|
|
|
}
|
|
}
|
|
|
const appInitData=()=>{
|
|
const appInitData=()=>{
|
|
|
// scroll to top on route change
|
|
// scroll to top on route change
|
|
@@ -203,12 +208,33 @@ const App = () => {
|
|
|
if (times>0){
|
|
if (times>0){
|
|
|
if (pathname==="/"){
|
|
if (pathname==="/"){
|
|
|
if(hash==null||hash===""){
|
|
if(hash==null||hash===""){
|
|
|
- setIsShowWheel(true)
|
|
|
|
|
|
|
+ setIsShowWheel(true);
|
|
|
|
|
+ return;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- },[turnplate])
|
|
|
|
|
|
|
+ if (userID>0){
|
|
|
|
|
+ if (pathname==="/"){
|
|
|
|
|
+ if(hash==null||hash===""){
|
|
|
|
|
+ navigate(ROUTE_PATH.CHECK_IN);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ },[turnplate]);
|
|
|
|
|
+ useEffect(()=>{
|
|
|
|
|
+ if (prevLocation){
|
|
|
|
|
+ let pathname=prevLocation.pathname;
|
|
|
|
|
+ if (pathname){
|
|
|
|
|
+ if (pathname.startsWith(ROUTE_PATH.GAME)){
|
|
|
|
|
+ //更新金币
|
|
|
|
|
+ dispatch(reqGameInfo());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ },[prevLocation])
|
|
|
|
|
+
|
|
|
const renderLayout=()=>{
|
|
const renderLayout=()=>{
|
|
|
return (
|
|
return (
|
|
|
<>
|
|
<>
|
|
@@ -218,24 +244,7 @@ const App = () => {
|
|
|
</>
|
|
</>
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
- // return (
|
|
|
|
|
- // <CacheProvider value={cacheRtl}>
|
|
|
|
|
- // <MuiThemeProvider theme={muiTheme}>
|
|
|
|
|
- // <SidebarProvider>
|
|
|
|
|
- // <ThemeProvider theme={{theme: theme}}>
|
|
|
|
|
- // <ThemeStyles/>
|
|
|
|
|
- // <ToastContainer theme={theme} autoClose={2500}
|
|
|
|
|
- // position={direction === 'ltr' ? 'top-right' : 'top-left'}/>
|
|
|
|
|
- // <StyleSheetManager stylisPlugins={plugins}>
|
|
|
|
|
- // {
|
|
|
|
|
- // renderLayout()
|
|
|
|
|
- // }
|
|
|
|
|
- // </StyleSheetManager>
|
|
|
|
|
- // </ThemeProvider>
|
|
|
|
|
- // </SidebarProvider>
|
|
|
|
|
- // </MuiThemeProvider>
|
|
|
|
|
- // </CacheProvider>
|
|
|
|
|
- // );
|
|
|
|
|
|
|
+
|
|
|
return (
|
|
return (
|
|
|
<CacheProvider value={cacheRtl}>
|
|
<CacheProvider value={cacheRtl}>
|
|
|
<MuiThemeProvider theme={muiTheme}>
|
|
<MuiThemeProvider theme={muiTheme}>
|