|
@@ -36,6 +36,8 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
|
|
|
const { getGameUrl, getCoinType } = useGame();
|
|
|
const t = useTranslations("Game");
|
|
|
const brandRef = useRef<GameListRep | null>(null);
|
|
|
+ const toastRef = useRef<any>(null);
|
|
|
+
|
|
|
const [isFavorite, setIsFavorite] = useState(item?.is_favorite === 1 || false);
|
|
|
const wallet = useWalletStore((state) => {
|
|
|
return {
|
|
@@ -61,10 +63,16 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
|
|
|
router.push("/login");
|
|
|
return;
|
|
|
}
|
|
|
+ toastRef.current = Toast.show({
|
|
|
+ icon: "loading",
|
|
|
+ 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) {
|
|
|
- const feedRes = await feedback.showModal({
|
|
|
+ toastRef.current?.hide();
|
|
|
+ await feedback.showModal({
|
|
|
content: (modalProps: any) => (
|
|
|
<>
|
|
|
<div className="relative h-[.5rem] rounded-[.1rem_.1rem_0_0] bg-[var(--primary3)]">
|
|
@@ -98,23 +106,24 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
|
|
|
containerClassName: "p-0",
|
|
|
width: "70%",
|
|
|
});
|
|
|
-
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
if (!wallet?.score || wallet?.score <= 0) {
|
|
|
+ toastRef.current?.hide();
|
|
|
router.push("/deposit");
|
|
|
return;
|
|
|
}
|
|
|
if (!res?.browser_enable) {
|
|
|
if (!isPWAorAPK()) {
|
|
|
if (isIOS()) {
|
|
|
+ toastRef.current?.hide();
|
|
|
await feedback.showImage({
|
|
|
imgUrl: "/store/ios.webp",
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
+ toastRef.current?.hide();
|
|
|
await feedback.showModal({
|
|
|
content: () => {
|
|
|
return <InstallAPK></InstallAPK>;
|
|
@@ -130,8 +139,6 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- // setVisible(true);
|
|
|
brandRef.current = game;
|
|
|
playGameHandler(game);
|
|
|
|
|
@@ -145,17 +152,20 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
|
|
|
const type = getCoinType(game, groupType!);
|
|
|
|
|
|
if (!token) {
|
|
|
+ toastRef.current?.hide();
|
|
|
router.push("/login?redirect=/");
|
|
|
return;
|
|
|
}
|
|
|
// 现金游戏
|
|
|
if (type === 1 && Number(wallet.score) + wallet.point <= 0) {
|
|
|
+ toastRef.current?.hide();
|
|
|
router.push("/deposit");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
// 免费游戏
|
|
|
if (type === 2 && Number(wallet.free_score) <= 0) {
|
|
|
+ toastRef.current?.hide();
|
|
|
// router.push("/deposit");
|
|
|
Toast.show({
|
|
|
icon: "fail",
|
|
@@ -166,6 +176,7 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
|
|
|
}
|
|
|
// 重玩游戏
|
|
|
if (type === 3 && Number(wallet.lose_score) <= 0) {
|
|
|
+ toastRef.current?.hide();
|
|
|
Toast.show({
|
|
|
icon: "fail",
|
|
|
content: "No replay coins",
|
|
@@ -210,6 +221,7 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
|
|
|
gameRef.current = unfinishedGame;
|
|
|
setVisible(false);
|
|
|
gameModelRef.current?.onOpen();
|
|
|
+ toastRef.current?.hide();
|
|
|
return;
|
|
|
}
|
|
|
getGameUrl(brandRef.current!, params);
|