浏览代码

feat: 修改

year 2 天之前
父节点
当前提交
caa4363ca6

+ 32 - 0
src/api/activity.ts

@@ -419,3 +419,35 @@ export const get8GSignInfo = async (data: { activity_id: string | number }) => {
         data,
     });
 };
+
+//日补偿 /v1/api/user/activity/getDailyCompensateInfo
+
+export interface DailyItem {
+    loss_amount: number;
+    normal_amount: number;
+    double_amount: number;
+    double_num: number;
+    double_pay_amount: number;
+    status: string; //:0进行中,1待领取,2已领取,3已过期
+}
+
+export interface DailyCompensateInfo {
+    double_enable: boolean;
+    vip_level: number;
+    today: DailyItem;
+    yesterday: DailyItem;
+    rewards: DailyItem;
+}
+
+export const getDailyCompensateInfo = async () => {
+    return server.post<DailyCompensateInfo>({
+        url: "/v1/api/user/activity/getDailyCompensateInfo",
+    });
+};
+
+export const claimDailyCompensate = async (data: { mode: 1 | 2 }) => {
+    return server.post({
+        url: "/v1/api/user/activity/claimDailyCompensate",
+        data,
+    });
+};

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

@@ -115,7 +115,10 @@ const Page = () => {
                                     splitStyle={{
                                         margin: "0 .01rem",
                                         color: "var(--primary-button)",
+                                        fontSize: "12px",
+                                        display: "block",
                                     }}
+                                    autoHeight={true}
                                 ></CutDown>
                             </div>
                         </div>
@@ -217,7 +220,7 @@ const Page = () => {
                     </div>
                 }
             />
-            <main className={"main-header hasFlag stickyFlag"} id="mainBox">
+            <main className={"main-header hasFlag stickyFlag pb-[.75rem]"} id="mainBox">
                 <div className="h-[100%] p-[.1rem]">
                     <div className={styles.pageContainer}>
                         <div className={styles.tabTop}>

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

@@ -1,18 +1,31 @@
 "use client";
-
+import { DailyCompensateInfo, getDailyCompensateInfo } from "@/api/activity";
 import CustomButton from "@/components/CustomButton";
 import { VipProgressMap } from "@/enums";
 import useCountdown from "@/hooks/useCountdown";
 import { useVipStore } from "@/stores/useVipStore";
 import clsx from "clsx";
+import React from "react";
 import styles from "./page.module.scss";
 
 const Page = () => {
     const { vipData } = useVipStore();
     const [_, formattedRes] = useCountdown({ leftTime: 3000 * 1000 });
+    const [data, setData] = React.useState<DailyCompensateInfo>();
 
     console.log(VipProgressMap);
 
+    React.useEffect(() => {
+        getData();
+    }, []);
+
+    const getData = async () => {
+        const res = await getDailyCompensateInfo();
+        if (res?.code === 200) {
+            setData(res.data);
+        }
+    };
+
     return (
         <>
             <div className={styles.top}>
@@ -38,7 +51,7 @@ const Page = () => {
                 </div>
                 <div className="w-[32%]">
                     <img
-                        src={VipProgressMap.get(vipData?.vip_level || 0)?.icon}
+                        src={VipProgressMap.get(data?.vip_level || 0)?.icon}
                         className="relative -top-[10px] scale-[1.5] transform"
                         alt=""
                     />

+ 39 - 23
src/components/CutDown/index.tsx

@@ -1,5 +1,6 @@
 "use client";
 import useCountDown from "@/hooks/useCountdown";
+import clsx from "clsx";
 
 const TimeLeft = ({
     endTime,
@@ -7,12 +8,14 @@ const TimeLeft = ({
     itemStyle = {},
     splitStyle = {},
     onEnd,
+    autoHeight = false,
 }: {
     endTime: number;
     itemBgColor?: string;
     itemStyle?: React.CSSProperties;
     splitStyle?: React.CSSProperties;
     onEnd?: Function;
+    autoHeight?: boolean;
 }) => {
     const [countdown, time] = useCountDown({
         leftTime: endTime * 1000,
@@ -26,48 +29,61 @@ const TimeLeft = ({
     return (
         <div className={"flex text-[0.1389rem]"}>
             <div className={"text-center"}>
-                <div className={"flex items-center text-[#fff]"}>
+                <div className={"flex items-center leading-[1] text-[#fff]"}>
                     <div
-                        className={
-                            `flex items-center justify-center rounded-[0.0347rem]` +
-                            " h-[0.2083rem] w-[0.2083rem]"
-                        }
+                        className={clsx(
+                            `flex items-center justify-center rounded-[0.0347rem]`,
+                            "w-[0.2083rem]",
+                            { "h-[0.2083rem]": !autoHeight }
+                        )}
                         style={{ backgroundColor: itemBgColor, ...itemStyle }}
                     >
                         {`${time.days}`.padStart(2, "0")}
                     </div>
-                    <span className={"mx-[0.0247rem]"} style={{ ...splitStyle }}>
+                    <div
+                        className={"lex mx-[0.0247rem] items-center justify-center"}
+                        style={{ ...splitStyle }}
+                    >
                         :
-                    </span>
+                    </div>
                     <div
-                        className={
-                            `flex items-center justify-center rounded-[0.0347rem]` +
-                            " h-[0.2083rem] w-[0.2083rem]"
-                        }
+                        className={clsx(
+                            `flex items-center justify-center rounded-[0.0347rem]`,
+                            "w-[0.2083rem]",
+                            { "h-[0.2083rem]": !autoHeight }
+                        )}
                         style={{ backgroundColor: itemBgColor, ...itemStyle }}
                     >
                         {`${time.hours}`.padStart(2, "0")}
                     </div>
-                    <span className={"mx-[0.0247rem]"} style={{ ...splitStyle }}>
+                    <div
+                        className={"lex mx-[0.0247rem] items-center justify-center"}
+                        style={{ ...splitStyle }}
+                    >
                         :
-                    </span>
+                    </div>
                     <div
-                        className={
-                            `flex items-center justify-center rounded-[0.0347rem]` +
-                            " h-[0.2083rem] w-[0.2083rem]"
-                        }
+                        className={clsx(
+                            `flex items-center justify-center rounded-[0.0347rem]`,
+                            "w-[0.2083rem]",
+                            { "h-[0.2083rem]": !autoHeight }
+                        )}
                         style={{ backgroundColor: itemBgColor, ...itemStyle }}
                     >
                         {`${time.minutes}`.padStart(2, "0")}
                     </div>
-                    <span className={"mx-[0.0247rem]"} style={{ ...splitStyle }}>
+                    <div
+                        className={"lex mx-[0.0247rem] items-center justify-center"}
+                        style={{ ...splitStyle }}
+                    >
                         :
-                    </span>
+                    </div>
                     <div
-                        className={
-                            `flex items-center justify-center rounded-[0.0347rem]` +
-                            " h-[0.2083rem] w-[0.2083rem]"
-                        }
+                        className={clsx(
+                            `flex items-center justify-center rounded-[0.0347rem]`,
+                            "w-[0.2083rem]",
+                            { "h-[0.2083rem]": !autoHeight }
+                        )}
                         style={{ backgroundColor: itemBgColor, ...itemStyle }}
                     >
                         {`${time.seconds}`.padStart(2, "0")}