|
@@ -2,15 +2,22 @@
|
|
|
import { Category, GameListRep, GameRequest, toggleFavorite } from "@/api/home";
|
|
|
import { userInfoApi } from "@/api/login";
|
|
|
import CustomImage from "@/components/Image";
|
|
|
+import { WrapHocPosition } from "@/enums";
|
|
|
+import feedback from "@/feedback";
|
|
|
import useGame from "@/hooks/useGame";
|
|
|
import { useRouter } from "@/i18n/routing";
|
|
|
+import { useSystemStore } from "@/stores/useSystemStore";
|
|
|
import { useWalletStore } from "@/stores/useWalletStore";
|
|
|
+import { isPWAorAPK } from "@/utils";
|
|
|
import { getToken } from "@/utils/Cookies";
|
|
|
+import { isIOS } from "@/utils/methods";
|
|
|
import { Button, Popup, Toast } from "antd-mobile";
|
|
|
import clsx from "clsx";
|
|
|
import { useTranslations } from "next-intl";
|
|
|
import { FC, PropsWithChildren, ReactNode, useEffect, useRef, useState } from "react";
|
|
|
import { shallow } from "zustand/shallow";
|
|
|
+import CustomButton from "../CustomButton";
|
|
|
+import InstallAPK from "../InstallApk";
|
|
|
import TipsModal, { ModalProps } from "../TipsModal";
|
|
|
import styles from "./style.module.scss";
|
|
|
|
|
@@ -25,7 +32,7 @@ export interface CardProps {
|
|
|
|
|
|
const Card: FC<PropsWithChildren<CardProps>> = (props) => {
|
|
|
const { render, item, groupType, className } = props;
|
|
|
-
|
|
|
+ const systemStore = useSystemStore();
|
|
|
const { getGameUrl, getCoinType } = useGame();
|
|
|
const t = useTranslations("Game");
|
|
|
const brandRef = useRef<GameListRep | null>(null);
|
|
@@ -36,6 +43,7 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
|
|
|
point: state.wallet?.point,
|
|
|
free_score: state.wallet?.free_score,
|
|
|
lose_score: state.wallet?.lose_score,
|
|
|
+ deposit: state.wallet?.deposit,
|
|
|
};
|
|
|
}, shallow);
|
|
|
// 判断是否有未结算的对局
|
|
@@ -48,9 +56,102 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
|
|
|
const router = useRouter();
|
|
|
const token = getToken();
|
|
|
// 点击检测弹窗
|
|
|
- const handler = (game: GameListRep) => {
|
|
|
+ const handler = async (game: GameListRep) => {
|
|
|
+ if (!token) {
|
|
|
+ router.push("/login");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const res: any = await systemStore.setupConfig();
|
|
|
+ if (!res?.recharge_enable) {
|
|
|
+ if (wallet.deposit <= 0) {
|
|
|
+ const feedRes = await feedback.showModal({
|
|
|
+ content: (modalProps: any) => (
|
|
|
+ <>
|
|
|
+ <div className="relative h-[.5rem] rounded-[.1rem_.1rem_0_0] bg-[var(--primary3)]">
|
|
|
+ <div className="absolute bottom-0 left-[50%] flex h-[.5rem] w-[.5rem] translate-x-[-50%] translate-y-[50%] items-center justify-center rounded-[50%] bg-[var(--primary3)]">
|
|
|
+ <i className="iconfont icon-Group5 text-[.24rem] text-[#fff]"></i>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div className="flex flex-col items-center px-[.15rem] pt-[.4rem] text-center text-[.15rem] font-bold">
|
|
|
+ <div className="front-black mb-[.3rem] text-[.16rem]">
|
|
|
+ Recarregue e desbloqueie!
|
|
|
+ </div>
|
|
|
+ <div className="text-[.12rem] font-[400] text-[var(--adm-color-weak)]">
|
|
|
+ Sua recompensa exclusiva será ativada automaticamente após o
|
|
|
+ depósito. Jogue agora e aproveite prêmios incríveis!
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div className="p-[.15rem]">
|
|
|
+ <CustomButton
|
|
|
+ onClick={() => {
|
|
|
+ router.push("/deposit");
|
|
|
+ modalProps?.doClose("confirm");
|
|
|
+ }}
|
|
|
+ className="!w-full"
|
|
|
+ >
|
|
|
+ Depósito
|
|
|
+ </CustomButton>
|
|
|
+ </div>
|
|
|
+ </>
|
|
|
+ ),
|
|
|
+ useDefaultFooter: false,
|
|
|
+ containerClassName: "p-0",
|
|
|
+ width: "70%",
|
|
|
+ });
|
|
|
+ // dialogManage.showDialog("AlertDialog", {
|
|
|
+ // content: (
|
|
|
+ // <div className="flex flex-col items-center px-[.15rem] pt-[.5rem] text-center text-[.15rem] font-bold">
|
|
|
+ // <img src="/home/gold.webp" className="mb-[.15rem] w-[1rem]" alt="" />
|
|
|
+ // <div className="mb-[.1rem]">
|
|
|
+ // A recompensa para novos usuários será ativada após o depósito
|
|
|
+ // </div>
|
|
|
+ // <div className="text-[#11de68]">podendo jogar em seguida.</div>
|
|
|
+ // </div>
|
|
|
+ // ),
|
|
|
+ // footerText: "Depósito",
|
|
|
+ // onConfirm: () => {
|
|
|
+ // dialogManage.hideDialog("AlertDialog");
|
|
|
+ // router.push("/deposit");
|
|
|
+ // },
|
|
|
+ // });
|
|
|
+ console.log(feedRes);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // if (!wallet?.score || wallet?.score <= 0) {
|
|
|
+ // router.push("/deposit");
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+
|
|
|
+ if (!res?.browser_enable) {
|
|
|
+ if (!isPWAorAPK()) {
|
|
|
+ if (isIOS()) {
|
|
|
+ await feedback.showImage({
|
|
|
+ imgUrl: "/store/ios.webp",
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ await feedback.showModal({
|
|
|
+ content: () => {
|
|
|
+ return <InstallAPK></InstallAPK>;
|
|
|
+ },
|
|
|
+ position: WrapHocPosition.bottom,
|
|
|
+ showClose: false,
|
|
|
+ containerClassName: styles.installApk,
|
|
|
+ useDefaultFooter: false,
|
|
|
+ maskClose: true,
|
|
|
+ });
|
|
|
+
|
|
|
+ // dialogManage.showDialog("InstallAPK");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
setVisible(true);
|
|
|
brandRef.current = game;
|
|
|
+ // setVisible(true);
|
|
|
+ // brandRef.current = game;
|
|
|
};
|
|
|
useEffect(() => {
|
|
|
element.current = document.getElementById("app");
|
|
@@ -189,8 +290,7 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
|
|
|
height={"100%"}
|
|
|
className={"h-[100%] w-[100%]"}
|
|
|
></CustomImage>
|
|
|
- {/* && item?.online_user */}
|
|
|
- {props.isShowOnline && (
|
|
|
+ {props.isShowOnline && item?.online_user && (
|
|
|
<div className={styles.cardOnline}>
|
|
|
<i className="iconfont icon-fangke2 text-[.08rem] text-[#11de68]"></i>
|
|
|
<span className="relative top-[1px] ml-[.04rem] text-[.1rem]">
|