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