Browse Source

fix: 跳转链接

Before 1 year ago
parent
commit
6a8ae59344

+ 1 - 1
src/app/[locale]/(ordinary)/gameList/[gameListFlag]/page.tsx

@@ -8,7 +8,7 @@ const GameListFlag: FC<Props> = (props) => {
     return (
         <div
             className={
-                "w-1/1 flex h-[200px] items-center justify-center border-1" +
+                "w-1/1 flex h-[100vh] items-center justify-center border-1" +
                 " border-[#4d4d4d]" +
                 " text-[0.12rem] text-[#4d4d4d]"
             }

+ 1 - 0
src/app/[locale]/_home/HomeGames.tsx

@@ -90,6 +90,7 @@ const HomeSwiper: FC<PropsWithChildren<Props>> = (props) => {
                             key={index}
                             group={group}
                             col={3}
+                            visibleTodos={false}
                             todoHandler={todoHandler}
                         ></SwiperGroup>
                     );

+ 9 - 4
src/components/Card/Card.tsx

@@ -3,6 +3,7 @@ import { GameListRep, getGameDetailApi } from "@/api/home";
 import { useRouter } from "@/i18n";
 import { useGlobalStore } from "@/stores";
 import { Button, Modal, ModalBody, ModalContent, useDisclosure } from "@nextui-org/react";
+import { Toast } from "antd-mobile";
 import { useTranslations } from "next-intl";
 import { FC, PropsWithChildren, ReactNode, useRef } from "react";
 import styles from "./style.module.scss";
@@ -21,20 +22,24 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
     const router = useRouter();
 
     const handler = (game: GameListRep) => {
+        const { token } = state;
         onOpen();
+        if (!token) {
+            router.push("/login?redirect=/withdraw");
+            return;
+        }
         const params = {
             id: game.id,
         };
         getGameDetailApi(params).then((res) => {
-            urlRef.current = res.data.game_url;
+            urlRef.current = res.data?.game_url;
         });
     };
     const playGameHandler = () => {
-        const { token } = state;
-        if (token) {
+        if (urlRef.current) {
             window.open(urlRef.current);
         } else {
-            router.push("/login");
+            Toast.show("数据错误");
         }
     };
     return (