|
@@ -1,6 +1,6 @@
|
|
|
"use client";
|
|
|
import { ServiceTypes } from "@/api/customservice";
|
|
|
-import { getPaysApi, lredPacketApi, PayDataType, redPacketApi } from "@/api/promo";
|
|
|
+import { lredPacketApi, redPacketApi } from "@/api/promo";
|
|
|
import UserRecharge, { ModalRefProps, Timeout } from "@/components/ModalPopup/RechargeModal";
|
|
|
import RedPacketModal, { RedPacketModalProps } from "@/components/ModalPopup/RedPacketModal";
|
|
|
import SlotsModal, { SlotModalRefProps } from "@/components/ModalPopup/SlotsModal";
|
|
@@ -11,10 +11,10 @@ import { getGiveInfoApi } from "@/api/slots";
|
|
|
import SignInModal, { SignInModalProps } from "@/components/ModalPopup/SignInModal";
|
|
|
import { useEventPoint } from "@/hooks/useEventPoint";
|
|
|
import { Link } from "@/i18n/routing";
|
|
|
+import { useFirstPayStore } from "@/stores/useFirstPayStore";
|
|
|
import { useGlobalNoticeStore } from "@/stores/useGlobalNoticeStore";
|
|
|
-import { SignType, useSignStore } from "@/stores/useSignStore";
|
|
|
+import { useSignStore } from "@/stores/useSignStore";
|
|
|
import useWheelStore from "@/stores/useWheelStore";
|
|
|
-import { server } from "@/utils/client";
|
|
|
import { getToken } from "@/utils/Cookies";
|
|
|
import { useRequest } from "ahooks";
|
|
|
import { Badge } from "antd-mobile";
|
|
@@ -108,58 +108,64 @@ const WheelSection = () => {
|
|
|
const PaySection = () => {
|
|
|
const token = getToken();
|
|
|
|
|
|
+ const { firstPay, getPayData } = useFirstPayStore((state) => {
|
|
|
+ return {
|
|
|
+ firstPay: state.first_pay,
|
|
|
+ getPayData: state.getPayData,
|
|
|
+ };
|
|
|
+ });
|
|
|
+
|
|
|
const userRechargeRef = useRef<ModalRefProps>(null);
|
|
|
// 首充活动
|
|
|
- const getPayInfo = async (): Promise<PayDataType> => {
|
|
|
- if (token) {
|
|
|
- const result = await getPaysApi();
|
|
|
- return result.data;
|
|
|
- } else {
|
|
|
- return Promise.resolve({
|
|
|
- first_pay: [],
|
|
|
- pay: [],
|
|
|
- });
|
|
|
- }
|
|
|
- };
|
|
|
+ // const getPayInfo = async (): Promise<PayDataType> => {
|
|
|
+ // if (token) {
|
|
|
+ // const result = await getPaysApi();
|
|
|
+ // return result.data;
|
|
|
+ // } else {
|
|
|
+ // return Promise.resolve({
|
|
|
+ // first_pay: [],
|
|
|
+ // pay: [],
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // };
|
|
|
+ // const getPayInfo = async (): Promise<PayDataType> => {};
|
|
|
|
|
|
- const { data: paysInfo, run: payRun } = useRequest<PayDataType, any>(getPayInfo, {
|
|
|
+ const { data, run: payRun } = useRequest(getPayData, {
|
|
|
pollingErrorRetryCount: 1,
|
|
|
pollingWhenHidden: false,
|
|
|
});
|
|
|
return (
|
|
|
<>
|
|
|
- {paysInfo &&
|
|
|
- paysInfo.first_pay &&
|
|
|
- paysInfo.first_pay.map((item, index) => {
|
|
|
- return (
|
|
|
- <div
|
|
|
- key={index}
|
|
|
- className={`mb-[0.2778rem] flex cursor-pointer flex-col items-center`}
|
|
|
- >
|
|
|
- <img
|
|
|
- className={"w-[0.54rem]"}
|
|
|
- src="/hby/recharge.png"
|
|
|
- onClick={() => {
|
|
|
- userRechargeRef.current?.onOpen &&
|
|
|
- userRechargeRef.current?.onOpen(paysInfo?.first_pay, index);
|
|
|
- }}
|
|
|
+ {firstPay.map((item, index) => {
|
|
|
+ return (
|
|
|
+ <div
|
|
|
+ key={index}
|
|
|
+ className={`mb-[0.2778rem] flex cursor-pointer flex-col items-center`}
|
|
|
+ >
|
|
|
+ <img
|
|
|
+ className={"w-[0.54rem]"}
|
|
|
+ src="/hby/recharge.png"
|
|
|
+ onClick={() => {
|
|
|
+ userRechargeRef.current?.onOpen &&
|
|
|
+ userRechargeRef.current?.onOpen(firstPay, index);
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ {item.count_down > 0 ? (
|
|
|
+ <Timeout
|
|
|
+ className={
|
|
|
+ "relative before:left-0 before:top-0 before:content-['']" +
|
|
|
+ " -m-[0.0417rem] before:h-[100%] before:blur-[0.0486rem]" +
|
|
|
+ " before:absolute before:-z-10 before:w-[100%] before:bg-[#ed9d00]" +
|
|
|
+ " text-[0.08rem]" +
|
|
|
+ " z-1 text-[#fff]"
|
|
|
+ }
|
|
|
+ endTime={item.count_down}
|
|
|
+ onEndHandler={payRun}
|
|
|
/>
|
|
|
- {item.end_time > 0 ? (
|
|
|
- <Timeout
|
|
|
- className={
|
|
|
- "relative before:left-0 before:top-0 before:content-['']" +
|
|
|
- " -m-[0.0417rem] before:h-[100%] before:blur-[0.0486rem]" +
|
|
|
- " before:absolute before:-z-10 before:w-[100%] before:bg-[#ed9d00]" +
|
|
|
- " text-[0.08rem]" +
|
|
|
- " z-1 text-[#fff]"
|
|
|
- }
|
|
|
- endTime={item.end_time}
|
|
|
- onEndHandler={payRun}
|
|
|
- />
|
|
|
- ) : null}
|
|
|
- </div>
|
|
|
- );
|
|
|
- })}
|
|
|
+ ) : null}
|
|
|
+ </div>
|
|
|
+ );
|
|
|
+ })}
|
|
|
|
|
|
{/*首充弹窗*/}
|
|
|
<UserRecharge ref={userRechargeRef} />
|
|
@@ -277,26 +283,17 @@ const CustomerSection: FC<Omit<Props, "socials">> = (props) => {
|
|
|
/**
|
|
|
* 签到活动
|
|
|
*/
|
|
|
-
|
|
|
-const getSignDetailsApi = (data: { activity_id: number }) => {
|
|
|
- return server.post<SignType>({
|
|
|
- url: "/v1/api/user/activity/signInInfo",
|
|
|
- data,
|
|
|
- });
|
|
|
-};
|
|
|
const SignInSection: FC = () => {
|
|
|
const SignInRef = useRef<SignInModalProps>(null);
|
|
|
|
|
|
- const { setSignData, signData } = useSignStore((state) => {
|
|
|
+ const { getSignData, signData } = useSignStore((state) => {
|
|
|
return {
|
|
|
- setSignData: state.setSignData,
|
|
|
+ getSignData: state.getSignData,
|
|
|
signData: state.signData,
|
|
|
};
|
|
|
});
|
|
|
useEffect(() => {
|
|
|
- if (getToken()) {
|
|
|
- // setSignData({ active_id: 3 });
|
|
|
- }
|
|
|
+ getSignData({ active_id: 14 });
|
|
|
}, []);
|
|
|
|
|
|
const signInHandle = () => {
|