Bläddra i källkod

根据eslint调整代码

zhangzf 1 vecka sedan
förälder
incheckning
71c87e72c6

+ 3 - 3
src/app/(public)/_components/HomeBestSellers.tsx

@@ -10,9 +10,9 @@ import Image from "next/image";
 interface jinGangSectionProps{
   bestSellerSection:HomeSection |undefined;
 }
-interface HomeBestSellersProps {
-  bestSellers: HomeProduct[];
-}
+// interface HomeBestSellersProps {
+//   bestSellers: HomeProduct[];
+// }
 const HomeBestSellers = ({ bestSellerSection }: jinGangSectionProps) => {
   const bestSellers: HomeProduct[] = bestSellerSection?.products ?? [];
   if (!bestSellers || bestSellers.length === 0) return null;

+ 14 - 14
src/app/(public)/_components/HomeMiddleBanner.tsx

@@ -1,7 +1,7 @@
 "use client";
-import { useState } from "react";
-import { Swiper, SwiperSlide } from "swiper/react";
-import { Navigation } from "swiper/modules";
+// import { useState } from "react";
+// import { Swiper, SwiperSlide } from "swiper/react";
+// import { Navigation } from "swiper/modules";
 import "swiper/css";
 import "swiper/css/navigation";
 import Image from "next/image";
@@ -10,21 +10,21 @@ interface middleBannerProps {
   middleBanner: HomeSectionImage[];
 }
 export default function HomeMiddleBanner({ middleBanner }: middleBannerProps) {
-  const [activeIndex, setActiveIndex] = useState(0);
+  // const [activeIndex, setActiveIndex] = useState(0);
 
-  const [swiperRef] = useState(null);
+  // const [swiperRef] = useState(null);
   if (!middleBanner || middleBanner.length === 0) return null;
   const middleBannerImages = middleBanner;
 
-  const handleSlideChange = (swiper: any) => {
-    setActiveIndex(swiper.activeIndex);
-  };
+  // const handleSlideChange = (swiper: any) => {
+  //   setActiveIndex(swiper.activeIndex);
+  // };
 
-  const handleIndicatorClick = (index: any) => {
-    if (swiperRef) {
-      setActiveIndex(index);
-    }
-  };
+  // const handleIndicatorClick = (index: any) => {
+  //   if (swiperRef) {
+  //     setActiveIndex(index);
+  //   }
+  // };
 
   return (
     <div className="w-full  mx-auto px-12 flex items-center justify-center gap-11 ">
@@ -37,7 +37,7 @@ export default function HomeMiddleBanner({ middleBanner }: middleBannerProps) {
       > */}
         {middleBannerImages.map((item, idx) => (
           // <SwiperSlide key={idx}>
-            <div className="relative w-full h-42">
+            <div key={idx} className="relative w-full h-42">
               <Image
                 src={item.image}
                 alt={item.title}

+ 1 - 1
src/app/(public)/_components/JinGangSwiper.tsx

@@ -2,7 +2,7 @@
 import { useState, useRef } from "react";
 import { Swiper, SwiperSlide } from "swiper/react";
 import type { Swiper as SwiperType } from "swiper/types";
-import { Navigation } from "swiper/modules";
+// import { Navigation } from "swiper/modules";
 import "swiper/css";
 import "swiper/css/navigation";
 import "swiper/css";

+ 2 - 0
src/app/(public)/_components/MiddleImageSwiper.tsx

@@ -140,6 +140,8 @@ const MiddleImageSwiper = ({ zeroWear,zeroWearImage }: zeroWearProps) => {
   if (!zeroWear || zeroWear.length === 0) return null;
   const  productList = zeroWear
   const WearImage = zeroWearImage;
+  console.log(WearImage);
+  
   return (
     <div className="w-full pr-4 pl-4 mx-auto flex  rounded-lg  ">
       <div className="w-[777px] h-full">

+ 3 - 3
src/app/(public)/_components/RecommendedProducts.tsx

@@ -3,9 +3,9 @@ import { useState, useEffect, useCallback } from "react";
 import Image from "next/image";
 import { OpenAddToCartModalButton } from "@/components/common/AddToCartModal/OpenAddToCartModalButton";
 import type {HomeProduct,HomeSection} from "@/types/home/type"
-interface recommendedProps {
-  recommended: HomeProduct[];
-}
+// interface recommendedProps {
+//   recommended: HomeProduct[];
+// }
 interface newArrivalSectionProps{
   recommendedSection:HomeSection |undefined;
 }

+ 7 - 8
src/app/(public)/_components/Trending.tsx

@@ -1,12 +1,12 @@
 import { useState, useRef, useEffect } from "react";
 import { Swiper, SwiperSlide } from "swiper/react";
 import type { Swiper as SwiperType } from "swiper/types";
-import { Navigation } from "swiper/modules";
+// import { Navigation } from "swiper/modules";
 import "swiper/css";
 import "swiper/css/navigation";
 import "swiper/css";
 import Image from "next/image";
-import Link from "next/link";
+// import Link from "next/link";
 import { OpenAddToCartModalButton } from "@/components/common/AddToCartModal/OpenAddToCartModalButton";
 import type { HomeProduct,HomeSection } from "@/types/home/type";
 interface newArrivalSectionProps{
@@ -66,9 +66,12 @@ const Trending = ({ trendingSection }: newArrivalSectionProps) => {
       videoRef.current.play().catch((err) => console.log("播放拦截", err));
     }
   }, [openVideoModal]);
-
+  const swiperRef = useRef<SwiperType | null>(null);
+  const [activePage, setActivePage] = useState(0);
+  const [isBeginning, setIsBeginning] = useState(true);
+  const [isEnd, setIsEnd] = useState(trending.length <= SLIDES_PER_VIEW);
   if (!trending || trending.length === 0) return null;
-  const productList = trending;
+  // const productList = trending;
 
   // 打开弹窗并赋值视频地址
   const handlePlayClick = (videoUrl: string) => {
@@ -84,10 +87,6 @@ const Trending = ({ trendingSection }: newArrivalSectionProps) => {
       videoRef.current.currentTime = 0;
     }
   };
-  const swiperRef = useRef<SwiperType | null>(null);
-  const [activePage, setActivePage] = useState(0);
-  const [isBeginning, setIsBeginning] = useState(true);
-  const [isEnd, setIsEnd] = useState(trending.length <= SLIDES_PER_VIEW);
   const pageCount = Math.ceil(trending.length / SLIDES_PER_VIEW);
 
   const syncSwiperState = (swiper: SwiperType) => {