diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx index fd839e3..cf20cfb 100644 --- a/src/pages/index/index.tsx +++ b/src/pages/index/index.tsx @@ -190,6 +190,19 @@ const IndexPage: React.FC = () => { } } + // 轮播图数据:每个广告位下的所有图片都作为独立轮播项 + const bannerSlides = banners.flatMap(item => + (item.imageList && item.imageList.length > 0) + ? item.imageList.map((img, idx) => ({ + key: `${item.adId}-${img.uid || idx}`, + src: img.url || '', + path: item.path, + })) + : item.image + ? [{ key: `${item.adId}-0`, src: item.image, path: item.path }] + : [] + ) + return ( {/* 顶部搜索栏 */} @@ -221,21 +234,21 @@ const IndexPage: React.FC = () => { {/* 轮播图 */} - {banners.length > 0 ? ( + {bannerSlides.length > 0 ? ( - {banners.map(item => ( - + {bannerSlides.map(slide => ( + { - if (item.path) Taro.navigateTo({ url: item.path }) + if (slide.path) Taro.navigateTo({ url: slide.path }) }} />