Browse Source

fix: 修改游戏跳转链接

ansoni 1 month ago
parent
commit
adbab5f428
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/hooks/useGame.tsx

+ 2 - 2
src/hooks/useGame.tsx

@@ -50,11 +50,11 @@ const useGame = () => {
                     // 然后是文档对象
                     if (game_url.indexOf("!doctype") !== -1) {
                         sessionStorage.setItem("game_url", res.data.game_url);
-                        const url = `${encodeURI(window.location.href)}&return_url=${encodeURIComponent(window.location.href.replace(pathname, ""))}&category_name=${game.provider}`;
+                        const url = `${encodeURI(window.location.href)}&return_url=${encodeURIComponent(window.location.href)}&category_name=${game.provider}`;
                         router.push(`/game?${url}`);
                         return;
                     }
-                    const url = `${encodeURI(res.data.game_url)}&return_url=${encodeURIComponent(window.location.href.replace(pathname, ""))}&category_name=${game.provider}`;
+                    const url = `${encodeURI(res.data.game_url)}&return_url=${encodeURIComponent(window.location.href)}&category_name=${game.provider}`;
 
                     // 如果是pp游戏,则当前窗口打开新的地址,不需要加return_url
                     // gid 如果开头是1的6位数的数字,则认为是pp游戏