瀏覽代碼

fix: 修改config 带来的未初始化bug

Before 6 月之前
父節點
當前提交
7fdd200e13

+ 4 - 3
src/app/[locale]/(TabBar)/deposit/DepositData.tsx

@@ -109,12 +109,13 @@ const DepositData: FC<Props> = (props) => {
         getUserRechargeApi({ is_reset_rollover, ...params })
             .then(async (res) => {
                 formInstanceRef.current?.resetFields();
-                Toast.show({ icon: "success", content: t("code.200"), maskClickable: false });
+                // Toast.show({ icon: "success", content: t("code.200"), maskClickable: false });
                 tipModelRef.current?.onClose();
                 setAmount(undefined);
 
                 if (res.data.pay_url) {
-                    window.open(res.data.pay_url);
+                    // window.open(res.data.pay_url);
+                    window.open("https://www.taobao.com");
                 }
                 const data = await getDepositApi();
                 setDepositState(data);
@@ -122,7 +123,7 @@ const DepositData: FC<Props> = (props) => {
                 await actions();
             })
             .catch((error) => {
-                Toast.show({ content: t(`code${error.data.code}`), maskClickable: false });
+                Toast.show({ content: t(`code.${error.data.code}`), maskClickable: false });
             });
     };
 

+ 1 - 1
src/app/[locale]/(navbar)/doings/discount/DepositData.tsx

@@ -109,7 +109,7 @@ const DepositData: FC<Props> = (props) => {
                 }
             })
             .catch((error) => {
-                Toast.show({ content: t(`code${error.data.code}`), maskClickable: false });
+                Toast.show({ content: t(`code.${error.data.code}`), maskClickable: false });
             });
     };
     const onValuesChange = (changeValues: any) => {

+ 4 - 2
src/app/[locale]/(wheel)/cashWheel/CashWheelClient.tsx

@@ -4,7 +4,7 @@ import { getWheelReceiveApi } from "@/api/cashWheel";
 import Box from "@/components/Box";
 import { WheelClient } from "@/components/ModalPopup/WheelModal";
 import useCountDown from "@/hooks/useCountdown";
-import { Link } from "@/i18n/routing";
+import { Link, usePathname } from "@/i18n/routing";
 import { useUserInfoStore } from "@/stores/useUserInfoStore";
 import useWheelStore from "@/stores/useWheelStore";
 import { server } from "@/utils/client";
@@ -420,7 +420,9 @@ const ShareClient = forwardRef<{ open: () => void }, {}>(function ShareClient(pr
 
     const [currentPhoneIndex, setCurrentPhoneIndex] = useState(0);
 
-    const shareUrl = `${globalThis.config?.NEXT_PUBLIC_SHARE_URL ?? ""}/br/sharecwbr?turntable=${currentWheel.id}&user=${user.id}&time=${currentWheel.end_time}`;
+    const pathname = usePathname();
+    const BASE_URL = window.location.href.replace(pathname, "");
+    const shareUrl = `${BASE_URL}/sharecwbr?turntable=${currentWheel.id}&user=${user.id}&time=${currentWheel.end_time}`;
     const url = encodeURIComponent(`${shareUrl}`);
     const text = encodeURIComponent(`Receba 100 BRL de graça,Pix SAQUE RÁPIDO`);
     const t = useTranslations();

+ 5 - 4
src/app/[locale]/affiliate/summary/page.tsx

@@ -8,13 +8,14 @@ import {
 import { CommissionModel } from "@/app/[locale]/affiliate/component/TabsCom";
 import Table, { TableHeaderItem } from "@/components/Table";
 import TipsModal, { ModalProps } from "@/components/TipsModal";
+import { usePathname } from "@/i18n/routing";
 import { useUserInfoStore } from "@/stores/useUserInfoStore";
 import { server } from "@/utils/client";
 import { getToken } from "@/utils/Cookies";
 import { copyText } from "@/utils/methods";
 import { useRequest } from "ahooks";
 import { Mask, Toast } from "antd-mobile";
-import { useLocale, useTranslations } from "next-intl";
+import { useTranslations } from "next-intl";
 import Image from "next/image";
 import { FC, useEffect, useRef, useState } from "react";
 import "./page.scss";
@@ -164,9 +165,9 @@ const RulesClient = () => {
 };
 const App: FC<Props> = (props) => {
     const t = useTranslations("SummaryPage");
-    const locale = useLocale();
 
     const sliderRef = useRef<HTMLDivElement>(null);
+    const pathname = usePathname();
     const [num, setNum] = useState(100);
     const [money, setMoney] = useState("5000");
 
@@ -178,8 +179,8 @@ const App: FC<Props> = (props) => {
     const token = getToken();
 
     // 生成分享链接
-    const BASE_URL = globalThis.config?.NEXT_PUBLIC_SHARE_URL ?? "";
-    const shareUrl = `${BASE_URL}/${locale}/${userInfo ? userInfo.referrer_code : "xxxxxx"}`;
+    const BASE_URL = window.location.href.replace(pathname, "");
+    const shareUrl = `${BASE_URL}/${userInfo ? userInfo.referrer_code : "xxxxxx"}`;
 
     const url = encodeURIComponent(`${shareUrl}`);
     const SHARE_SOURCE = [

+ 3 - 2
src/hooks/useGame.tsx

@@ -1,5 +1,5 @@
 import { GameListRep, GameRequest, getGameDetailApi } from "@/api/home";
-import { defaultLocale, useRouter } from "@/i18n/routing";
+import { defaultLocale, usePathname, useRouter } from "@/i18n/routing";
 import { brandList } from "@/utils/constant";
 import { getCookies } from "@/utils/Cookies";
 import { Toast } from "antd-mobile";
@@ -9,6 +9,7 @@ const whiteUrls = ["192.168.0.84", "localhost", "192.168.0.46"];
 const useGame = () => {
     const router = useRouter();
     const t = useTranslations();
+    const pathname = usePathname();
     const getGameUrl = (game: GameListRep, params: GameRequest) => {
         Toast.show({
             icon: "loading",
@@ -21,7 +22,7 @@ const useGame = () => {
             .then((res) => {
                 Toast.clear();
                 if (res.data && res.data.game_url) {
-                    const url = `${encodeURI(res.data.game_url)}&brand=${brand}&return_url=${globalThis.config.NEXT_PUBLIC_SHARE_URL}&category_name=${game.category_name}`;
+                    const url = `${encodeURI(res.data.game_url)}&brand=${brand}&return_url=${window.location.href.replace(pathname, "")}&category_name=${game.category_name}`;
                     const protocol = new URL(url).protocol;
                     if (
                         whiteUrls.indexOf(window.location.hostname) !== -1 ||