|
|
@@ -1,5 +1,5 @@
|
|
|
import React from 'react'
|
|
|
-import { View, Text, ScrollView, Swiper, SwiperItem, Image } from '@tarojs/components'
|
|
|
+import { View, Text, ScrollView } from '@tarojs/components'
|
|
|
import { useInfiniteQuery, useQuery } from '@tanstack/react-query'
|
|
|
import { TabBarLayout } from '@/layouts/tab-bar-layout'
|
|
|
import TDesignSearch from '@/components/tdesign/search'
|
|
|
@@ -11,6 +11,7 @@ import './index.css'
|
|
|
import { useAuth } from '@/utils/auth'
|
|
|
import { useCart } from '@/contexts/CartContext'
|
|
|
import { Navbar } from '@/components/ui/navbar'
|
|
|
+import { Carousel } from '@/components/ui/carousel'
|
|
|
import Taro from '@tarojs/taro'
|
|
|
|
|
|
type GoodsResponse = InferResponseType<typeof goodsClient.$get, 200>
|
|
|
@@ -189,28 +190,18 @@ const HomePage: React.FC = () => {
|
|
|
<Text className="error-text">广告加载失败</Text>
|
|
|
</View>
|
|
|
) : finalImgSrcs && finalImgSrcs.length > 0 ? (
|
|
|
- <Swiper
|
|
|
- className="w-full"
|
|
|
- style={{ height: '800rpx', width: '100%' }}
|
|
|
+ <Carousel
|
|
|
+ items={finalImgSrcs.filter(item => item.imageFile?.fullUrl).map(item => ({
|
|
|
+ src: item.imageFile!.fullUrl,
|
|
|
+ title: item.title || '',
|
|
|
+ description: item.description || ''
|
|
|
+ }))}
|
|
|
+ height={800}
|
|
|
autoplay={true}
|
|
|
+ interval={4000}
|
|
|
circular={true}
|
|
|
- indicatorDots={true}
|
|
|
- indicatorColor="rgba(0, 0, 0, .3)"
|
|
|
- indicatorActiveColor="#000"
|
|
|
- >
|
|
|
- {finalImgSrcs.filter(item => item.imageFile?.fullUrl).map((item, index) => (
|
|
|
- <SwiperItem key={index} className="w-full h-full">
|
|
|
- <View className="w-full h-full flex items-center justify-center bg-gray-100">
|
|
|
- <Image
|
|
|
- src={item.imageFile!.fullUrl}
|
|
|
- mode="heightFix"
|
|
|
- style={{ height: '800rpx', width: 'auto' }}
|
|
|
- lazyLoad
|
|
|
- />
|
|
|
- </View>
|
|
|
- </SwiperItem>
|
|
|
- ))}
|
|
|
- </Swiper>
|
|
|
+ imageMode="aspectFill"
|
|
|
+ />
|
|
|
) : (
|
|
|
<View className="empty-container">
|
|
|
<Text className="empty-text">暂无广告</Text>
|