year пре 1 дан
родитељ
комит
71358251a6

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

@@ -5,7 +5,7 @@ import NoticeBox from "@/components/NoticeBox";
 import feedback from "@/feedback";
 import { useRouter } from "@/i18n/routing";
 import { useSystemStore } from "@/stores/useSystemStore";
-import { formatAmount } from "@/utils";
+import { formatAmount, hasToast } from "@/utils";
 import { Tabs } from "antd-mobile";
 import clsx from "clsx";
 import React, { FC } from "react";
@@ -81,7 +81,7 @@ const HomePrize: FC<Props> = (props) => {
     }, [data, autoPlay]);
 
     const doShowWin = async () => {
-        if (!(feedback.hasShowDialog() || isCollapse)) {
+        if (!(feedback.hasShowDialog() || isCollapse || !hasToast())) {
             if (winRef.current) {
                 clearTimeout(winRef.current);
                 winRef.current = null;

+ 11 - 11
src/components/Card/Card.tsx

@@ -68,10 +68,11 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
             duration: 0,
             maskStyle: { zIndex: 99999, background: "rgba(0,0,0,0.5)" },
         });
+
         const res: any = await systemStore.setupConfig();
         if (res?.recharge_enable) {
             if (wallet.deposit <= 0) {
-                toastRef.current?.hide();
+                toastRef.current?.close();
                 await feedback.showModal({
                     content: (modalProps: any) => (
                         <>
@@ -110,20 +111,21 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
             }
         }
         if (!wallet?.score || wallet?.score <= 0) {
-            toastRef.current?.hide();
+            toastRef.current?.close();
             router.push("/deposit");
             return;
         }
         if (!res?.browser_enable) {
             if (!isPWAorAPK()) {
                 if (isIOS()) {
-                    toastRef.current?.hide();
+                    toastRef.current?.close();
                     await feedback.showImage({
                         imgUrl: "/store/ios.webp",
                     });
                     return;
                 }
-                toastRef.current?.hide();
+
+                toastRef.current?.close();
                 await feedback.showModal({
                     content: () => {
                         return <InstallAPK></InstallAPK>;
@@ -134,8 +136,6 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
                     useDefaultFooter: false,
                     maskClose: true,
                 });
-
-                // dialogManage.showDialog("InstallAPK");
                 return;
             }
         }
@@ -152,20 +152,20 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
         const type = getCoinType(game, groupType!);
 
         if (!token) {
-            toastRef.current?.hide();
+            toastRef.current?.close();
             router.push("/login?redirect=/");
             return;
         }
         // 现金游戏
         if (type === 1 && Number(wallet.score) + wallet.point <= 0) {
-            toastRef.current?.hide();
+            toastRef.current?.close();
             router.push("/deposit");
             return;
         }
 
         // 免费游戏
         if (type === 2 && Number(wallet.free_score) <= 0) {
-            toastRef.current?.hide();
+            toastRef.current?.close();
             // router.push("/deposit");
             Toast.show({
                 icon: "fail",
@@ -176,7 +176,7 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
         }
         // 重玩游戏
         if (type === 3 && Number(wallet.lose_score) <= 0) {
-            toastRef.current?.hide();
+            toastRef.current?.close();
             Toast.show({
                 icon: "fail",
                 content: "No replay coins",
@@ -221,7 +221,7 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
             gameRef.current = unfinishedGame;
             setVisible(false);
             gameModelRef.current?.onOpen();
-            toastRef.current?.hide();
+            toastRef.current?.close();
             return;
         }
         getGameUrl(brandRef.current!, params);

+ 4 - 0
src/utils/index.ts

@@ -207,3 +207,7 @@ export const sleep = (wait: number = 1000) => {
         }, wait);
     });
 };
+
+export const hasToast = () => {
+    return document.querySelectorAll(".adm-mask.adm-toast-mask").length > 0;
+};