Commit 608d58e4 authored by 俞嘉婷's avatar 俞嘉婷

feat: 红包雨开始结束逻辑重构

parent 0d3d42c4
......@@ -49,25 +49,13 @@ export default [
message: "",
timeStamp: Date.now(),
data: {
"redRainConfig": [
{
"channel": "1",
"endTime": "14:00:00",
"joinStatus": true,
"rainId": "1",
"ruId": null,
"startTime": "08:00:00"
"redRainConfig": {
canJoin: false, // 是否可参与,true-可参与
haveNext: true, // 是否有下一场,true-是
nextRainBeginTime: Date.now() + 1 * 24 * 60 * 60 * 1000, // 下一场红包雨开始时间戳,haveNext返回true时才有值
redRainCountDownTime: 10, // 红包雨倒计时长(单位:秒)
redRainId: '1', // 红包雨id
},
{
"channel": "1",
"endTime": "23:00:00",
"joinStatus": true,
"rainId": "2",
"ruId": null,
"startTime": "20:01:30"
}
],
"redRainCountDownTime": 0,
actStartTime: Date.now() - 1 * 24 * 60 * 60 * 1000,
actEndTime: Date.now() + 3 * 24 * 60 * 60 * 1000,
endPoint: Date.now() + 0.0001 * 24 * 60 * 60 * 1000,
......@@ -75,7 +63,6 @@ export default [
uid: '234234',
productEnd: false,
taskWealth: 3004044,
todayPopFlag: true,
ruleText: 'rulerulerulerulerulerulerule',
"bigStartConfig": new Array(6).fill(1).map((_, index) => {
if (index === 0) {
......
......@@ -16,14 +16,12 @@ import ResPage from '../ResPage/ResPage';
import Countdown from '@/core/components/ComCountdown/index.jsx';
import ProductListPage from '../productListPage/productListPage';
import PrizePage from "@/pages/PrizePage/PrizePage.tsx";
import RedPackRainModal from '@/panels/redPackRainModal/redPackRainModal';
import { NewbieModal } from '@/panels/newbieModal/newbieModal';
import SignCom from '@/panels/signCom/signCom.jsx';
import { SvgaPlayer } from '@grace/svgaplayer';
import mainPageTitle from '../../assets/svga/mainPageTitle.svga';
import redFenwei from '../../assets/svga/redFenwei.svga';
import RedPackCountPanel from '@/panels/redPackCountPanel/index.jsx';
import FirstPop from '@/panels/firstPop/firstPop';
@observer
class HomePage extends React.Component<any, any> {
......@@ -43,10 +41,6 @@ class HomePage extends React.Component<any, any> {
async componentDidMount() {
await store.judgeIsWhiteUser();
store.judgeRedModal();
if (store.indexData?.firstMoneyPop) {
ModalCtrl.showModal(FirstPop, store.indexData?.firstMoneyPop);
}
const { bigStartConfig, virtualAssets } = store.indexData;
const lockArr = (bigStartConfig || []).filter(el => {
......@@ -72,7 +66,6 @@ class HomePage extends React.Component<any, any> {
backOrder: lockArr.length - 2,
})
this.updateIndex();
// ModalCtrl.showModal(RedPackRainModal)
}
// 更新红包轮播索引
timer = null;
......@@ -203,11 +196,14 @@ class HomePage extends React.Component<any, any> {
componentWillUnmount(): void {
clearTimeout(this.timer);
/*
clearTimeout(store.leftOpenId);
store.leftOpenId = null;
store.leftOpenTime = 0;
*/
}
/*
getRedCountDown(redRainConfig) {
const now = new Date().getTime();
const today = dateFormatter(new Date(), 'yyyy-MM-dd');
......@@ -238,10 +234,14 @@ class HomePage extends React.Component<any, any> {
}
}
}
*/
render() {
const { curTab } = this.state;
const { bigStartConfig, virtualAssets, checkIn, recommendProductConfig, productEnd, endPoint, currentTime, redRainConfig, giftPop } = store.indexData
/*
const redDownTime = this.getRedCountDown(redRainConfig || []);
*/
const redDownTime = redRainConfig?.haveNext ? redRainConfig?.nextRainBeginTime - currentTime : 0;
// 推荐产品
const rProductList = recommendProductConfig?.filter((item) => +item.status === 0)
// 我的持仓
......
......@@ -20,6 +20,8 @@ class RedPackCountPanel extends React.Component {
close = () => {
ModalCtrl.closeModal()
}
/*
getRedCountDown(redRainConfig) {
const now = new Date().getTime();
const today = dateFormatter(new Date(), 'yyyy-MM-dd');
......@@ -50,9 +52,13 @@ class RedPackCountPanel extends React.Component {
}
}
}
*/
render() {
const { redRainConfig } = store.indexData
/*
const redDownTime = this.getRedCountDown(redRainConfig || []);
*/
const redDownTime = redRainConfig?.haveNext ? redRainConfig?.nextRainBeginTime - new Date().getTime() : 0;
return (<>
<div className="redPackCountPanel modal_center">
<span className="bg"></span>
......
......@@ -15,7 +15,7 @@ class RedPackRainModal extends Component<any, any> {
state = {
// 红包雨时间
gameDuration: store?.indexData?.redRainCountDownTime,
gameDuration: store?.indexData?.redRainConfig?.redRainCountDownTime || 0,
// 是否准备
showReady: true,
showRed: true,
......
......@@ -9,7 +9,7 @@ import { getDomain } from '@spark/dbdomain';
import { showShareGuide } from '@spark/share';
import Loginpop from '@/panels/loginpop/loginpop';
import InvalidPop from '@/panels/invalidPop/invalidPop';
import FirstPop from '@/panels/firstPop/firstPop';
import Tipspop from '@/panels/tipspop/tipspop';
import { isWeiXin, queryAppFundDetail } from '@/AppTools';
import { CHANNEL } from '@/AppTools';
......@@ -61,7 +61,6 @@ class Store {
}
indexData: {
redRainCountDownTime?: number,
redRainConfig?: any,
actStartTime?: number,
actEndTime?: number,
......@@ -160,9 +159,10 @@ class Store {
}
homeRoot = null;
/*
leftOpenTime = 0;
leftOpenId = null;
showGiftPop: boolean = false;
*/
async updateIndex() {
const { success, data, timeStamp } = await API.index();
if (!success) {
......@@ -172,7 +172,7 @@ class Store {
resData.currentTime = timeStamp;
this.indexData = resData;
const { firstMoneyPop, endPop, checkIn, codeList, giftPop, redRainConfig, todayPopFlag } = resData
const { firstMoneyPop, endPop, checkIn, codeList, giftPop, redRainConfig } = resData
// 计算进度条百分比
if (checkIn?.checkInConfig && checkIn?.totalCheckIn !== undefined) {
......@@ -192,13 +192,20 @@ class Store {
}
if (giftPop && giftPop?.todayPopFlag) {
// this.showGiftPop = true;
ModalCtrl.showModal(NewbieModal, { type: giftPop?.type, actPrizeVO: giftPop?.actPrizeVO })
}
if (redRainConfig?.canJoin) {
// 在时间段内,显示红包雨弹窗
ModalCtrl.showModal(RedPackRainModal, { redRainId: redRainConfig?.redRainId });
}
if (firstMoneyPop) {
ModalCtrl.showModal(FirstPop, firstMoneyPop);
}
}
/*
judgeRedModal() {
const redRainConfig = this.indexData?.redRainConfig
// 红包雨时间段判断
......@@ -241,6 +248,7 @@ class Store {
}
}
}
*/
/**
* 更新某些基金信息
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment