|
@@ -1,22 +1,25 @@
|
|
|
"use client";
|
|
|
+import { gamesNoticeWinApi } from "@/api/home";
|
|
|
import { useTranslations } from "next-intl";
|
|
|
-import { FC } from "react";
|
|
|
+import { FC, useEffect, useState } from "react";
|
|
|
import { Autoplay } from "swiper/modules";
|
|
|
import { Swiper, SwiperSlide } from "swiper/react";
|
|
|
interface Props {}
|
|
|
|
|
|
-const mockData = [
|
|
|
- { url: "/9f/551935.jpg", name: "123", money: 11 },
|
|
|
- { url: "/9f/551935.jpg", name: "123", money: 11 },
|
|
|
- { url: "/9f/551935.jpg", name: "123", money: 11 },
|
|
|
- { url: "/9f/551935.jpg", name: "123", money: 11 },
|
|
|
- { url: "/9f/551935.jpg", name: "123", money: 11 },
|
|
|
- { url: "/9f/551935.jpg", name: "123", money: 11 },
|
|
|
- { url: "/9f/551935.jpg", name: "123", money: 11 },
|
|
|
-];
|
|
|
-const HomePrize: FC<Props> = (props) => {
|
|
|
+const HomePrize: FC<Props> = () => {
|
|
|
const t = useTranslations("HomePage");
|
|
|
|
|
|
+ const [winImg, setWinImg] = useState<any>([]);
|
|
|
+ const gamesNoticeWinRequest = async () => {
|
|
|
+ gamesNoticeWinApi()
|
|
|
+ .then((res: any) => {
|
|
|
+ if (res.code === 200) setWinImg(res.data || []);
|
|
|
+ })
|
|
|
+ };
|
|
|
+ useEffect(() => {
|
|
|
+ gamesNoticeWinRequest()
|
|
|
+ }, [])
|
|
|
+
|
|
|
return (
|
|
|
<div className={"my-[0.0694rem]"}>
|
|
|
<div className={"mb-[0.0347rem]"}>{t("prize")}</div>
|
|
@@ -33,13 +36,13 @@ const HomePrize: FC<Props> = (props) => {
|
|
|
modules={[Autoplay]}
|
|
|
className="mySwiper"
|
|
|
>
|
|
|
- {mockData.map((prize, index) => (
|
|
|
+ {winImg.map((prize: any, index: number) => (
|
|
|
<SwiperSlide key={index}>
|
|
|
<div className={"w-[1.1rem] bg-[#1c1e22]"}>
|
|
|
- <img className={"h-[1.54rem]"} src={prize.url} alt="" />
|
|
|
+ <img className={"h-[1.54rem]"} src={prize.game_icon} alt="" />
|
|
|
<div className={"px-[0.13rem] pb-[0.0347rem] text-[0.13rem]"}>
|
|
|
- <p className={"text-[#98a7b5]"}>{prize.name}</p>
|
|
|
- <p className={"text-[#43c937]"}>R${prize.money}</p>
|
|
|
+ <p className={"text-[#98a7b5]"}>{prize.game_name}</p>
|
|
|
+ <p className={"text-[#43c937]"}>R${prize.amount}</p>
|
|
|
</div>
|
|
|
</div>
|
|
|
</SwiperSlide>
|