|
|
@@ -10,6 +10,8 @@ import MiddleImageSwiper from "./MiddleImageSwiper";
|
|
|
import Trending from "./Trending";
|
|
|
import RecommendedProducts from "./RecommendedProducts";
|
|
|
import CategoryTabSwiper from "./CategoryTabSwiper ";
|
|
|
+import Image from "next/image";
|
|
|
+import Link from "next/link";
|
|
|
import type {HomeApiData,HomeProduct } from "@/types/home/type"
|
|
|
import {CustomerService} from "@/components/common/CustomerService/CustomerService";
|
|
|
// 定义组件入参类型
|
|
|
@@ -98,31 +100,34 @@ export default function HomeContent({ homeData }: HomeContentProps) {
|
|
|
// categories
|
|
|
} = homeData;
|
|
|
// 过滤出 banner 板块
|
|
|
- const bannerSection = sections.find(sec => sec.name === "banner");
|
|
|
+ const bannerSection = sections.find(sec => sec.showstyle === '2');
|
|
|
const bannerImages = bannerSection?.images ?? [];
|
|
|
// 过滤出 banner 板块
|
|
|
- const jinGangSection = sections.find(sec => sec.id === 13);
|
|
|
+ const jinGangSection = sections.find(sec => sec.showstyle === '3');
|
|
|
const jinGang = jinGangSection?.images ?? [];
|
|
|
// 2. 筛选热销板块,假设后端name为 best_sellers,自行修改匹配后端标识
|
|
|
- const bestSellerSection = sections.find(sec => sec.name === "BestSellers");
|
|
|
+ const bestSellerSection = sections.find(sec => sec.showstyle === '4');
|
|
|
const bestSellers: HomeProduct[] = bestSellerSection?.products ?? [];
|
|
|
// 过滤出 banner 板块
|
|
|
- const middleBannerSection = sections.find(sec => sec.id === 15);
|
|
|
+ const middleBannerSection = sections.find(sec => sec.showstyle === '5');
|
|
|
const middleBanner = middleBannerSection?.images ?? [];
|
|
|
// 3. 筛选new Arrival板块
|
|
|
- const newArrivalSection = sections.find(sec => sec.name === "New_Arrival");
|
|
|
+ const newArrivalSection = sections.find(sec => sec.showstyle === '6');
|
|
|
const newArrival: HomeProduct[] = newArrivalSection?.products ?? [];
|
|
|
// 4. 筛选7板块
|
|
|
- const zeroWearImageSection = sections.find(sec => sec.id === 18);
|
|
|
+ const zeroWearImageSection = sections.find(sec => sec.showstyle === '7');
|
|
|
const zeroWearImage= zeroWearImageSection?.images ?? [];
|
|
|
// 4. 筛选7板块
|
|
|
- const zeroWearSection = sections.find(sec => sec.name === "7");
|
|
|
+ const zeroWearSection = sections.find(sec => sec.showstyle === '8');
|
|
|
const zeroWear: HomeProduct[] = zeroWearSection?.products ?? [];
|
|
|
// 4. 筛选trendingSection板块
|
|
|
- const trendingSection = sections.find(sec => sec.name === "Trending_Now");
|
|
|
+ const trendingSection = sections.find(sec => sec.showstyle === '9');
|
|
|
const trending: HomeProduct[] = trendingSection?.products ?? [];
|
|
|
+ // 4. 筛选7板块
|
|
|
+ const bottomBannerSection = sections.find(sec => sec.showstyle === '10');
|
|
|
+ const bottomBanner= bottomBannerSection?.images ?? [];
|
|
|
// 4. Recommended
|
|
|
- const recommendedSection = sections.find(sec => sec.name === "Recommended_For_You");
|
|
|
+ const recommendedSection = sections.find(sec => sec.showstyle === '11');
|
|
|
const recommended: HomeProduct[] = recommendedSection?.products ?? [];
|
|
|
return (<>
|
|
|
<div className="min-h-screen bg-white font-sans">
|
|
|
@@ -148,6 +153,18 @@ export default function HomeContent({ homeData }: HomeContentProps) {
|
|
|
<HomeNewArrival newArrival={newArrival} />
|
|
|
<MiddleImageSwiper zeroWear={zeroWear} zeroWearImage={zeroWearImage} />
|
|
|
<Trending trending={trending}/>
|
|
|
+ {
|
|
|
+ (bottomBanner && bottomBanner.length !== 0) ? (
|
|
|
+ <Link href={bottomBanner[0].link} className="relative w-full aspect-[3/4] mt-8">
|
|
|
+ <Image
|
|
|
+ src={bottomBanner[0].image}
|
|
|
+ alt={bottomBanner[0].title}
|
|
|
+ fill
|
|
|
+ className="object-cover rounded-md"
|
|
|
+ />
|
|
|
+ </Link>
|
|
|
+ ) : null
|
|
|
+ }
|
|
|
<RecommendedProducts recommended={recommended} />
|
|
|
<CategoryTabSwiper />
|
|
|
</div>
|