|
@@ -18,7 +18,6 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
|
|
|
const { render, item, groupType } = props;
|
|
|
|
|
|
const t = useTranslations("Game");
|
|
|
- const urlRef = useRef<string>("");
|
|
|
const brandRef = useRef<string>("");
|
|
|
const score = useWalletStore((state) => state.score);
|
|
|
|
|
@@ -30,15 +29,8 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
|
|
|
setVisible(true);
|
|
|
brandRef.current = brandList.find((item) => item.gid === game.game_id)?.brand ?? "";
|
|
|
if (!token) return;
|
|
|
- const params = {
|
|
|
- id: game.id,
|
|
|
- mode: groupType,
|
|
|
- };
|
|
|
- getGameDetailApi(params).then((res) => {
|
|
|
- urlRef.current = res.data?.game_url;
|
|
|
- });
|
|
|
};
|
|
|
- const playGameHandler = () => {
|
|
|
+ const playGameHandler = (game: GameListRep) => {
|
|
|
if (!token) {
|
|
|
router.push("/login?redirect=/");
|
|
|
return;
|
|
@@ -47,11 +39,22 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
|
|
|
router.push("/deposit");
|
|
|
return;
|
|
|
}
|
|
|
- if (urlRef.current) {
|
|
|
- window.open(`${urlRef.current}&brand=${brandRef.current}`);
|
|
|
- } else {
|
|
|
- Toast.show("数据错误");
|
|
|
- }
|
|
|
+ Toast.show({
|
|
|
+ icon: "loading",
|
|
|
+ duration: 0,
|
|
|
+ maskStyle: { zIndex: 99999, background: "rgba(0,0,0,0.5)" },
|
|
|
+ });
|
|
|
+ const params = {
|
|
|
+ id: game.id,
|
|
|
+ mode: groupType,
|
|
|
+ };
|
|
|
+ getGameDetailApi(params).then((res) => {
|
|
|
+ if (res.data && res.data.game_url) {
|
|
|
+ window.open(`${res.data?.game_url}&brand=${brandRef.current}`);
|
|
|
+ } else {
|
|
|
+ Toast.show("数据错误");
|
|
|
+ }
|
|
|
+ });
|
|
|
};
|
|
|
return (
|
|
|
<>
|
|
@@ -102,7 +105,7 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
|
|
|
{/* {t("demo")}*/}
|
|
|
{/*</Button>*/}
|
|
|
<Button
|
|
|
- onClick={playGameHandler}
|
|
|
+ onClick={() => playGameHandler(item!)}
|
|
|
style={{
|
|
|
"--background-color": "#009d80",
|
|
|
"--border-color": "#009d80",
|