|
@@ -310,6 +310,7 @@ const DrawMain = () => {
|
|
|
receiveTarget: state.receiveTarget,
|
|
|
}));
|
|
|
const shareRef = useRef<{ open: () => void } | null>(null);
|
|
|
+
|
|
|
return (
|
|
|
<>
|
|
|
<WheelWallet />
|
|
@@ -325,7 +326,7 @@ const DrawMain = () => {
|
|
|
|
|
|
{/*倒计时*/}
|
|
|
<div className={"relative flex justify-center"}>
|
|
|
- {!receiveTarget.unique_id ? <CountdownClient /> : <ReceiveClient />}
|
|
|
+ <CountdownClient />
|
|
|
</div>
|
|
|
{/*分享*/}
|
|
|
{currentWheel.end_time && currentWheel.end_time > 0 ? (
|
|
@@ -337,6 +338,7 @@ const DrawMain = () => {
|
|
|
|
|
|
const ReceiveClient = () => {
|
|
|
const [visible, setVisible] = useState(false);
|
|
|
+ const wheel = useContext(WheelContext);
|
|
|
const t = useTranslations();
|
|
|
const { receiveTarget, setWheel } = useWheelStore((state) => ({
|
|
|
statusWheel: state.status,
|
|
@@ -409,7 +411,9 @@ const ReceiveClient = () => {
|
|
|
);
|
|
|
};
|
|
|
const CountdownClient = () => {
|
|
|
+ const [visible, setVisible] = useState(false);
|
|
|
const wheel = useContext(WheelContext);
|
|
|
+ const t = useTranslations();
|
|
|
const { setWheel, currentWheel, receiveTarget } = useWheelStore((state) => ({
|
|
|
statusWheel: state.status,
|
|
|
currentWheel: state.currentWheel,
|
|
@@ -420,13 +424,77 @@ const CountdownClient = () => {
|
|
|
leftTime: currentWheel.end_time ? currentWheel.end_time * 1000 - Date.now() : 0,
|
|
|
});
|
|
|
const { days, hours, minutes, seconds } = formattedRes;
|
|
|
+
|
|
|
+ const receiveHandler = () => {
|
|
|
+ getWheelReceiveApi({ unique_id: receiveTarget.unique_id! })
|
|
|
+ .then(() => {
|
|
|
+ setVisible(true);
|
|
|
+ // setWheel();
|
|
|
+ })
|
|
|
+ .catch((error) => {
|
|
|
+ Toast.show(t(`code.${error.data.code || 500}`));
|
|
|
+ });
|
|
|
+ };
|
|
|
return (
|
|
|
<>
|
|
|
- <img src="/wheels/countdown-bg.png" alt="" />
|
|
|
- <span className={"absolute bottom-[50%] ml-[0.2083rem] translate-y-1/2"}>
|
|
|
- {String(days).padStart(2, "0")}:{String(hours).padStart(2, "0")}:
|
|
|
- {String(minutes).padStart(2, "0")}:{String(seconds).padStart(2, "0")}
|
|
|
- </span>
|
|
|
+ {!receiveTarget.unique_id ? (
|
|
|
+ <>
|
|
|
+ <img src="/wheels/countdown-bg.png" alt="" />
|
|
|
+ <span className={"absolute bottom-[50%] ml-[0.2083rem] translate-y-1/2"}>
|
|
|
+ {String(days).padStart(2, "0")}:{String(hours).padStart(2, "0")}:
|
|
|
+ {String(minutes).padStart(2, "0")}:{String(seconds).padStart(2, "0")}
|
|
|
+ </span>
|
|
|
+ </>
|
|
|
+ ) : (
|
|
|
+ <div className={"mt-[10px]"}>
|
|
|
+ <Image
|
|
|
+ src={"/wheels/receive-button.png"}
|
|
|
+ alt={"receive"}
|
|
|
+ height={80}
|
|
|
+ width={160}
|
|
|
+ onClick={receiveHandler}
|
|
|
+ ></Image>
|
|
|
+ </div>
|
|
|
+ )}
|
|
|
+ <Mask visible={visible}>
|
|
|
+ <div className={"absolute top-[50%] w-[100%] -translate-y-1/2 p-[0.1389rem]"}>
|
|
|
+ <div
|
|
|
+ className={
|
|
|
+ "h-[2.0833rem] rounded-[0.0694rem] bg-[#232327FF]" +
|
|
|
+ " flex flex-col justify-between p-[0.1389rem]"
|
|
|
+ }
|
|
|
+ >
|
|
|
+ <div className={"mb-[0.1389rem] text-center"}>
|
|
|
+ Parabéns por conseguir 100 BRL
|
|
|
+ </div>
|
|
|
+ <div className={"flex justify-center"}>
|
|
|
+ <img
|
|
|
+ src="/wheel/cash.png"
|
|
|
+ alt=""
|
|
|
+ className={"w-[0.6rem] object-contain"}
|
|
|
+ />
|
|
|
+ <div
|
|
|
+ className={
|
|
|
+ "ml-[0.1389rem] text-[0.2778rem] font-black" + " text-[#fb8b05]"
|
|
|
+ }
|
|
|
+ >
|
|
|
+ <p>R$ 100</p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <Link href={"/"}>
|
|
|
+ <div
|
|
|
+ className={
|
|
|
+ "h-[0.34rem] w-[100%] rounded-[0.0694rem] bg-[#fb8b05] text-[#fff]" +
|
|
|
+ " flex items-center justify-center"
|
|
|
+ }
|
|
|
+ >
|
|
|
+ Voltar à página inicial
|
|
|
+ </div>
|
|
|
+ </Link>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </Mask>
|
|
|
</>
|
|
|
);
|
|
|
};
|