|
|
|
@ -1,8 +1,9 @@ |
|
|
|
|
import {Image, Swiper, SwiperItem, View} from "@tarojs/components"; |
|
|
|
|
import {Swiper, SwiperItem, View} from "@tarojs/components"; |
|
|
|
|
import {FC, useEffect, useState} from "react"; |
|
|
|
|
import {AdwareType} from "@/api"; |
|
|
|
|
import Taro from "@tarojs/taro"; |
|
|
|
|
import styles from '../home.module.scss' |
|
|
|
|
import Img from "@/components/image/image"; |
|
|
|
|
|
|
|
|
|
interface Props { |
|
|
|
|
data: any[] |
|
|
|
@ -30,16 +31,16 @@ const Adware: FC<Props> = ({data, only_flag, width}) => { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<View> |
|
|
|
|
<View className={styles.adware}> |
|
|
|
|
{ |
|
|
|
|
adverts.length === 1 && <Image |
|
|
|
|
adverts.length === 1 && <Img |
|
|
|
|
src={adverts[0].image_url} |
|
|
|
|
mode='scaleToFill' |
|
|
|
|
lazyLoad |
|
|
|
|
fadeIn |
|
|
|
|
style={{width: width + "rpx", height: (space.height / space.width) * width + "rpx"}} |
|
|
|
|
onClick={() => jumpAdware(adverts[0].image_path)} |
|
|
|
|
className={styles.adware}/> |
|
|
|
|
width={width} |
|
|
|
|
height={(space.height / space.width) * width}/> |
|
|
|
|
} |
|
|
|
|
{ |
|
|
|
|
adverts.length > 1 && <Swiper |
|
|
|
@ -47,15 +48,15 @@ const Adware: FC<Props> = ({data, only_flag, width}) => { |
|
|
|
|
autoplay |
|
|
|
|
circular |
|
|
|
|
style={{width: width + "rpx", height: (space.height / space.width) * width + "rpx", overflow: 'hidden'}} |
|
|
|
|
indicatorActiveColor='rgba(255,255,255,0.5)' |
|
|
|
|
className={styles.adware}> |
|
|
|
|
indicatorActiveColor='rgba(255,255,255,0.5)'> |
|
|
|
|
{adverts.map(d => <SwiperItem key={d.id}> |
|
|
|
|
<Image |
|
|
|
|
<Img |
|
|
|
|
src={d.image_url} |
|
|
|
|
lazyLoad |
|
|
|
|
fadeIn |
|
|
|
|
onClick={() => jumpAdware(d.image_path)} |
|
|
|
|
style={{width: width + "rpx", height: '100%'}}/> |
|
|
|
|
width={width} |
|
|
|
|
height={(space.height / space.width) * width} |
|
|
|
|
onClick={() => jumpAdware(d.image_path)}/> |
|
|
|
|
</SwiperItem>)} |
|
|
|
|
</Swiper> |
|
|
|
|
} |
|
|
|
|