浏览代码

中奖列表接口对接

zcj03 7 月之前
父节点
当前提交
895e9d18c9

+ 7 - 0
src/api/home.ts

@@ -314,3 +314,10 @@ export const updateUserNoticeApi = (letter_id: number) => {
         data: { letter_id },
     });
 };
+
+// 获取中奖配置列表
+export const gamesNoticeWinApi = () => {
+    return server.post({
+        url: "/v1/api/front/games_notice_win",
+    });
+};

+ 18 - 15
src/app/[locale]/(TabBar)/[[...share]]/_home/HomePrize.tsx

@@ -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>

+ 1 - 1
src/app/[locale]/(TabBar)/[[...share]]/layout.tsx

@@ -46,7 +46,7 @@ const Layout: FC<PropsWithChildren<Props>> = (props) => {
                     {/* 搜索组件 */}
                     {searchWidget}
                     {/* 搜索下面的大奖展示 */}
-                    {/*{prizeWidget}*/}
+                    {prizeWidget}
                 </Box>
                 {/* tabs 和 游戏列表 */}
                 {children}

+ 14 - 14
src/app/[locale]/(TabBar)/profile/ProfileHeader.tsx

@@ -85,20 +85,20 @@ const WalletCard = (props: { userMoney: Wallet }) => {
     // 彩金、免费币、重玩币提现到钱包操作
     const handleAcquire = async () => {
         tipsRef.current?.onClose();
-        checkCodeApi({ code: "123", mobile: "18215519037" })
-        .then((res) => {
-            if (res.code === 200) {
-                Toast.show("领取成功!")
-                setTimeout(() => {
-                    tipsRef.current?.onClose();
-                }, 1000)
-                return;
-            }
-            Toast.show("领取失败!");
-        })
-        .catch((error) => {
-            Toast.show("领取失败!");
-        });
+        // checkCodeApi({ code: "123", mobile: "18215519037" })
+        // .then((res) => {
+        //     if (res.code === 200) {
+        //         Toast.show("领取成功!")
+        //         setTimeout(() => {
+        //             tipsRef.current?.onClose();
+        //         }, 1000)
+        //         return;
+        //     }
+        //     Toast.show("领取失败!");
+        // })
+        // .catch((error) => {
+        //     Toast.show("领取失败!");
+        // });
     };
 
     return (