zhejiushizhuce 2 жил өмнө
parent
commit
bfa011b3cb

+ 1 - 1
src/features/paySlice.js

@@ -292,7 +292,7 @@ const reducerFirstPayMulti=(state,action,arg)=>{
         //         "give": "10",
         //         "favorable_price": "10",
         //         "second_give": "5",
-        //         "timeleft":10,
+        //         "timeleft":10000,
         //     },
         //     "default": 1
         // }

+ 1 - 1
src/widgets/WFirstPay/index.jsx

@@ -242,7 +242,7 @@ const WFirstPay=()=>{
         let timeleft=0;
         if (first_pay.timeleft!=null){
             timeleft=Number(first_pay.timeleft);
-            status=timeleft===0?1:0;
+            status=timeleft<=0?1:0;
         }
         let label=(<></>);
         if (status===-1){

+ 23 - 3
src/widgets/WWelfarebar/index.jsx

@@ -1,12 +1,12 @@
 import styles from './styles.module.scss';
-import {useEffect, useRef, useState} from "react";
+import React, {useEffect, useRef, useState} from "react";
 import {reqFirstPayConfig, reqFirstPayMulti, reqProtectCheck, reqRechargeConfig} from "@features/api";
 import {useDispatch, useSelector} from "react-redux";
 import {getFirstBonus, getOpenRelief, getPopBindPhone, getUpgradeBonus, getUserInfo} from "@features/mainSlice";
 import {APP_WELFARE} from "@constants/app";
 import {getCurrPayOrder, getFirstPayMulti, getOFirstPay} from "@features/paySlice";
 import {getProtectInfo} from "@features/protectSlice";
-import {formatCash} from "@utils/helpers";
+import {formatCash, formatTime} from "@utils/helpers";
 import {useThemeProvider} from "@contexts/themeContext";
 import {useSidebar} from "@contexts/sidebarContext";
 import {useLocation} from "react-router-dom";
@@ -149,6 +149,18 @@ const WWelfarebar = () => {
         if (symbols.indexOf(dollar)===-1)dollar=symbols[0];
         return dollar;
     }
+    const getFirstCD=()=>{
+        let timeleft=-1;
+        if (firstPayMulti!=null&&firstPayMulti.leftitem!=null){
+            timeleft=Number(firstPayMulti.leftitem.timeleft);
+        }
+        return timeleft;
+    }
+    const formatFirstCD=(firstCD)=>{
+        let cdStr=formatTime(firstCD);
+        cdStr=cdStr.substring(0,cdStr.length-3);
+        return cdStr;
+    }
     useEffect(()=>{
         let UserID=user.UserID;
         if (UserID>0){
@@ -191,6 +203,7 @@ const WWelfarebar = () => {
         }
         const stars=Array.from({ length: 5 }, (_, index) => index);
         let symbol=getSymbol();
+        let firstCD=getFirstCD();
         return (
             <div className={`${styles.container} ${extra}`}>
                 <div className={`${styles.content} ${isClose?styles.content_close:''}`}>
@@ -223,7 +236,14 @@ const WWelfarebar = () => {
                             }}>
                                 <img className={styles.f_img} src={require("@assets/welfare/bag_"+symbol+".png")}/>
                             </div>
-                            <img className={styles.f_txt} src={require("@assets/welfare/first_"+i18n.language+".png")}/>
+                            {
+                                firstCD<0? (<img className={styles.f_txt}
+                                                 src={require("@assets/welfare/first_" + i18n.language + ".png")}/>): (
+                                    <span data-title={formatFirstCD(firstCD)}
+                                          className={styles.f_cdtxt}>{formatFirstCD(firstCD)}</span>
+                                )
+                            }
+
                         </div>
                     </WelfareBtn>
                     <WelfareBtn key={"bind"} open={openBind} pressDown={getWelfTabState(APP_WELFARE.BIND)}

+ 20 - 0
src/widgets/WWelfarebar/styles.module.scss

@@ -112,6 +112,26 @@ $star:"./../../assets/welfare/star.png";
     width: auto;
     top: 2.6rem;
   }
+  & .f_cdtxt{
+    position: absolute;
+    z-index: 2;
+    top: 2.8rem;
+    color: #fff;
+    -webkit-text-stroke: 4px #2a3f5b;
+    font-weight: 600;
+    font-size: 0.9rem;
+    &::before{
+      content: attr(data-title);
+      position: absolute;
+      background-image: linear-gradient(to bottom,#fff,#24e2fc);
+      background-clip: text;
+      -webkit-background-clip: text;
+      -webkit-text-fill-color: transparent;
+      -webkit-text-stroke: 0px #2a3f5b;
+      font-weight: 600;
+      font-size: 0.9rem;
+    }
+  }
 }
 .wlf_bind{
   display: flex;