import React, { useEffect, useState, useRef, useCallback } from "react";
import { Toast, Swiper, Image } from "antd-mobile";
import LoadingMask from "@/components/LoadingMask";
import { useRouter } from "next/navigation";
import requireAPI from "@/utils/requireAPI";
import OwnImage from "@/components/OwnImage";
import { goToPage } from "@/utils/tools";
export default function Banner() {
const [bannerList, setBannerList] = useState([]);
const [isLoading, setIsLoading] = useState(false);
const router = useRouter();
const ref = useRef(null);
useEffect(() => {
const getBannerList = async () => {
setIsLoading(true);
try {
const _data = await requireAPI(
"POST",
"/api/activity_banner/list",
null,
true
);
if (_data.ret === -1) {
Toast.show({
icon: "fail",
content: _data.msg,
position: "top",
});
return;
}
setBannerList(_data.data.list);
} catch (error) {
console.error(error);
} finally {
setIsLoading(false);
}
};
getBannerList();
}, []);
const items = useCallback(
(item, index) => (