Sfoglia il codice sorgente

Merge branch 'xudh' into sport

zhejiushizhuce 2 anni fa
parent
commit
55edf3c88e
1 ha cambiato i file con 12 aggiunte e 2 eliminazioni
  1. 12 2
      src/widgets/WGame/index.jsx

+ 12 - 2
src/widgets/WGame/index.jsx

@@ -24,7 +24,7 @@ const i18n=global.i18n;
 const WGame=()=>{
     const dispatch = useDispatch();
     const {pathname}=useLocation();
-    const {gameID} = useThemeProvider();
+    const {gameID,preLocation} = useThemeProvider();
     // const gameid=pathname.split("/").pop();
     const gameid=gameID;
     const [openBox,setOpenBox]=useState(false);
@@ -39,7 +39,17 @@ const WGame=()=>{
     const gameCardInfo=useSelector(getGameCardInfo(gameid));
     const onBack=()=>{
         // dispatch(reqGameInfo());
-        navigate(ROUTE_PATH.BACK);
+        let ppath=ROUTE_PATH.HOME;
+        if (preLocation!=null){
+            let pathname=preLocation.pathname;
+            if (pathname!=null&&pathname!==""){
+                if (!pathname.startsWith(ROUTE_PATH.GAME)){
+                    ppath=pathname;
+                }
+            }
+        }
+        // navigate(ROUTE_PATH.BACK);
+        navigate(ppath,{replace:true});
     }
     const parseURL=()=>{
         let key=LOCAL_GAME_URL+gameid;