|
@@ -1,5 +1,5 @@
|
|
|
"use client";
|
|
|
-import { GameListRep } from "@/api/home";
|
|
|
+import { GameListRep, GameRequest } from "@/api/home";
|
|
|
import { userInfoApi } from "@/api/login";
|
|
|
import { UserInfoRep, UserVipInfo, Wallet, getUserTransferApi } from "@/api/user";
|
|
|
import {
|
|
@@ -88,7 +88,7 @@ const WalletCard = (props: { userMoney: Wallet }) => {
|
|
|
|
|
|
// 未完成游戏
|
|
|
const gameModelRef = useRef<ModalProps>(null);
|
|
|
- const game = useRef<GameListRep | null>(null);
|
|
|
+ const game = useRef<(GameListRep & { mode: GameRequest["mode"] }) | null>(null);
|
|
|
|
|
|
// 彩金、免费币、重玩币提现到钱包操作
|
|
|
const handleAcquire = async (wallet_type: number, transfer: boolean) => {
|
|
@@ -101,6 +101,7 @@ const WalletCard = (props: { userMoney: Wallet }) => {
|
|
|
// 如果有未完成游戏 彩金游戏-2、免费游戏-3、重玩游戏-4
|
|
|
if (wallet_type === 2 && data.play_list && data.play_list.length > 0) {
|
|
|
game.current = data.play_list[0];
|
|
|
+ game.current!.mode = 1;
|
|
|
gameModelRef.current?.onOpen();
|
|
|
return;
|
|
|
}
|
|
@@ -108,11 +109,13 @@ const WalletCard = (props: { userMoney: Wallet }) => {
|
|
|
if (wallet_type === 3 && data.free_game_list && data.free_game_list.length > 0) {
|
|
|
game.current = data.free_game_list[0];
|
|
|
gameModelRef.current?.onOpen();
|
|
|
+ game.current!.mode = 2;
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (wallet_type === 4 && data.lose_game_list && data.lose_game_list.length > 0) {
|
|
|
game.current = data.lose_game_list[0];
|
|
|
+ game.current!.mode = 3;
|
|
|
gameModelRef.current?.onOpen();
|
|
|
return;
|
|
|
}
|
|
@@ -134,7 +137,7 @@ const WalletCard = (props: { userMoney: Wallet }) => {
|
|
|
const { getGameUrl } = useGame();
|
|
|
const goGame = () => {
|
|
|
const current = game.current;
|
|
|
- getGameUrl(current!, { id: current?.id + "" });
|
|
|
+ getGameUrl(current!, { id: current?.id + "", mode: game.current?.mode || 1 });
|
|
|
tipsRef.current?.onClose();
|
|
|
gameModelRef.current?.onClose();
|
|
|
};
|