|
@@ -5,9 +5,9 @@ import useGame from "@/hooks/useGame";
|
|
|
import { useRouter } from "@/i18n/routing";
|
|
|
import { useWalletStore } from "@/stores/useWalletStore";
|
|
|
import { getToken } from "@/utils/Cookies";
|
|
|
-import { Button, Popup } from "antd-mobile";
|
|
|
+import { Button, CenterPopup, Popup } from "antd-mobile";
|
|
|
import { useTranslations } from "next-intl";
|
|
|
-import { FC, PropsWithChildren, ReactNode, useRef, useState } from "react";
|
|
|
+import { FC, PropsWithChildren, ReactNode, useEffect, useRef, useState } from "react";
|
|
|
import styles from "./style.module.scss";
|
|
|
import { userInfoApi } from "@/api/login";
|
|
|
import TipsModal, { ModalProps } from "../TipsModal";
|
|
@@ -30,6 +30,7 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
|
|
|
const gameRef = useRef<GameListRep & { mode: GameRequest["mode"] } | null>(null);
|
|
|
|
|
|
const [visible, setVisible] = useState(false);
|
|
|
+ const element = useRef<HTMLElement | null>(null);
|
|
|
|
|
|
const router = useRouter();
|
|
|
const token = getToken();
|
|
@@ -37,6 +38,9 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
|
|
|
setVisible(true);
|
|
|
brandRef.current = game;
|
|
|
};
|
|
|
+ useEffect(() => {
|
|
|
+ element.current = document.getElementById("app");
|
|
|
+ }, []);
|
|
|
const playGameHandler = async (game: GameListRep) => {
|
|
|
if (!token) {
|
|
|
router.push("/login?redirect=/");
|
|
@@ -140,16 +144,16 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
|
|
|
<div className={"flex w-[2.2rem] justify-around"}>
|
|
|
{/* 只是PG游戏展示demo试玩按钮 */}
|
|
|
{
|
|
|
- (item?.category_name === 'Pragmaticplay' || item?.category_name === 'PP') && <Button
|
|
|
- onClick={() => playGameHandler({...item!, demo: 1})}
|
|
|
+ (item?.category_name === 'Pragmaticplay' || item?.category_name === 'PP') && <Button
|
|
|
+ onClick={() => playGameHandler({ ...item!, demo: 1 })}
|
|
|
className={
|
|
|
- "h-[0.39rem] w-[0.89rem] rounded-[0.05rem] text-[0.15rem]" +
|
|
|
- " bg-[#3a3a3a]" +
|
|
|
- " font-bold"
|
|
|
+ "h-[0.39rem] w-[0.89rem] rounded-[0.05rem] text-[0.15rem]" +
|
|
|
+ " bg-[#3a3a3a]" +
|
|
|
+ " font-bold"
|
|
|
}
|
|
|
>
|
|
|
{t("demo")}
|
|
|
- </Button>
|
|
|
+ </Button>
|
|
|
}
|
|
|
<Button
|
|
|
onClick={() => playGameHandler(item!)}
|
|
@@ -166,7 +170,7 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
|
|
|
</Box>
|
|
|
</Popup>
|
|
|
|
|
|
- <TipsModal title={"Tips"} ref={gameModelRef}>
|
|
|
+ <TipsModal title={"Tips"} ref={gameModelRef} getContainer={element.current}>
|
|
|
<p className={"text-left text-[0.12rem] font-medium text-[#666]"}>
|
|
|
Há jogos inconclusos continuar o jogo
|
|
|
</p>
|