|
@@ -1,14 +1,8 @@
|
|
|
"use client";
|
|
|
import { PrizeTypes } from "@/api/home";
|
|
|
-import Box from "@/components/Box";
|
|
|
-import styles from "@/components/Card/style.module.scss";
|
|
|
-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 { Card } from "@/components/Card";
|
|
|
import { useTranslations } from "next-intl";
|
|
|
-import { FC, useRef, useState } from "react";
|
|
|
+import { FC } from "react";
|
|
|
import { Autoplay } from "swiper/modules";
|
|
|
import { Swiper, SwiperSlide } from "swiper/react";
|
|
|
|
|
@@ -21,53 +15,6 @@ const HomePrize: FC<Props> = (props) => {
|
|
|
const t = useTranslations("HomePage");
|
|
|
const tt = useTranslations("Game");
|
|
|
|
|
|
- const [winImg, setWinImg] = useState<any>([{}]);
|
|
|
- // const { run, cancel } = useRequest(gamesNoticeWinApi, {
|
|
|
- // pollingInterval: 600000,
|
|
|
- // pollingWhenHidden: true,
|
|
|
- // pollingErrorRetryCount: 3,
|
|
|
- // staleTime: 5000,
|
|
|
- // onError: (error) => {},
|
|
|
- // onSuccess: (res) => {
|
|
|
- // console.log(`🚀🚀🚀🚀🚀-> in HomePrize.tsx on 30`, res);
|
|
|
- // setWinImg(res.data || []);
|
|
|
- // },
|
|
|
- // });
|
|
|
-
|
|
|
- const [visible, setVisible] = useState(false);
|
|
|
- // const [gameInfo, setGameInfo] = useState<any>({});
|
|
|
- const gameInfo = useRef<PrizeTypes | null>(null);
|
|
|
- const handler = (game: PrizeTypes) => {
|
|
|
- setVisible(true);
|
|
|
- console.log(`🚀🚀🚀🚀🚀-> in HomePrize.tsx on 39`, game);
|
|
|
- // setGameInfo(game);
|
|
|
-
|
|
|
- gameInfo.current = game;
|
|
|
- };
|
|
|
-
|
|
|
- const router = useRouter();
|
|
|
- const token = getToken();
|
|
|
- const wallet = useWalletStore((state) => state.wallet);
|
|
|
- const { getGameUrl } = useGame();
|
|
|
- const playGameHandler = () => {
|
|
|
- setVisible(true);
|
|
|
- if (!token) {
|
|
|
- router.push("/login?redirect=/");
|
|
|
- return;
|
|
|
- }
|
|
|
- let groupType = 1;
|
|
|
- if (groupType === 1 && Number(wallet.score) + wallet.point <= 0) {
|
|
|
- router.push("/deposit");
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- const params: any = {
|
|
|
- id: gameInfo.current?.id + "",
|
|
|
- mode: groupType!,
|
|
|
- };
|
|
|
- getGameUrl(gameInfo.current!, params);
|
|
|
- };
|
|
|
-
|
|
|
return (
|
|
|
<div className={"my-[0.0694rem]"}>
|
|
|
<div className={"mb-[0.0347rem]"}>{t("prize")}</div>
|
|
@@ -88,15 +35,9 @@ const HomePrize: FC<Props> = (props) => {
|
|
|
<SwiperSlide key={index}>
|
|
|
<div
|
|
|
className={"w-[1.1rem] bg-[#1c1e22]"}
|
|
|
- onClick={() => handler(prize)}
|
|
|
style={{ borderRadius: ".1rem" }}
|
|
|
>
|
|
|
- <img
|
|
|
- className={"h-[1.54rem]"}
|
|
|
- src={prize.game_icon}
|
|
|
- alt=""
|
|
|
- style={{ borderRadius: ".1rem" }}
|
|
|
- />
|
|
|
+ <Card item={prize} />
|
|
|
<div className={"px-[0.13rem] pb-[0.0347rem] text-[0.13rem]"}>
|
|
|
<p className={"text-[#98a7b5]"}>
|
|
|
{prize.phone
|
|
@@ -109,54 +50,6 @@ const HomePrize: FC<Props> = (props) => {
|
|
|
</SwiperSlide>
|
|
|
))}
|
|
|
</Swiper>
|
|
|
- <Popup
|
|
|
- visible={visible}
|
|
|
- onMaskClick={() => {
|
|
|
- setVisible(false);
|
|
|
- }}
|
|
|
- onClose={() => {
|
|
|
- setVisible(false);
|
|
|
- }}
|
|
|
- showCloseButton={true}
|
|
|
- getContainer={() => document.querySelector("#app")!}
|
|
|
- bodyStyle={{ background: "#1c1c1c" }}
|
|
|
- >
|
|
|
- <Box className={"w-1/1 flex w-[4.02rem] flex-1"}>
|
|
|
- <div className={styles.cardWrap} style={{ width: "1.1rem" }}>
|
|
|
- <img
|
|
|
- src={gameInfo.current?.game_icon}
|
|
|
- alt={gameInfo.current?.game_name}
|
|
|
- className={"h-[100%] w-[100%]"}
|
|
|
- />
|
|
|
- </div>
|
|
|
- <div className={styles.cardWrapGmeInfo}>
|
|
|
- <p className={"h-[0.6rem]"}>{gameInfo.current?.game_name}</p>
|
|
|
-
|
|
|
- <div className={"flex w-[2.2rem] justify-around"}>
|
|
|
- {/*<Button*/}
|
|
|
- {/* onClick={playGameHandler}*/}
|
|
|
- {/* className={*/}
|
|
|
- {/* "h-[0.39rem] w-[0.89rem] rounded-[0.05rem] text-[0.15rem]" +*/}
|
|
|
- {/* " bg-[#3a3a3a]" +*/}
|
|
|
- {/* " font-bold"*/}
|
|
|
- {/* }*/}
|
|
|
- {/*>*/}
|
|
|
- {/* {t("demo")}*/}
|
|
|
- {/*</Button>*/}
|
|
|
- <Button
|
|
|
- onClick={playGameHandler}
|
|
|
- style={{
|
|
|
- "--background-color": "#009d80",
|
|
|
- "--border-color": "#009d80",
|
|
|
- }}
|
|
|
- className={`h-[0.39rem] w-[0.89rem] rounded-[0.05rem] bg-[#] text-[0.15rem] font-bold`}
|
|
|
- >
|
|
|
- {tt("join")}
|
|
|
- </Button>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </Box>
|
|
|
- </Popup>
|
|
|
</div>
|
|
|
);
|
|
|
};
|