Prechádzať zdrojové kódy

fix: 分组增加游戏类型

Before 8 mesiacov pred
rodič
commit
2bd5331bf8

+ 5 - 0
src/api/home.ts

@@ -84,6 +84,11 @@ export interface Category {
      * 类型 1:game 2:brand 3:title
      */
     type: number;
+    /**
+     * @description 分组类型
+     *   1 普通游戏(现金+ 彩金) 2:免费币 3:重玩币"
+     */
+    bet_type: 1 | 2 | 3;
 }
 
 /**

+ 14 - 0
src/components/Box/RedPacketModal.tsx

@@ -363,6 +363,19 @@ export type RedPacketModalProps = {
     onClose: () => void;
     onOpen: () => void;
 };
+
+/**
+ * @description 红包的三种状态
+ * is_start 可领取 展示红包领取组件
+ * is_receive 已领取 展示领取详情组件
+ * is_end 可展示 展示详情界面
+ */
+enum Status {
+    is_start,
+    is_receive,
+    is_end,
+}
+
 const RedPacketModal = forwardRef<RedPacketModalProps, Props>(function RedPacketModal(props, ref) {
     const [visible, setVisible] = useState(false);
 
@@ -370,6 +383,7 @@ const RedPacketModal = forwardRef<RedPacketModalProps, Props>(function RedPacket
     const [isShowRed, setIsShowRed] = useState(false);
     const [isShowReciveRed, setIsShowReciveRed] = useState(false);
     const [isShowRedDetail, setIsShowRedDetail] = useState(false);
+
     const [redPacketInfo, setRedPacketInfo] = useState<any>({});
     const [redAmount, setRedAmount] = useState<any>(0);
     const token = getToken();

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

@@ -1,5 +1,5 @@
 "use client";
-import { GameListRep, getGameDetailApi } from "@/api/home";
+import { Category, GameListRep, getGameDetailApi } from "@/api/home";
 import Box from "@/components/Box";
 import { useRouter } from "@/i18n";
 import { useWalletStore } from "@/stores/useWalletStore";
@@ -12,9 +12,10 @@ import styles from "./style.module.scss";
 export interface CardProps {
     item?: GameListRep;
     render?: (value: GameListRep) => ReactNode;
+    group?: Category;
 }
 const Card: FC<PropsWithChildren<CardProps>> = (props) => {
-    const { render, item } = props;
+    const { render, item, group } = props;
 
     const t = useTranslations("Game");
     const urlRef = useRef<string>("");
@@ -31,6 +32,7 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
         if (!token) return;
         const params = {
             id: game.id,
+            mode: group?.bet_type,
         };
         getGameDetailApi(params).then((res) => {
             urlRef.current = res.data?.game_url;

+ 2 - 1
src/components/Card/GroupCard.tsx

@@ -1,4 +1,4 @@
-import { GameListRep } from "@/api/home";
+import { Category, GameListRep } from "@/api/home";
 import clsx from "clsx";
 import { FC } from "react";
 import Card, { CardProps } from "./Card";
@@ -7,6 +7,7 @@ export interface GroupProps extends CardProps {
     col?: number;
     row?: number;
     gapX?: number;
+    group?: Category;
 }
 
 const GroupCard: FC<GroupProps> = (props) => {

+ 5 - 1
src/components/Card/SwiperGroup.tsx

@@ -119,7 +119,11 @@ const HomeSwiper: FC<PropsWithChildren<SwiperGroupProps>> = (props) => {
                                 {slideRender ? (
                                     slideRender(data.data)
                                 ) : (
-                                    <GroupCard data={data.data} {...other}></GroupCard>
+                                    <GroupCard
+                                        data={data.data}
+                                        {...other}
+                                        group={group}
+                                    ></GroupCard>
                                 )}
                             </SwiperSlide>
                         ))}

+ 1 - 1
src/components/Footer/index.tsx

@@ -71,7 +71,7 @@ const Footer: FC = () => {
     }));
 
     const { run } = useRequest(getGlobalNoticeApi, {
-        pollingInterval: 5000,
+        pollingInterval: 10000,
         manual: true,
         pollingErrorRetryCount: 3,
         pollingWhenHidden: false,

+ 1 - 1
src/components/Header/HeaderRight.tsx

@@ -21,7 +21,7 @@ const HeaderRight = () => {
     };
 
     useRequest(getUserMoneyHandler, {
-        pollingInterval: 3000,
+        pollingInterval: 8000,
         pollingWhenHidden: true,
         pollingErrorRetryCount: 3,
         staleTime: 5000,