|
@@ -3,6 +3,9 @@
|
|
|
import Box from "@/components/Box";
|
|
|
import { useUserInfoStore } from "@/stores/useUserInfoStore";
|
|
|
import { LuckyWheel } from "@lucky-canvas/react";
|
|
|
+import { useCountDown } from "ahooks";
|
|
|
+import { Popup } from "antd-mobile";
|
|
|
+import Image from "next/image";
|
|
|
import { useEffect, useRef, useState } from "react";
|
|
|
import LotteryWheel from "./LotteryWheel";
|
|
|
import styles from "./style.module.scss";
|
|
@@ -372,26 +375,28 @@ const WheelWallet = () => {
|
|
|
};
|
|
|
const DrawMain = () => {
|
|
|
const myLucky = useRef<any>();
|
|
|
-
|
|
|
+ const desktopWheelRef = useRef<any>();
|
|
|
const [blocks] = useState([
|
|
|
{
|
|
|
- // padding: "20",
|
|
|
+ padding: "0",
|
|
|
imgs: [
|
|
|
- // {
|
|
|
- // src: "/wheels/wheel-bg.png",
|
|
|
- // width: "100%",
|
|
|
- // height: "100%",
|
|
|
- // },
|
|
|
+ {
|
|
|
+ src: "/wheels/center-light.png",
|
|
|
+ width: "100%",
|
|
|
+ height: "100%",
|
|
|
+ },
|
|
|
],
|
|
|
},
|
|
|
]);
|
|
|
const [prizes] = useState([
|
|
|
- { fonts: [{ text: "0", top: "20%" }], background: "#e9e8fe" },
|
|
|
- { fonts: [{ text: "1", top: "20%" }], background: "#b8c5f2" },
|
|
|
- { fonts: [{ text: "2", top: "20%" }], background: "#e9e8fe" },
|
|
|
- { fonts: [{ text: "3", top: "10%" }], background: "#b8c5f2" },
|
|
|
- { fonts: [{ text: "4", top: "10%" }], background: "#e9e8fe" },
|
|
|
- { fonts: [{ text: "5", top: "10%" }], background: "#b8c5f2" },
|
|
|
+ { background: "#fde187", fonts: [{ text: "0", top: "20%" }] },
|
|
|
+ { background: "#faf3c3", fonts: [{ text: "1", top: "20%" }] },
|
|
|
+ { background: "#fde187", fonts: [{ text: "2", top: "20%" }] },
|
|
|
+ { background: "#faf3c3", fonts: [{ text: "3", top: "20%" }] },
|
|
|
+ { background: "#fde187", fonts: [{ text: "4", top: "20%" }] },
|
|
|
+ { background: "#faf3c3", fonts: [{ text: "5", top: "20%" }] },
|
|
|
+ { background: "#fde187", fonts: [{ text: "6", top: "20%" }] },
|
|
|
+ { background: "#faf3c3", fonts: [{ text: "7", top: "20%" }] },
|
|
|
]);
|
|
|
const [buttons] = useState([
|
|
|
{
|
|
@@ -408,39 +413,195 @@ const DrawMain = () => {
|
|
|
return (
|
|
|
<div className={"relative"}>
|
|
|
<WheelWallet />
|
|
|
- <div className={"relative border-[1px]"}>
|
|
|
- <img src={"/wheels/wheel-bg.png"} className={"h-[6rem] w-[100%] pt-[0.1389rem]"} />
|
|
|
- <div className={"flex h-[2.3rem] w-[100%] " + " justify-center border-[1px]"}>
|
|
|
- <LuckyWheel
|
|
|
- ref={myLucky}
|
|
|
- width="2.3rem"
|
|
|
- height="2.3rem"
|
|
|
- blocks={blocks}
|
|
|
- prizes={prizes}
|
|
|
- buttons={buttons}
|
|
|
- onStart={() => {
|
|
|
- // 点击抽奖按钮会触发star回调
|
|
|
- myLucky.current?.play();
|
|
|
- setTimeout(() => {
|
|
|
- const index = (Math.random() * 6) >> 0;
|
|
|
- myLucky.current?.stop(index);
|
|
|
- }, 2500);
|
|
|
- }}
|
|
|
- onEnd={(prize: any) => {
|
|
|
- // 抽奖结束会触发end回调
|
|
|
- alert("恭喜你抽到 " + prize.fonts[0].text + " 号奖品");
|
|
|
- }}
|
|
|
- />
|
|
|
+
|
|
|
+ <div className={"relative hidden w-[100%] pt-[20px] md:block"}>
|
|
|
+ <img src={"/wheels/wheel-bg.png"} className={"w-[100%]"} />
|
|
|
+ {/*定位到中心圆*/}
|
|
|
+ <div className={"absolute bottom-[0.0347rem] h-[2.6736rem] w-[100%]"}>
|
|
|
+ <div className={"flex h-[100%] w-[100%] justify-center text-center"}>
|
|
|
+ {/* 图片切换动画 */}
|
|
|
+ <img
|
|
|
+ src="/wheels/light-1.png"
|
|
|
+ alt=""
|
|
|
+ className={"mr-[0.0556rem] h-[100%]"}
|
|
|
+ />
|
|
|
+
|
|
|
+ <div
|
|
|
+ className={
|
|
|
+ "mr-[0.07rem] flex h-[2.3rem] w-[2.3rem] " +
|
|
|
+ " absolute" +
|
|
|
+ " bottom-[0.2rem]"
|
|
|
+ }
|
|
|
+ >
|
|
|
+ {/*<div*/}
|
|
|
+ {/* className={*/}
|
|
|
+ {/* "absolute h-[100%] w-[100%] rounded-[50%] " +*/}
|
|
|
+ {/* " z-50 border-[red]" +*/}
|
|
|
+ {/* ""*/}
|
|
|
+ {/* }*/}
|
|
|
+ {/* style={{*/}
|
|
|
+ {/* boxShadow: "rgba(255, 255, 255, 1) 0px 0px 60px 12px inset",*/}
|
|
|
+ {/* }}*/}
|
|
|
+ {/*>*/}
|
|
|
+ {/*</div>*/}
|
|
|
+
|
|
|
+ <LuckyWheel
|
|
|
+ ref={myLucky}
|
|
|
+ width="2.3rem"
|
|
|
+ height="2.3rem"
|
|
|
+ blocks={blocks}
|
|
|
+ prizes={prizes}
|
|
|
+ buttons={buttons}
|
|
|
+ onStart={() => {
|
|
|
+ // 点击抽奖按钮会触发star回调
|
|
|
+ myLucky.current?.play();
|
|
|
+ setTimeout(() => {
|
|
|
+ const index = (Math.random() * 6) >> 0;
|
|
|
+ myLucky.current?.stop(index);
|
|
|
+ }, 2500);
|
|
|
+ }}
|
|
|
+ onEnd={(prize: any) => {
|
|
|
+ // 抽奖结束会触发end回调
|
|
|
+ alert("恭喜你抽到 " + prize.fonts[0].text + " 号奖品");
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div className={"relative block w-[100%] pt-[20px] md:hidden"}>
|
|
|
+ <img src={"/wheels/wheel-bg.png"} className={"w-[100%]"} />
|
|
|
+ {/*定位到中心圆*/}
|
|
|
+ <div className={"absolute bottom-[0.0347rem]" + " h-[2.5rem]" + " w-[100%]"}>
|
|
|
+ <div className={"flex h-[100%] w-[100%] justify-center text-center"}>
|
|
|
+ {/* 图片切换动画 */}
|
|
|
+ <img
|
|
|
+ src="/wheels/light-1.png"
|
|
|
+ alt=""
|
|
|
+ className={"mr-[0.0556rem] h-[100%]"}
|
|
|
+ />
|
|
|
+
|
|
|
+ <div
|
|
|
+ className={
|
|
|
+ "-mr-[0.08rem] flex h-[2.3rem] w-[2.3rem] " +
|
|
|
+ " absolute" +
|
|
|
+ " bottom-[0.03rem]"
|
|
|
+ }
|
|
|
+ >
|
|
|
+ {/*<div*/}
|
|
|
+ {/* className={*/}
|
|
|
+ {/* "absolute h-[100%] w-[100%] rounded-[50%] " +*/}
|
|
|
+ {/* " z-50 border-[red]" +*/}
|
|
|
+ {/* ""*/}
|
|
|
+ {/* }*/}
|
|
|
+ {/* style={{*/}
|
|
|
+ {/* boxShadow: "rgba(255, 255, 255, 1) 0px 0px 60px 12px inset",*/}
|
|
|
+ {/* }}*/}
|
|
|
+ {/*>*/}
|
|
|
+ {/*</div>*/}
|
|
|
+
|
|
|
+ <LuckyWheel
|
|
|
+ ref={desktopWheelRef}
|
|
|
+ width="2.15rem"
|
|
|
+ height="2.15rem"
|
|
|
+ blocks={blocks}
|
|
|
+ prizes={prizes}
|
|
|
+ buttons={buttons}
|
|
|
+ onStart={() => {
|
|
|
+ // 点击抽奖按钮会触发star回调
|
|
|
+ desktopWheelRef.current?.play();
|
|
|
+ setTimeout(() => {
|
|
|
+ const index = (Math.random() * 6) >> 0;
|
|
|
+ desktopWheelRef.current?.stop(index);
|
|
|
+ }, 2500);
|
|
|
+ }}
|
|
|
+ onEnd={(prize: any) => {
|
|
|
+ // 抽奖结束会触发end回调
|
|
|
+ alert("恭喜你抽到 " + prize.fonts[0].text + " 号奖品");
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
);
|
|
|
};
|
|
|
+const CountdownClient = () => {
|
|
|
+ const [_, formattedRes] = useCountDown({
|
|
|
+ leftTime: 60 * 100000,
|
|
|
+ });
|
|
|
+ const { days, hours, minutes, seconds } = formattedRes;
|
|
|
+ return (
|
|
|
+ <div className={"relative flex justify-center"}>
|
|
|
+ <img src="/wheels/countdown-bg.png" alt="" />
|
|
|
+ <span className={"absolute bottom-[50%] translate-y-1/2"}>
|
|
|
+ {String(hours).padStart(2, "0")}:{String(minutes).padStart(2, "0")}:
|
|
|
+ {String(seconds).padStart(2, "0")}
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ );
|
|
|
+};
|
|
|
+const ShareClient = () => {
|
|
|
+ const handler = () => {};
|
|
|
+ const [visible, setVisible] = useState(false);
|
|
|
+ return (
|
|
|
+ <>
|
|
|
+ <div className={"p-[0.1389rem]"}>
|
|
|
+ <div
|
|
|
+ className={
|
|
|
+ "rounded-[0.1111rem] bg-gradient-to-b from-[#84ea24_20%] to-[#1b781a]" +
|
|
|
+ " h-[0.4861rem]"
|
|
|
+ }
|
|
|
+ >
|
|
|
+ <div className={"flex h-[100%] p-[0.0694rem]"}>
|
|
|
+ <div
|
|
|
+ className={
|
|
|
+ "flex-1 rounded-[0.0694rem] bg-[rgba(255,255,255,0.5)]" +
|
|
|
+ " flex items-center pl-[0.0694rem]"
|
|
|
+ }
|
|
|
+ >
|
|
|
+ <span className={""}>Compartilhe mais, saque mais rápido.</span>
|
|
|
+ </div>
|
|
|
+ {/* anniu */}
|
|
|
+ <div
|
|
|
+ className={"flex w-[0.4167rem] items-center pl-[0.0694rem]"}
|
|
|
+ onClick={() => setVisible(true)}
|
|
|
+ >
|
|
|
+ <Image src={"/wheels/share.png"} alt={"share"} width={30} height={30} />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <Popup
|
|
|
+ visible={visible}
|
|
|
+ getContainer={null}
|
|
|
+ onMaskClick={() => {
|
|
|
+ setVisible(false);
|
|
|
+ }}
|
|
|
+ onClose={() => {
|
|
|
+ setVisible(false);
|
|
|
+ }}
|
|
|
+ showCloseButton
|
|
|
+ bodyStyle={{ height: "30vh", background: "#fff" }}
|
|
|
+ >
|
|
|
+ <div className={"p-[20px] text-[#000]"}>
|
|
|
+ <h1>1.Convide amlgos para ajudar com saques</h1>
|
|
|
+ </div>
|
|
|
+ </Popup>
|
|
|
+ </>
|
|
|
+ );
|
|
|
+};
|
|
|
const CashWheelClient = () => {
|
|
|
return (
|
|
|
<>
|
|
|
<DrawMain />
|
|
|
- <div className={"text-center"}></div>
|
|
|
+ {/*倒计时*/}
|
|
|
+ <CountdownClient />
|
|
|
+ {/*分享*/}
|
|
|
+ <ShareClient />
|
|
|
<div className={styles.cashWheelClient}>
|
|
|
{/*<CashMainCom />*/}
|
|
|
{/*<DrawContent />*/}
|