zhejiushizhuce il y a 2 ans
Parent
commit
436163a369
2 fichiers modifiés avec 18 ajouts et 10 suppressions
  1. 16 9
      src/App.js
  2. 2 1
      src/layout/Layout.jsx

+ 16 - 9
src/App.js

@@ -190,6 +190,20 @@ const App = () => {
         SoundHelp.loadAllAudioFile();
         // preventTouchMove();
     }
+    const checkOpenCheckin=()=>{
+        if (userID>0){
+            if (pathname==="/"){
+                if(hash==null||hash===""){
+                    navigate(ROUTE_PATH.CHECK_IN);
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+    const onCloseHallWheel=()=>{
+        checkOpenCheckin();
+    }
     //初始化
     useEffect(() => {
         appInitData();
@@ -214,14 +228,7 @@ const App = () => {
                 }
             }
         }
-        if (userID>0){
-            if (pathname==="/"){
-                if(hash==null||hash===""){
-                    navigate(ROUTE_PATH.CHECK_IN);
-                    return;
-                }
-            }
-        }
+        checkOpenCheckin();
     },[turnplate]);
     useEffect(()=>{
         if (prevLocation){
@@ -239,7 +246,7 @@ const App = () => {
         return (
             <>
                 {
-                    fetchStatus===REQ_STATUS.IDLE?<Layout />:(<LoadingFull />)
+                    fetchStatus===REQ_STATUS.IDLE?<Layout onCloseHallWheel={onCloseHallWheel} />:(<LoadingFull />)
                 }
             </>
         )

+ 2 - 1
src/layout/Layout.jsx

@@ -30,7 +30,7 @@ import DropCoins from "@components/DropCoins";
 import {toast} from "react-toastify";
 const PageNotFound = lazy(() => import('@pages/PageNotFound'));
 
-const Layout=()=>{
+const Layout=({...props})=>{
     const appRef = useRef(null);
     const msgBoxRef=useRef(null);
     const {isMobile,isShowWheel, setIsShowWheel,isShowWDPassBox,setIsShowWDPassBox,isOpenSub} = useThemeProvider();
@@ -107,6 +107,7 @@ const Layout=()=>{
                 }}/>
                 <WHallWheel open={isShowWheel} onClose={()=>{
                     setIsShowWheel(false);
+                    if (props&&props.onCloseHallWheel)props.onCloseHallWheel()
                 }}></WHallWheel>
             </>
         )