Browse Source

feat: 修改

year 2 months ago
parent
commit
bfa6d50a5c

+ 5 - 1
src/app/[locale]/(doings)/continuous/page.tsx

@@ -46,11 +46,13 @@ const DayItem = ({
     idx,
     onClaim,
     level,
+    onEnd,
 }: {
     data: ContinuousCfgItem;
     idx: number;
     onClaim: (data: ContinuousCfgItem) => void;
     level: string;
+    onEnd?: Function;
 }) => {
     const dayColor = React.useMemo(() => {
         return ["#12940f", "#297fcf", "#ec3920"][idx % 3];
@@ -64,7 +66,7 @@ const DayItem = ({
 
     return (
         <div>
-            {data.id >= 2 && (
+            {data.id >= 2 && data.isCanClaim && (
                 <div className="mb-[.1rem] flex flex-row justify-center">
                     <div className={styles.canGet}>Grande Prêmio Disponível</div>
                 </div>
@@ -75,6 +77,7 @@ const DayItem = ({
                     <CutDown
                         endTime={data.end_at - Date.now() / 1000}
                         itemBgColor="rgba(255,255,255,.4)"
+                        onEnd={onEnd}
                     ></CutDown>
                 </div>
             )}
@@ -407,6 +410,7 @@ const Page = () => {
                                                         idx={idx}
                                                         onClaim={doClaim}
                                                         level={cfg1[item.id].text2}
+                                                        onEnd={getData}
                                                     ></DayItem>
                                                 );
                                             })}

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

@@ -33,10 +33,12 @@ const DayItem = ({
     data,
     idx,
     onClaim,
+    onEnd,
 }: {
     data: ContinuousCfgItem;
     idx: number;
     onClaim: (data: ContinuousCfgItem) => void;
+    onEnd?: Function;
 }) => {
     const dayColor = React.useMemo(() => {
         return ["#12940f", "#297fcf", "#ec3920"][idx % 3];
@@ -50,7 +52,7 @@ const DayItem = ({
 
     return (
         <div className={styles.dayItemBox}>
-            {data.id >= 2 && (
+            {data.id >= 2 && data.isCanClaim && (
                 <div className="mb-[.1rem] flex flex-row justify-center">
                     <div className={styles.canGet}>Grande Prêmio Disponível</div>
                 </div>
@@ -61,6 +63,7 @@ const DayItem = ({
                     <CutDown
                         endTime={data.end_at - Date.now() / 1000}
                         itemBgColor="rgba(255,255,255,.4)"
+                        onEnd={onEnd}
                     ></CutDown>
                 </div>
             )}
@@ -355,6 +358,7 @@ const Page = () => {
                                                         data={item}
                                                         idx={idx}
                                                         onClaim={doClaim}
+                                                        onEnd={getData}
                                                     ></DayItem>
                                                 );
                                             })}

+ 7 - 0
src/components/CutDown/index.tsx

@@ -4,12 +4,19 @@ import useCountDown from "@/hooks/useCountdown";
 const TimeLeft = ({
     endTime,
     itemBgColor = "#4c546e",
+    onEnd,
 }: {
     endTime: number;
     itemBgColor: string;
+    onEnd?: Function;
 }) => {
     const [countdown, time] = useCountDown({
         leftTime: endTime * 1000,
+        onEnd: () => {
+            if (typeof onEnd === "function") {
+                onEnd();
+            }
+        },
     });
 
     return (