xiaolin.fu 3 mesi fa
parent
commit
3098b58791
2 ha cambiato i file con 27 aggiunte e 1 eliminazioni
  1. 14 0
      src/components/Card/Card.tsx
  2. 13 1
      src/hooks/useGame.tsx

+ 14 - 0
src/components/Card/Card.tsx

@@ -42,8 +42,12 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
         element.current = document.getElementById("app");
     }, []);
     const playGameHandler = async (game: GameListRep) => {
+<<<<<<< HEAD
         const type = getCoinType(game, groupType!);
 
+=======
+      console.log('playGameHandler===>',game)
+>>>>>>> feature-lucky
         if (!token) {
             router.push("/login?redirect=/");
             return;
@@ -180,8 +184,13 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
                                     onClick={() => demoPlayGameHandler({ ...item!, demo: 1 })}
                                     className={`flex h-[0.46rem] w-[1rem] items-center justify-center bg-[url(/home/popbtn.png)] bg-[length:100%_100%] text-[0.15rem] font-bold`}
                                 >
+<<<<<<< HEAD
                                     {t("demo")}
                                 </div>
+=======
+                                    {t("demo")} 
+                                </Button>
+>>>>>>> feature-lucky
                             )}
                             <div
                                 onClick={() => playGameHandler(item!)}
@@ -191,8 +200,13 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
                                 // }}
                                 className={`flex h-[0.46rem] w-[1rem] items-center justify-center bg-[url(/home/popbtn.png)] bg-[length:100%_100%] text-[0.15rem] font-bold`}
                             >
+<<<<<<< HEAD
                                 {t("join")}
                             </div>
+=======
+                                {t("join")} 
+                            </Button>
+>>>>>>> feature-lucky
                         </div>
                     </div>
                 </Box>

+ 13 - 1
src/hooks/useGame.tsx

@@ -44,6 +44,9 @@ const useGame = () => {
                     eventStartTrial();
 
                     const game_url = res.data.game_url;
+                    // 获取游戏的品牌
+                    console.log(`🚀🚀🚀🚀🚀-> in useGame.tsx on 28`,game,res.data);
+
                     // 然后是文档对象
                     if (game_url.indexOf("!doctype") !== -1) {
                         sessionStorage.setItem("game_url", res.data.game_url);
@@ -51,7 +54,16 @@ const useGame = () => {
                         router.push(`/game?${url}`);
                         return;
                     }
-                    const url = `${encodeURI(res.data.game_url)}&return_url=${encodeURI(window.location.href.replace(pathname, ""))}&category_name=${game.provider}`;
+                    // const url = `${encodeURI(res.data.game_url)}&return_url=${encodeURI(window.location.href.replace(pathname, ""))}&category_name=${game.provider}`;
+                    const url = `${encodeURI(res.data.game_url)}&brand=${brand}&return_url=${window.location.href.replace(pathname, "")}&category_name=${game.provider}`;
+
+                    // 如果是pp游戏,在当前页面打开游戏地址,不需要新窗口打开,不需要return_url
+                    // if(brand === 'pp'){
+                    //   const ppUrl = `${encodeURI(res.data.game_url)}&brand=${brand}&category_name=${game.provider}`;
+                    //   window.open(ppUrl,'_self');
+                    //   return
+                    // }
+
                     if (new RegExp("https").test(game_url)) {
                         // 如果是https
                         router.push(`/game?${url}`);