Kaynağa Gözat

feat: 修改BUG

year 2 gün önce
ebeveyn
işleme
515510161a

+ 12 - 1
src/app/[locale]/(navbar)/deposit/component/deposit/index.tsx

@@ -9,6 +9,7 @@ import {
 } from "@/api/depositsApi";
 import { getUserMoneyApi, getUserRechargeApi } from "@/api/user";
 import Button from "@/components/CustomButton";
+import Loading from "@/components/Loading2";
 import SvgIcon from "@/components/SvgIcon";
 import TipsModal, { ModalProps } from "@/components/TipsModal";
 import { useEventPoint } from "@/hooks/useEventPoint";
@@ -39,7 +40,8 @@ const Deposit = () => {
     const t = useTranslations();
     const router = useRouter();
     const [shopType, setShopType] = React.useState<ShopItem>({} as ShopItem);
-    const [loading, setLoading] = React.useState(false);
+    const [loading, setLoading] = React.useState(true);
+    const [isInit, setIsInit] = React.useState(true);
     const [shopInfo, setShopInfo] = React.useState<ShopInfo | null>(null);
     const [currentChannel, setCurrentChannel] = React.useState<PayChannel>({} as PayChannel);
     const [products, setProducts] = React.useState<Product[]>([]);
@@ -101,6 +103,7 @@ const Deposit = () => {
             setShopInfo(null);
         } finally {
             setLoading(false);
+            setIsInit(false);
         }
     };
 
@@ -349,6 +352,14 @@ const Deposit = () => {
         setIsFocus(false);
     };
 
