瀏覽代碼

feat: 修改

year 2 月之前
父節點
當前提交
bd7924c675
共有 2 個文件被更改,包括 17 次插入15 次删除
  1. 2 0
      src/api/activity.ts
  2. 15 15
      src/app/[locale]/(doings)/rechargeproxy/page.tsx

+ 2 - 0
src/api/activity.ts

@@ -75,6 +75,7 @@ export interface ContinuousResult {
     tally_time: number;
     is_op: boolean;
     remark: string;
+    associated_activity_id?: number;
     list: {
         stage: ContinuousStageItem[];
         list: Record<number, Record<number, ContinuousListItem>>;
@@ -165,6 +166,7 @@ export interface PromoterInfo {
     tally_time: number;
     is_op: boolean;
     remark: string;
+
     list: { count: number; conf: PromoterItem[]; condition: PromoterCondition; total: number };
 }
 

+ 15 - 15
src/app/[locale]/(doings)/rechargeproxy/page.tsx

@@ -5,7 +5,6 @@ import {
     ContinuousListItem,
     ContinuousResult,
     ContinuousRewardItem,
-    ContinuousStageItem,
     getContinuousRechargeInfo,
 } from "@/api/activity";
 import CutDown from "@/components/CutDown";
@@ -20,16 +19,6 @@ import { useSearchParams } from "next/navigation";
 import React from "react";
 import styles from "./page.module.scss";
 
-interface Cfg1Item {
-    text: string;
-    text2: string;
-    key: number;
-    footer: string;
-    footer2?: string;
-}
-
-interface StageItem extends ContinuousStageItem, Cfg1Item {}
-
 interface ListItem {
     dayId: number;
     data: ContinuousListItem;
@@ -118,7 +107,7 @@ const Page = () => {
     React.useEffect(() => {
         getData();
         // eslint-disable-next-line react-hooks/exhaustive-deps
-    }, []);
+    }, [query.activity_id]);
     const getData = async () => {
         const res = await getContinuousRechargeInfo({ activity_id: Number(query.activity_id) });
         if (res.code === 200) {
@@ -208,8 +197,10 @@ const Page = () => {
                         );
                     });
                 }
-                setAmount(amountObj);
-                setVisible(true);
+                if (Object.keys(amountObj).length > 0) {
+                    setVisible(true);
+                    setAmount(amountObj);
+                }
                 getData();
             } else {
                 throw new Error(t(`code.400`));
@@ -221,10 +212,17 @@ const Page = () => {
                     maskClickable: false,
                 });
             }
-            getData();
         }
     };
 
+    const doGoLinkActivity = (type: 11 | 13) => {
+        if (type === data.type || !data.associated_activity_id) return;
+        router.replace({
+            pathname: "/rechargeproxy",
+            query: { activity_id: data.associated_activity_id },
+        });
+    };
+
     return (
         <div className={clsx(styles.continuePage)}>
             <div className={styles.container}>
@@ -240,6 +238,7 @@ const Page = () => {
                             className={clsx(styles.text, {
                                 [styles.active]: act === 0,
                             })}
+                            onClick={() => doGoLinkActivity(11)}
                         >
                             Meu login
                         </div>
@@ -247,6 +246,7 @@ const Page = () => {
                             className={clsx(styles.text, {
                                 [styles.active]: act === 1,
                             })}
+                            onClick={() => doGoLinkActivity(13)}
                         >
                             Login de amigo
                         </div>