Browse Source

编码游戏链接return_url

ansoni 5 months ago
parent
commit
a2379f64fc
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/hooks/useGame.tsx

+ 2 - 2
src/hooks/useGame.tsx

@@ -29,11 +29,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=${window.location.href.replace(pathname, "")}&category_name=${game.provider}`;
+                        const url = `${encodeURI(window.location.href)}&return_url=${encodeURI(window.location.href.replace(pathname, ""))}&category_name=${game.provider}`;
                         router.push(`/game?${url}`);
                         return;
                     }
-                    const url = `${encodeURI(res.data.game_url)}&return_url=${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}`;
                     if (new RegExp("https").test(game_url)) {
                         // 如果是https
                         router.push(`/game?${url}`);