+    if (isInit) {
+        return (
+            <div className="flex h-[100%] w-[100%] items-center justify-center pb-[1rem]">
+                <Loading></Loading>
+            </div>
+        );
+    }
+
     return (
         <>
             <div className={styles.depositePage}>

+ 13 - 17
src/app/[locale]/(navbar)/deposit/page.tsx

@@ -5,12 +5,8 @@ import clsx from "clsx";
 import dynamic from "next/dynamic";
 import { useSearchParams } from "next/navigation";
 import React from "react";
-// import Deposit from "./component/deposit";
-// import Withdraw from "./component/withdraw";
 import styles from "./page.module.scss";
 const Deposit = dynamic(() => import("./component/deposit"));
-// const Withdraw = dynamic(() => import("./component/withdraw"));
-// const TipsModal = dynamic(() => import("@/components/TipsModal"));
 
 const Container = () => {
     const searchParams = useSearchParams();
@@ -34,21 +30,21 @@ const Container = () => {
         if (target) {
             setActiveTab(Number(target));
         }
-        if (typeof window !== "undefined") {
-            renderDesc();
-        }
+        // if (typeof window !== "undefined") {
+        //     renderDesc();
+        // }
     }, [searchParams]);
 
-    const renderDesc = () => {
-        const toDom = document.querySelector("#HeaderRight");
-        if (toDom) {
-            setIsShowDesc(true);
-        } else {
-            setTimeout(() => {
-                renderDesc();
-            }, 100);
-        }
-    };
+    // const renderDesc = () => {
+    //     const toDom = document.querySelector("#HeaderRight");
+    //     if (toDom) {
+    //         setIsShowDesc(true);
+    //     } else {
+    //         setTimeout(() => {
+    //             renderDesc();
+    //         }, 100);
+    //     }
+    // };
 
     const changeTab = (key: FundsHandleType) => {
         setActiveTab(key);

+ 2 - 1
src/app/[locale]/(navbar)/search/page.tsx

@@ -94,7 +94,7 @@ const Page = () => {
                 if (name) {
                     setSearchData(res.data);
                 } else {
-                    const toData = [...data, ...res.data];
+                    const toData = [...res.data];
                     setData(toData);
                 }
 
@@ -146,6 +146,7 @@ const Page = () => {
                                 placeholder="Nome do Jogo"
                                 clearable
                                 ref={inputRef}
+                                onClear={() => setIsFocus(false)}
                             ></Input>
                         </Form.Item>
                     </Form>

+ 1 - 2
src/app/[locale]/(navbar)/transactions/components/Message.tsx

@@ -25,8 +25,7 @@ const Message = (props: Props) => {
                     <div
                         key={i}
                         className={clsx(
-                            "px-spacing-x py-spacing-y mb-[.1rem] border-b-[1px] border-[#333333]" +
-                                " text-[14px]",
+                            "mb-[.1rem] px-spacing-x py-spacing-y " + " text-[14px]",
                             styles.box
                         )}
                     >

+ 1 - 1
src/app/[locale]/(navbar)/transactions/components/style.module.scss

@@ -2,5 +2,5 @@
     // box-shadow: 0 0 15px #34a7bb inset;
     // border: 1px solid #46e3ff;
     border-radius: 0.1rem;
-    background-color: #1f2830;
+    background-color: var(--main-background);
 }

+ 1 - 1
src/app/[locale]/(navbar)/transactions/style.module.scss

@@ -5,7 +5,7 @@
     flex-direction: column;
     :global(.adm-tabs-tab-list) {
         margin: 0 0.12rem 0.12rem;
-        background-color: #1f2830;
+        background-color: var(--main-background);
         border-radius: 0.1rem;
         height: 0.4rem;
         position: relative;

+ 30 - 15
src/app/[locale]/(navbar)/withdrawal/component/withdraw/index.tsx

@@ -3,6 +3,7 @@ import { userInfoApi } from "@/api/login";
 import { ChannelType, WithDrawParams, WithDrawType, getWithDrawApi } from "@/api/withdraw";
 import { clearWallet } from "@/app/[locale]/(navbar)/withdraw/actions";
 import Button from "@/components/CustomButton";
+import Loading from "@/components/Loading2";
 import Select from "@/components/Select";
 import TipsModal, { ModalProps } from "@/components/TipsModal";
 import { ChannelEnum, ChannelEnumMap } from "@/enums";
@@ -53,10 +54,12 @@ const Withdraw = () => {
     const game = React.useRef<GameListRep | null>(null);
     const pointModelRef = React.useRef<ModalProps | null>(null);
     const loadingRef = React.useRef<any>(null);
+    const [isInit, setIsInit] = React.useState(true);
     const [isDisabled, setIsDisabled] = React.useState<boolean>(true);
     const [isFocus, setIsFocus] = React.useState<boolean>(false);
 
     React.useEffect(() => {
+        setIsInit(true);
         getData();
     }, []);
 
@@ -112,23 +115,27 @@ const Withdraw = () => {
     }, [currentChannel, faltaData]);
 
     const getData = async () => {
-        const res = await getWithdrawApi();
-        if (res?.length > 0) {
-            setConfigData(res);
-            if (res[0]) {
-                const cChannel = res[0];
-                setCurrentChannel(cChannel);
-
-                setTimeout(() => {
-                    formInstanceRef.current?.setFieldValue("amount", cChannel.min_amount);
-                    setAmount(`${cChannel.min_amount}`);
-                }, 100);
-
-                const ctype = cChannel?.channels;
-                if (ctype && ctype?.length > 0) {
-                    setCurrentType(ctype[0] || {});
+        try {
+            const res = await getWithdrawApi();
+            if (res?.length > 0) {
+                setConfigData(res);
+                if (res[0]) {
+                    const cChannel = res[0];
+                    setCurrentChannel(cChannel);
+
+                    setTimeout(() => {
+                        formInstanceRef.current?.setFieldValue("amount", cChannel.min_amount);
+                        setAmount(`${cChannel.min_amount}`);
+                    }, 100);
+
+                    const ctype = cChannel?.channels;
+                    if (ctype && ctype?.length > 0) {
+                        setCurrentType(ctype[0] || {});
+                    }
                 }
             }
+        } finally {
+            setIsInit(false);
         }
     };
     const channelChangeHandler = (item: WithDrawType) => {
@@ -307,6 +314,14 @@ const Withdraw = () => {
         setIsFocus(false);
     };
 
+    if (isInit) {
+        return (
+            <div className="flex h-[100%] w-[100%] items-center justify-center pb-[1rem]">
+                <Loading></Loading>
+            </div>
+        );
+    }
+
     return (
         <div className={styles.withdrawPage}>
             {/* <div className={styles.swiperContainer}>

+ 1 - 0
src/app/[locale]/(navbar)/withdrawal/page.tsx

@@ -17,6 +17,7 @@ const Container = () => {
     const router = useRouter();
     const [activeTab, setActiveTab] = React.useState<FundsHandleType>(FundsHandleType.DEPOSITE);
     const [isShowDesc, setIsShowDesc] = React.useState<boolean>(false);
+
     const descRef = React.useRef<any>(null);
 
     const tabs = React.useMemo(() => {

+ 17 - 5
src/components/Card/Card.tsx

@@ -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);

+ 1 - 1
src/feedback/WrapHoc/index.tsx

@@ -25,7 +25,7 @@ const WrapHoc: React.FC<Props> = ({
         setVisible(true);
         setTimeout(() => {
             setMaskVisible(true);
-        }, 10);
+        }, 30);
         return () => {
             setVisible(false);
         };

+ 1 - 1
src/feedback/dialog/component.tsx

@@ -38,7 +38,7 @@ const Components: React.FC<Props> = ({
     React.useEffect(() => {
         setTimeout(() => {
             setAnimateType(1);
-        }, 10);
+        }, 30);
     }, []);
 
     const doClose = (p: keyof ModalBoxResType | Record<string, any>) => {