Explorar o código

fix: 修改分享地址

Before hai 10 meses
pai
achega
3714903112
Modificáronse 1 ficheiros con 13 adicións e 5 borrados
  1. 13 5
      src/app/[locale]/affiliate/summary/page.tsx

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

@@ -9,9 +9,11 @@ import {
 } from "@/api/summary";
 import { useUserInfoStore } from "@/stores/useUserInfoStore";
 import { useRequest } from "ahooks";
+import { Toast } from "antd-mobile";
 import { useLocale, useTranslations } from "next-intl";
 
 import { getToken } from "@/utils/Cookies";
+import { copyText } from "@/utils/methods";
 import { FC, useRef, useState } from "react";
 import "./page.scss";
 
@@ -26,10 +28,11 @@ const App: FC<Props> = (props) => {
     const [money, setMoney] = useState("5000");
     const { userInfo } = useUserInfoStore();
     const token = getToken();
-    // 使用本地
-    const BASE_URL = process.env.NEXT_PUBLIC_BASE_URL;
-    let newUrl = BASE_URL?.replace(/:(\d+)/, ":3000");
-    const shareUrl = `${newUrl}/${locale}/${userInfo ? userInfo.referrer_code : "xxxxxx"}`;
+
+    // 生成分享链接
+    const BASE_URL = process.env.NEXT_PUBLIC_BASE_URL?.replace(/:(\d+)/, ":3000");
+    const shareUrl = `${BASE_URL}/${locale}/${userInfo ? userInfo.referrer_code : "xxxxxx"}`;
+    // 轮询时间
     const TIME = 180000;
     const [todayData, setTodayData] = useState<UserAgentToDayInfo>({
         commissar: 0,
@@ -135,7 +138,11 @@ const App: FC<Props> = (props) => {
         }
     };
 
-    const copy = (text: string) => {};
+    const copy = (text: string) => {
+        copyText(text);
+        Toast.show({ icon: "success", content: t("copySuc"), maskClickable: false });
+    };
+
     const withdrawalHandler = async () => {
         await getWithdrawalApi({ amount: 10 });
         // 间隔时间
@@ -144,6 +151,7 @@ const App: FC<Props> = (props) => {
         }, 100);
     };
 
+    // @ts-ignore
     return (
         <div className="content">
             <div className="summary referral-router-view">