year 2 週間 前
コミット
2e94b1a171

+ 21 - 12
src/app/[locale]/(TabBar)/deposit/component/withdraw/index.tsx

@@ -50,7 +50,7 @@ const Withdraw = () => {
     const scoreRef = React.useRef<ModalProps>(null);
     const gameModelRef = React.useRef<ModalProps>(null);
     const game = React.useRef<GameListRep | null>(null);
-    const successModelRef = React.useRef<ModalProps | null>(null);
+    const pointModelRef = React.useRef<ModalProps | null>(null);
 
     React.useEffect(() => {
         getData();
@@ -232,6 +232,12 @@ const Withdraw = () => {
             Toast.show("Quantidade insuficiente disponível para retirada");
             return;
         }
+
+        if (wallet.point > 0) {
+            pointModelRef.current?.onOpen();
+            return;
+        }
+
         // 如果有未完成游戏
         if (data.play_list && data.play_list.length > 0) {
             game.current = data.play_list[0];
@@ -269,10 +275,10 @@ const Withdraw = () => {
             Toast.show(t(`code.${error.data.code}`));
         }
     };
-    // const goGame = () => {
-    //     const current = game.current;
-    //     getGameUrl(current!, { id: current?.id + "" });
-    // };
+    const goGame = () => {
+        const current = game.current;
+        getGameUrl(current!, { id: current?.id + "" });
+    };
 
     // const doCleanBonus = async () => {
     //     try {
@@ -635,7 +641,7 @@ const Withdraw = () => {
             </TipsModal>
 
             {/*   提现拦截 */}
-            {/* <TipsModal
+            <TipsModal
                 title={
                     <div className="text-left">
                         <div className="text-[.12rem] text-[#fff]">
@@ -683,8 +689,8 @@ const Withdraw = () => {
                         Para jogos
                     </Button>
                 </div>
-            </TipsModal>*/}
-            {/* <TipsModal
+            </TipsModal>
+            <TipsModal
                 title={
                     <div className="text-left">
                         <div className="text-[.16rem] text-[#11de68]">Saque bem-sucedida.</div>
@@ -693,8 +699,7 @@ const Withdraw = () => {
                         </div>
                     </div>
                 }
-                visible={true}
-                ref={successModelRef}
+                ref={pointModelRef}
                 getContainer={document?.querySelector("#app")}
                 className={styles.gameModal}
             >
@@ -726,7 +731,7 @@ const Withdraw = () => {
                             "--border-color": "#ebc71f",
                             "--text-color": "#12171a",
                         }}
-                        onClick={() => successModelRef.current?.onClose()}
+                        onClick={() => pointModelRef.current?.onClose()}
                     >
                         Cancelar
                     </Button>
@@ -738,11 +743,15 @@ const Withdraw = () => {
                             "--border-color": "#11de68",
                             "--text-color": "#12171a",
                         }}
+                        onClick={async () => {
+                            pointModelRef.current?.onClose();
+                            await extractHandler();
+                        }}
                     >
                         confirmação
                     </Button>
                 </div>
-            </TipsModal> */}
+            </TipsModal>
         </div>
     );
 };

+ 1 - 1
src/components/Footer/index.tsx

@@ -155,7 +155,7 @@ const Footer: FC = () => {
                         return (
                             <Link
                                 href={item.path}
-                                onClick={(event) => goPage(event, item.path)}
+                                onClick={(event: any) => goPage(event, item.path)}
                                 key={index}
                                 prefetch
                                 className={`footer-item-column ${isAct ? "active" : ""}`}

+ 16 - 1
src/i18n/routing.ts → src/i18n/routing.tsx

@@ -7,7 +7,7 @@ export const locales = modulesFiles.keys().map((modulePath: string) => {
 });
 // 路由
 const {
-    Link,
+    Link: BaseLink,
     redirect,
     usePathname,
     useRouter: useBaseRouter,
@@ -37,4 +37,19 @@ const useRouter = () => {
     return cfg;
 };
 
+const Link = ({ children, ...props }: any) => {
+    const { onClick } = props;
+    const newProps = {
+        ...props,
+    };
+    if (typeof window !== "undefined") {
+        newProps.onClick = onClick
+            ? onClick
+            : () => {
+                  commonMask.show();
+              };
+    }
+    return <BaseLink {...newProps}>{children}</BaseLink>;
+};
+
 export { Link, redirect, usePathname, useRouter };

+ 4 - 2
src/utils/index.ts

@@ -109,13 +109,15 @@ export const goBlankPage = async (handler: Function | string, target = "_self")
 
 export const commonMask = {
     show() {
-        var dom: HTMLDivElement | null = document.querySelector("#globalMask");
+        if (typeof window === "undefined") return;
+        var dom: HTMLDivElement | null = document?.querySelector("#globalMask");
         if (dom) {
             dom.style.display = "flex";
         }
     },
     hide() {
-        var dom: HTMLDivElement | null = document.querySelector("#globalMask");
+        if (typeof window === "undefined") return;
+        var dom: HTMLDivElement | null = document?.querySelector("#globalMask");
         if (dom) {
             dom.style.display = "none";
         }