Sfoglia il codice sorgente

无免费/重玩币 弹窗提示不跳转

XianCH 4 mesi fa
parent
commit
f231397f8f
1 ha cambiato i file con 24 aggiunte e 14 eliminazioni
  1. 24 14
      src/components/Card/Card.tsx

+ 24 - 14
src/components/Card/Card.tsx

@@ -6,7 +6,7 @@ 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 { Button, Popup, Toast } from "antd-mobile";
 import { useTranslations } from "next-intl";
 import { FC, PropsWithChildren, ReactNode, useEffect, useRef, useState } from "react";
 import TipsModal, { ModalProps } from "../TipsModal";
@@ -53,14 +53,24 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
             router.push("/deposit");
             return;
         }
+
         // 免费游戏
         if (type === 2 && Number(wallet.free_score) <= 0) {
-            router.push("/deposit");
+            // router.push("/deposit");
+            Toast.show({
+                icon: 'fail',
+                content: 'No free coins',
+                maskClickable: false
+            })
             return;
         }
         // 重玩游戏
         if (type === 3 && Number(wallet.lose_score) <= 0) {
-            router.push("/deposit");
+            Toast.show({
+                icon: 'fail',
+                content: 'No replay coins',
+                maskClickable: false
+            })
             return;
         }
 
@@ -160,17 +170,17 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
                             {/* 只是PG游戏展示demo试玩按钮 */}
                             {(item?.category_name === "Pragmaticplay" ||
                                 item?.category_name === "PP") && (
-                                <Button
-                                    onClick={() => demoPlayGameHandler({ ...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={() => demoPlayGameHandler({ ...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={{