Browse Source

pp游戏添加demo试玩按钮

zcj03 6 months ago
parent
commit
5ccbfaee5c
2 changed files with 23 additions and 12 deletions
  1. 2 0
      src/api/home.ts
  2. 21 12
      src/components/Card/Card.tsx

+ 2 - 0
src/api/home.ts

@@ -132,6 +132,8 @@ export interface GameListRep {
      * 时间
      */
     release_date: string;
+    // 自定义demo试玩
+    demo?: number
 }
 
 export const getGamesApi = () => {

+ 21 - 12
src/components/Card/Card.tsx

@@ -41,11 +41,17 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
             router.push("/deposit");
             return;
         }
-
-        const params = {
+        let params: any = {
             id: game.id + "",
             mode: groupType!,
         };
+        // demo试玩
+        if (game?.demo) {
+            params = {
+                id: game.id + "",
+                demo: game.demo,
+            };
+        }
         getGameUrl(brandRef.current!, params);
     };
     return (
@@ -86,16 +92,19 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
                         <p className={"h-[0.6rem]"}>{item?.game_name_cn}</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>*/}
+                            {/* 只是pp游戏展示demo试玩按钮 */}
+                            {
+                               (item?.game_id + '').startsWith('1') && <Button
+                                    onClick={() => playGameHandler({...item!, demo: 1})}
+                                    className={
+                                    "h-[0.39rem] w-[0.89rem] rounded-[0.05rem] text-[0.15rem]" +
+                                    " bg-[#3a3a3a]" +
+                                    " font-bold"
+                                    }
+                                >
+                                    {t("demo")}
+                                </Button> 
+                            }
                             <Button
                                 onClick={() => playGameHandler(item!)}
                                 style={{