|
@@ -3,7 +3,7 @@
|
|
|
import { receiveRedPacketApi } from "@/api/promo";
|
|
|
import { useRouter } from "@/i18n/routing";
|
|
|
import { getToken } from "@/utils/Cookies";
|
|
|
-import { Mask } from "antd-mobile";
|
|
|
+import { Mask, Toast } from "antd-mobile";
|
|
|
import { useTranslations } from "next-intl";
|
|
|
import { FC, forwardRef, memo, useEffect, useImperativeHandle, useRef, useState } from "react";
|
|
|
const randomX = (len: number) => {
|
|
@@ -412,13 +412,13 @@ const RedPacketModal = forwardRef<RedPacketModalProps, Props>(function RedPacket
|
|
|
try {
|
|
|
let actList = packets.current;
|
|
|
// 是否有已开始但是没领过的红包
|
|
|
- let packetsFilter = actList
|
|
|
- .filter((aItem) => {
|
|
|
- return aItem.can_receive && aItem.is_start && !aItem.is_receive;
|
|
|
- })
|
|
|
- .sort((pre, next) => pre.end_time - next.end_time);
|
|
|
+ let packetsFilter = actList;
|
|
|
+ // .filter((aItem) => {
|
|
|
+ // return aItem.is_start && aItem.can_receive && !aItem.is_receive;
|
|
|
+ // })
|
|
|
+ // .sort((pre, next) => pre.end_time - next.end_time);
|
|
|
|
|
|
- // 有可领取红包
|
|
|
+ // 有可领取红包 - is_start = true -> all
|
|
|
if (packetsFilter.length > 0) {
|
|
|
let current = packetsFilter[activeIndex.current];
|
|
|
let iconList = JSON.parse(current.icon);
|
|
@@ -429,16 +429,18 @@ const RedPacketModal = forwardRef<RedPacketModalProps, Props>(function RedPacket
|
|
|
if (!token) {
|
|
|
setStatus(Status.is_end);
|
|
|
} else {
|
|
|
- setStatus(Status.is_start);
|
|
|
+ setStatus(current.can_receive ? Status.is_start : Status.is_end);
|
|
|
}
|
|
|
} else {
|
|
|
// 无可领取红包
|
|
|
// 展示最近可领红包详情
|
|
|
- let packets = actList.sort((pre, next) => pre.end_time - next.end_time);
|
|
|
- packetCurrent.current = packets[0];
|
|
|
- setIconLists(JSON.parse(packets[0].icon));
|
|
|
- // 无可领取红包展示详情
|
|
|
- setStatus(Status.is_end);
|
|
|
+ // let packets = actList.sort((pre, next) => pre.end_time - next.end_time);
|
|
|
+ // packetCurrent.current = packets[0];
|
|
|
+ // setIconLists(JSON.parse(packets[0].icon));
|
|
|
+ // // 无可领取红包展示详情
|
|
|
+ // setStatus(Status.is_end);
|
|
|
+
|
|
|
+ Toast.show("The event is not open");
|
|
|
}
|
|
|
} catch (error) {
|
|
|
console.log("redPacketInfo===>error:", error);
|