|
@@ -9,7 +9,7 @@ import { neReg } from "@/utils";
|
|
|
import { Button, Form, Input, Toast } from "antd-mobile";
|
|
|
import { FormInstance } from "antd-mobile/es/components/form";
|
|
|
import { useTranslations } from "next-intl";
|
|
|
-import { FC, useLayoutEffect, useRef, useState } from "react";
|
|
|
+import { FC, useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
|
|
|
|
import actions from "@/app/[locale]/(TabBar)/deposit/actions";
|
|
|
import Empty from "@/components/Empty";
|
|
@@ -20,7 +20,9 @@ import "@/styles/deposit.scss";
|
|
|
import { server } from "@/utils/client";
|
|
|
import clsx from "clsx";
|
|
|
import { Swiper, SwiperSlide } from "swiper/react";
|
|
|
-interface Props {}
|
|
|
+interface Props {
|
|
|
+ onActiveChange?: (activeType: DepositsTypes) => void;
|
|
|
+}
|
|
|
|
|
|
interface RewardsProps {
|
|
|
rewards: RewardsType[];
|
|
@@ -93,6 +95,12 @@ const DepositData: FC<Props> = (props) => {
|
|
|
const formInstanceRef = useRef<FormInstance>(null);
|
|
|
let [amount, setAmount] = useState<number | undefined>(undefined);
|
|
|
|
|
|
+ useEffect(() => {
|
|
|
+ if (props.onActiveChange) {
|
|
|
+ props.onActiveChange(activeType as DepositsTypes);
|
|
|
+ }
|
|
|
+ }, [activeType]);
|
|
|
+
|
|
|
const titleChangeHandler = (item: DepositsTypes, index: number) => {
|
|
|
setAmount(undefined);
|
|
|
setActiveType(item);
|
|
@@ -175,7 +183,7 @@ const DepositData: FC<Props> = (props) => {
|
|
|
|
|
|
return (
|
|
|
<div className="deposit-box">
|
|
|
- <div className="img-box">
|
|
|
+ {/* <div className="img-box">
|
|
|
<img
|
|
|
className={"h-[100%] w-[100%] object-cover"}
|
|
|
src={activeType.icon || ""}
|
|
@@ -183,7 +191,7 @@ const DepositData: FC<Props> = (props) => {
|
|
|
width={160}
|
|
|
height={40}
|
|
|
/>
|
|
|
- </div>
|
|
|
+ </div> */}
|
|
|
|
|
|
{/*<div className={"flex flex-wrap"}>*/}
|
|
|
{/* {depositState.map((item, index) => {*/}
|
|
@@ -207,9 +215,9 @@ const DepositData: FC<Props> = (props) => {
|
|
|
boxShadow: activeType?.id === item.id ? "none":,
|
|
|
borderColor: activeType?.id === item.id ? "#d917ff",
|
|
|
} */}
|
|
|
- <Swiper slidesPerView={"auto"} centeredSlidesBounds>
|
|
|
+ <Swiper slidesPerView={3} spaceBetween={10} centeredSlidesBounds>
|
|
|
{depositState?.map((item, index) => (
|
|
|
- <SwiperSlide key={index} className={"max-w-fit"}>
|
|
|
+ <SwiperSlide key={index}>
|
|
|
<p
|
|
|
className={clsx("btn-box truncate", {
|
|
|
active: activeType?.id === item.id, // 检查是否为当前活动项,添加active类名
|