|
@@ -1,36 +1,20 @@
|
|
|
import styles from './styles.module.scss';
|
|
import styles from './styles.module.scss';
|
|
|
import Spring from "@components/Spring";
|
|
import Spring from "@components/Spring";
|
|
|
import React, {useEffect} from "react";
|
|
import React, {useEffect} from "react";
|
|
|
-import icon_1 from "@assets/promotion/icon_1.svg";
|
|
|
|
|
-import banner_1 from "@assets/promotion/banner_1.png";
|
|
|
|
|
-import icon_2 from "@assets/promotion/icon_2.svg";
|
|
|
|
|
-import banner_2 from "@assets/promotion/banner_2.png";
|
|
|
|
|
-import icon_3 from "@assets/promotion/icon_3.svg";
|
|
|
|
|
-import banner_3 from "@assets/promotion/banner_3.png";
|
|
|
|
|
import new_icon from "@assets/promotion/new.png";
|
|
import new_icon from "@assets/promotion/new.png";
|
|
|
import {useNavigate} from "react-router-dom";
|
|
import {useNavigate} from "react-router-dom";
|
|
|
import {useDispatch, useSelector} from "react-redux";
|
|
import {useDispatch, useSelector} from "react-redux";
|
|
|
import {getRedPackInfo} from "@features/redpackSlice";
|
|
import {getRedPackInfo} from "@features/redpackSlice";
|
|
|
import {formatTime} from "@utils/helpers";
|
|
import {formatTime} from "@utils/helpers";
|
|
|
-import {reqRedpackCheck} from "@features/api";
|
|
|
|
|
|
|
+import {reqGameActivity, reqRedpackCheck} from "@features/api";
|
|
|
import {getTurnplate} from "@features/turnplateSlice";
|
|
import {getTurnplate} from "@features/turnplateSlice";
|
|
|
-import {getActivityList} from "@features/activitySlice";
|
|
|
|
|
|
|
+import {getActivityList, getActivityStatus} from "@features/activitySlice";
|
|
|
import LazyImgix from "@components/Imgix/LazyImgix";
|
|
import LazyImgix from "@components/Imgix/LazyImgix";
|
|
|
import {getBonusList} from "@features/agentSlice";
|
|
import {getBonusList} from "@features/agentSlice";
|
|
|
import clock from "@assets/promotion/clock.json";
|
|
import clock from "@assets/promotion/clock.json";
|
|
|
import Lottie from "lottie-react";
|
|
import Lottie from "lottie-react";
|
|
|
-const icons=[
|
|
|
|
|
- null,
|
|
|
|
|
- icon_1,
|
|
|
|
|
- icon_2,
|
|
|
|
|
- icon_3
|
|
|
|
|
-]
|
|
|
|
|
-const banners=[
|
|
|
|
|
- null,
|
|
|
|
|
- banner_1,
|
|
|
|
|
- banner_2,
|
|
|
|
|
- banner_3
|
|
|
|
|
-]
|
|
|
|
|
|
|
+import {REQ_STATUS} from "@api/config";
|
|
|
|
|
+import SmallLoading from "@components/SmallLoading";
|
|
|
const WPromotion=({close})=>{
|
|
const WPromotion=({close})=>{
|
|
|
const navigate=useNavigate();
|
|
const navigate=useNavigate();
|
|
|
const redpack=useSelector(getRedPackInfo);
|
|
const redpack=useSelector(getRedPackInfo);
|
|
@@ -38,6 +22,7 @@ const WPromotion=({close})=>{
|
|
|
const agentBonus=useSelector(getBonusList);
|
|
const agentBonus=useSelector(getBonusList);
|
|
|
const dispatch=useDispatch();
|
|
const dispatch=useDispatch();
|
|
|
const data=useSelector(getActivityList);
|
|
const data=useSelector(getActivityList);
|
|
|
|
|
+ const status=useSelector(getActivityStatus);
|
|
|
// let data=[
|
|
// let data=[
|
|
|
// {
|
|
// {
|
|
|
// id:1,
|
|
// id:1,
|
|
@@ -62,42 +47,11 @@ const WPromotion=({close})=>{
|
|
|
// }
|
|
// }
|
|
|
// ]
|
|
// ]
|
|
|
useEffect(()=>{
|
|
useEffect(()=>{
|
|
|
|
|
+ if (data==null||data.length===0){
|
|
|
|
|
+ dispatch(reqGameActivity())
|
|
|
|
|
+ }
|
|
|
dispatch(reqRedpackCheck());
|
|
dispatch(reqRedpackCheck());
|
|
|
},[])
|
|
},[])
|
|
|
- const checkRenderDot=(item)=>{
|
|
|
|
|
- if (item.id===1){
|
|
|
|
|
- if (turnplate&&turnplate.times>0){
|
|
|
|
|
- return (<div className={styles.red_dot}></div>)
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- return (<></>);
|
|
|
|
|
- }
|
|
|
|
|
- const renderRedPackItem=(item)=>{
|
|
|
|
|
- if (redpack==null)return (<></>);
|
|
|
|
|
- let status=redpack.status;
|
|
|
|
|
- let cdLeft=redpack.next_in_seconds;
|
|
|
|
|
- let cdLeftStr=formatTime(cdLeft);
|
|
|
|
|
- return (
|
|
|
|
|
- <>
|
|
|
|
|
- <div className={styles.gift_title}>{status!==0?item.title:cdLeftStr}</div>
|
|
|
|
|
- <button className={styles.git_fun_item} onClick={() => {
|
|
|
|
|
- navigate(item.link);
|
|
|
|
|
- }}>
|
|
|
|
|
- <div className={styles.left}>
|
|
|
|
|
- <div className={styles.icon_con}>
|
|
|
|
|
- <img className={"iconshake"} src={icons[item.id]}/>
|
|
|
|
|
- {
|
|
|
|
|
- status===1? (<div className={styles.red_dot}></div>):(<></>)
|
|
|
|
|
- }
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
- <div className={styles.right}>
|
|
|
|
|
- <img src={banners[item.id]}/>
|
|
|
|
|
- </div>
|
|
|
|
|
- </button>
|
|
|
|
|
- </>
|
|
|
|
|
- )
|
|
|
|
|
- }
|
|
|
|
|
const checkDot=(item)=>{
|
|
const checkDot=(item)=>{
|
|
|
if (item.id===1){
|
|
if (item.id===1){
|
|
|
if (turnplate&&turnplate.times>0){
|
|
if (turnplate&&turnplate.times>0){
|
|
@@ -206,9 +160,13 @@ const WPromotion=({close})=>{
|
|
|
}
|
|
}
|
|
|
return (
|
|
return (
|
|
|
<div className={styles.container}>
|
|
<div className={styles.container}>
|
|
|
- <Spring type="slideUp" className={styles.content}>
|
|
|
|
|
- {renderList()}
|
|
|
|
|
- </Spring>
|
|
|
|
|
|
|
+ {
|
|
|
|
|
+ status===REQ_STATUS.LOADING?(<SmallLoading></SmallLoading>):(
|
|
|
|
|
+ <Spring type="slideUp" className={styles.content}>
|
|
|
|
|
+ {renderList()}
|
|
|
|
|
+ </Spring>
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
</div>
|
|
</div>
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|