|
@@ -2,6 +2,7 @@
|
|
|
import { GameListRep, getGameDetailApi } from "@/api/home";
|
|
|
import { useRouter } from "@/i18n";
|
|
|
import { useGlobalStore } from "@/stores";
|
|
|
+import { brandList } from "@/utils/constant";
|
|
|
import { Button, Modal, ModalBody, ModalContent, useDisclosure } from "@nextui-org/react";
|
|
|
import { Toast } from "antd-mobile";
|
|
|
import { useTranslations } from "next-intl";
|
|
@@ -13,21 +14,20 @@ export interface CardProps {
|
|
|
}
|
|
|
const Card: FC<PropsWithChildren<CardProps>> = (props) => {
|
|
|
const { render, item } = props;
|
|
|
- const { isOpen, onOpen, onOpenChange } = useDisclosure();
|
|
|
+ const { isOpen, onOpen, onOpenChange, onClose } = useDisclosure();
|
|
|
const app: HTMLElement = document.querySelector("#app")!;
|
|
|
const t = useTranslations("Game");
|
|
|
const urlRef = useRef<string>("");
|
|
|
+ const brandRef = useRef<string>("");
|
|
|
|
|
|
const state = useGlobalStore();
|
|
|
const router = useRouter();
|
|
|
-
|
|
|
+ const { token } = state;
|
|
|
const handler = (game: GameListRep) => {
|
|
|
- const { token } = state;
|
|
|
onOpen();
|
|
|
- if (!token) {
|
|
|
- router.push("/login?redirect=/withdraw");
|
|
|
- return;
|
|
|
- }
|
|
|
+ brandRef.current = brandList.find((item) => item.gid === game.game_id)?.brand ?? "";
|
|
|
+
|
|
|
+ if (!token) return;
|
|
|
const params = {
|
|
|
id: game.id,
|
|
|
};
|
|
@@ -36,11 +36,16 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
|
|
|
});
|
|
|
};
|
|
|
const playGameHandler = () => {
|
|
|
+ if (!token) {
|
|
|
+ router.push("/login?redirect=/withdraw");
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (urlRef.current) {
|
|
|
- window.open(urlRef.current);
|
|
|
+ window.open(`${urlRef.current}&brand=${brandRef.current}`);
|
|
|
} else {
|
|
|
Toast.show("数据错误");
|
|
|
}
|
|
|
+ onClose();
|
|
|
};
|
|
|
return (
|
|
|
<>
|