|
@@ -1,40 +1,42 @@
|
|
|
"use client";
|
|
|
-import React, {useState} from 'react'
|
|
|
-import PopupHby from "@/app/[locale]/(TabBar)/(entire)/promo/PopupHby";
|
|
|
import Box from "@/components/Box";
|
|
|
+import { useState } from "react";
|
|
|
+import PopupHby from "./PopupHby";
|
|
|
|
|
|
-
|
|
|
-const Promo = ({promotion}:any) => {
|
|
|
+const Promo = ({ promotion }: any) => {
|
|
|
const [isShowRedPacket, setIsShowRedPacket] = useState<any>(false);
|
|
|
-
|
|
|
|
|
|
- const onGoPromo = (e:any,item:any) => {
|
|
|
+ const onGoPromo = (e: any, item: any) => {
|
|
|
e.stopPropagation();
|
|
|
- console.log('onGoPromo',item)
|
|
|
+ console.log("onGoPromo", item);
|
|
|
// 4:跳转弹窗,action_params==>red_packet:代表红包雨弹窗
|
|
|
- if(item.action_type === 4 && item.action_params === 'red_packet'){
|
|
|
- setIsShowRedPacket(true)
|
|
|
+ if (item.action_type === 4 && item.action_params === "red_packet") {
|
|
|
+ setIsShowRedPacket(true);
|
|
|
}
|
|
|
- }
|
|
|
+ };
|
|
|
|
|
|
return (
|
|
|
<>
|
|
|
- {promotion.map((item:any, index:number) => (
|
|
|
- <Box key={item.id} action={item.action_type} actionData={item.action_params} >
|
|
|
+ {promotion.map((item: any, index: number) => (
|
|
|
+ <Box key={item.id} action={item.action_type} actionData={item.action_params}>
|
|
|
<img
|
|
|
width={0}
|
|
|
height={0}
|
|
|
src={item.content!}
|
|
|
alt={"Image"}
|
|
|
className={"h-[1.16rem] w-[100%] rounded-[0.0833rem]"}
|
|
|
- onClick={(e) => onGoPromo(e,item)}
|
|
|
+ onClick={(e) => onGoPromo(e, item)}
|
|
|
/>
|
|
|
</Box>
|
|
|
))}
|
|
|
{/* 红包弹窗 */}
|
|
|
- {
|
|
|
- isShowRedPacket && (<PopupHby onClose={()=>{setIsShowRedPacket(false)}} />)
|
|
|
- }
|
|
|
+ {isShowRedPacket && (
|
|
|
+ <PopupHby
|
|
|
+ onClose={() => {
|
|
|
+ setIsShowRedPacket(false);
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ )}
|
|
|
</>
|
|
|
);
|
|
|
};
|