Selaa lähdekoodia

feat: 修改新需求和调整

year 2 viikkoa sitten
vanhempi
commit
bac85cf4c7

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

@@ -206,7 +206,7 @@ const Deposit = () => {
     };
     const handleUserRecharge = async (is_reset_rollover: boolean, data?: any) => {
         try {
-            goBlankPage(async () => {
+            await goBlankPage(async () => {
                 if (!is_reset_rollover) {
                     const res = await getUserMoneyApi();
                     if (res.data?.tips_reset_rollover) {
@@ -231,6 +231,7 @@ const Deposit = () => {
                 formInstanceRef.current?.resetFields();
                 tipModelRef.current?.onClose();
                 setAmount("");
+                setCurrentProduct({});
                 // const url =
                 //     "https://caixa.pay4z.com/brl/qrcode.html?tradeNo=T2501180056ijk21kJ&amount=20&payAmount=20&currency=BRL&expiredAt=2025-01-18%2001%3A11%3A31&expire=1737173491282&raw=00020101021226870014br.gov.bcb.pix2565qrcode.santsbank.com%2Fdynamic%2Fdc8cf003-1616-47f8-94e6-16be500d05b45204000053039865802BR5907LF%20LTDA6009Sao%20Paulo62070503***6304DF54&type=QRCODE";
                 if (res?.data?.pay_url) {

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

@@ -320,19 +320,19 @@ const Withdraw = () => {
                     ))}
                 </Swiper>
             </div>
-            <div className={styles.withdrawTitle}>
+            <div
+                className={styles.withdrawTitle}
+                onClick={() => {
+                    scoreRef.current?.onOpen();
+                }}
+            >
                 <div className={styles.withdrawTitleText}>
                     <span className="mr-[.1rem]">ContaSaldo</span>
                     <span className="text-[#11de68]">
                         R$ {faltaData.canWithdraw ? faltaData.score : 0}
                     </span>
                 </div>
-                <i
-                    className="iconfont icon-22222_huaban1 text-[#eac61f]"
-                    onClick={() => {
-                        scoreRef.current?.onOpen();
-                    }}
-                ></i>
+                <i className="iconfont icon-22222_huaban1 text-[#eac61f]"></i>
             </div>
             {/* <div className="pb-[.1rem] text-[#74888f]">Valor do Saque</div> */}
             {/* <div className={styles.quick}>

+ 9 - 1
src/app/[locale]/(TabBar)/deposit/layout.tsx

@@ -23,7 +23,15 @@ export default async function Layout({
                 <HeaderBack
                     showBack={true}
                     Right={
-                        <span id="HeaderRight" style={{ width: ".3rem", display: "block" }}></span>
+                        <span
+                            id="HeaderRight"
+                            style={{
+                                width: ".3rem",
+                                height: ".3rem",
+                                display: "block",
+                                position: "relative",
+                            }}
+                        ></span>
                     }
                 />
             </Suspense>

+ 1 - 1
src/app/[locale]/(TabBar)/deposit/page.tsx

@@ -126,7 +126,7 @@ const Container = () => {
             {isShowDesc &&
                 ReactDom.createPortal(
                     <i
-                        className="iconfont icon-bangzhu absolute right-[.1rem] top-[.1rem] text-[.2rem] text-[#5e6c6f]"
+                        className="iconfont icon-bangzhu absolute right-[.0rem] top-[.0rem] text-[.2rem] text-[#5e6c6f]"
                         onClick={() => descRef.current?.onOpen()}
                     ></i>,
                     typeof window !== "undefined" && (document.querySelector("#HeaderRight") as any)

+ 1 - 0
src/app/[locale]/(navbar)/gameList2/layout.tsx

@@ -22,6 +22,7 @@ export default async function Layout({
                 title={<div className="flex justify-center">Lista</div>}
                 Right={<Search></Search>}
                 showBonus={false}
+                showHome={false}
             ></HeaderBack>
             <main className={"main-header"}>{children}</main>
         </div>

+ 2 - 2
src/app/[locale]/layout.tsx

@@ -106,7 +106,7 @@ export default async function LocaleLayout({
                     style={{
                         position: "fixed",
                         zIndex: 100,
-                        background: "rgba(0,0,0,.7)",
+                        background: "rgba(0,0,0,.8)",
                         display: "none",
                         left: 0,
                         top: 0,
@@ -116,7 +116,7 @@ export default async function LocaleLayout({
                         justifyContent: "center",
                     }}
                 >
-                    <Loading2></Loading2>
+                    <Loading2 width={10}></Loading2>
                 </div>
             </body>
         </html>

+ 6 - 3
src/components/HeaderBack/index.tsx

@@ -1,6 +1,7 @@
 "use client";
 import { usePathname, useRouter } from "@/i18n/routing";
 import { useWalletStore } from "@/stores/useWalletStore";
+import { commonMask } from "@/utils";
 import { getToken } from "@/utils/Cookies";
 import clsx from "clsx";
 import { useTranslations } from "next-intl";
@@ -23,6 +24,7 @@ export interface HeaderBackProps {
     useBg?: Boolean;
     Right?: ReactNode; // 右侧自定义渲染,优先级高于childre
     showBonus?: boolean;
+    showHome?: boolean;
 }
 
 const HeaderBack: FC<PropsWithChildren<HeaderBackProps>> = ({
@@ -32,6 +34,7 @@ const HeaderBack: FC<PropsWithChildren<HeaderBackProps>> = ({
     className,
     useBg = false,
     showBonus = false,
+    showHome = true,
     Right,
 }) => {
     const t = useTranslations("HeaderBack");
@@ -66,6 +69,7 @@ const HeaderBack: FC<PropsWithChildren<HeaderBackProps>> = ({
 
     const router = useRouter();
     const goPage = async (path = "") => {
+        commonMask.show();
         // clearCache();
         if (path) {
             // await clearCache();
@@ -97,13 +101,12 @@ const HeaderBack: FC<PropsWithChildren<HeaderBackProps>> = ({
                     )}
                 </div>
             )}
-
-            {!Right && (
+            {Right}
+            {showHome && (
                 <span className={styles.right} onClick={() => goPage("home")}>
                     <span className={iconClassName2}></span>
                 </span>
             )}
-            {Right}
         </div>
     );
 };

+ 7 - 5
src/components/Layout/Sidebar.tsx

@@ -7,6 +7,7 @@ import { Link, usePathname, useRouter } from "@/i18n/routing";
 import { useProviderStore } from "@/stores/useProvider";
 import { useSystemStore } from "@/stores/useSystemStore";
 import { useWalletStore } from "@/stores/useWalletStore";
+import { commonMask } from "@/utils";
 import { server } from "@/utils/client";
 import clsx from "clsx";
 import { useLocale } from "next-intl";
@@ -97,11 +98,12 @@ const Sidebar: FC<PropsWithChildren<Props>> = (props) => {
     );
 
     React.useEffect(() => {
-        console.log(pathname);
-        setTimeout(() => {
-            const dom: any = document.querySelector("#globalMask");
-            if (dom) dom.style.display = "none";
-        }, 500);
+        if (pathname !== "/") {
+            setTimeout(() => {
+                commonMask.hide();
+            }, 500);
+        }
+
         // Router.events.on("routeChangeComplete", () => {
         //     console.log(99990);
         // });

+ 19 - 15
src/dialog/auto.ts

@@ -3,6 +3,7 @@ import { PromotionRep } from "@/api/home";
 import { usePathname } from "@/i18n/routing";
 import { useUserInfoStore } from "@/stores/useUserInfoStore";
 import useWheelStore from "@/stores/useWheelStore";
+import { commonMask } from "@/utils";
 import { server } from "@/utils/client";
 import { getToken } from "@/utils/Cookies";
 import { Local } from "@/utils/storage";
@@ -33,13 +34,19 @@ const AutoShowDialog = () => {
     const [data, setData] = React.useState<PromotionRep[]>([]);
     const { userInfo } = useUserInfoStore();
     const wheelState = useWheelStore((state) => state);
+    const [cacheUserInfo, setCacheUserInfo] = React.useState<any>({});
 
     React.useEffect(() => {
-        getData();
-    }, [userInfo]);
+        if (cacheUserInfo.id !== userInfo.id) {
+            getData();
+            setCacheUserInfo(userInfo);
+        }
+    }, [userInfo, cacheUserInfo]);
 
     React.useEffect(() => {
-        if (!data.length) return;
+        if (!data?.length) {
+            return;
+        }
         setTimeout(() => {
             doShow();
         }, 300);
@@ -47,19 +54,17 @@ const AutoShowDialog = () => {
     }, [data]);
 
     const getData = async () => {
-        const dom: HTMLDialogElement | null = document.querySelector("#globalMask");
-        if (dom) {
-            dom.style.display = "flex";
-        }
+        commonMask.show();
         try {
             const res = await getPromotions();
             if (res?.code === 200 && res?.data?.length) {
                 setData(res.data);
+                if (!res.data?.length) {
+                    commonMask.hide();
+                }
             }
-        } finally {
-            // if (dom) {
-            //     dom.style.display = "none";
-            // }
+        } catch {
+            commonMask.hide();
         }
     };
 
@@ -107,7 +112,6 @@ const AutoShowDialog = () => {
             popData[userInfo.id] = {};
         }
         popData[userInfo.id][popid] = true;
-
         Local.setKey(keyMap[type], JSON.stringify(popData));
     };
 
@@ -116,6 +120,9 @@ const AutoShowDialog = () => {
     };
 
     const doShow = async () => {
+        setTimeout(() => {
+            commonMask.hide();
+        }, 500);
         //记录点击的索引
         let showIndex = sessionStorage.getItem("dialogShow");
         let startShow = showIndex ? Number(showIndex) : 0;
@@ -124,9 +131,6 @@ const AutoShowDialog = () => {
         }
 
         for (let i = startShow; i < data.length; i++) {
-            if (pathName === "/") {
-                return;
-            }
             const curData = data[i];
             if (!checkIsCanShow(curData)) {
                 saveShowIndex(i);

+ 4 - 0
src/dialog/language/index.tsx

@@ -1,6 +1,7 @@
 "use client";
 import action from "@/components/Header/action";
 import { useRouter } from "@/i18n/routing";
+import { commonMask } from "@/utils";
 import { CenterPopup } from "antd-mobile";
 import clsx from "clsx";
 import Cookies from "js-cookie";
@@ -39,6 +40,9 @@ const LanguageSelect = () => {
     const router = useRouter();
 
     const languageHandler = async (language: (typeof languages)[number]) => {
+        if (local !== language.value) {
+            commonMask.show();
+        }
         Cookies.set("language", language.value);
         await action();
         router.replace("/", { locale: language.value });

+ 2 - 2
src/hooks/useDesktop.tsx

@@ -40,8 +40,8 @@ const useDesktop = (source: "page" | "components") => {
         }
         // 有pwa 则不会触发
         prompt.current = e;
-
-        if (source === "page" && sessionStorage.getItem("pwa_install") === null) {
+        //sessionStorage.getItem("pwa_install") === null
+        if (source === "page") {
             setHasDesktop(true);
         }
     };

+ 2 - 3
src/i18n/routing.ts

@@ -1,3 +1,4 @@
+import { commonMask } from "@/utils";
 import { createNavigation } from "next-intl/navigation";
 import { defineRouting } from "next-intl/routing";
 const modulesFiles = require.context("../../messages", true, /\.json$/);
@@ -28,10 +29,8 @@ const useRouter = () => {
     Object.keys(router).forEach((key: any) => {
         cfg[key] = (...args: any) => {
             if (key === "push") {
-                const dom: any = document.querySelector("#globalMask");
-                if (dom) dom.style.display = "flex";
+                commonMask.show();
             }
-
             (router as any)[key].apply(null, args);
         };
     });

+ 15 - 0
src/utils/index.ts

@@ -106,3 +106,18 @@ export const goBlankPage = async (handler: Function | string, target = "_self")
         }, 300);
     }
 };
+
+export const commonMask = {
+    show() {
+        var dom: HTMLDivElement | null = document.querySelector("#globalMask");
+        if (dom) {
+            dom.style.display = "flex";
+        }
+    },
+    hide() {
+        var dom: HTMLDivElement | null = document.querySelector("#globalMask");
+        if (dom) {
+            dom.style.display = "none";
+        }
+    },
+};