import { Image, Swiper, SwiperItem, View } from "@tarojs/components"
import { goLink } from "@/common/common"
import Taro from "@tarojs/taro"
import styles  from './index.module.scss'

type item = {title:string, img:string, url:string, id:number}

type params = {
  list?: item[]
  swiperOnClick?: (val: item) => void,
  style?: Object
}
export default (props:params) => {
    let {list = [], swiperOnClick, style = {}} = props
    list = [
        {
            title:'数据', 
            img:'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.jj20.com%2Fup%2Fallimg%2F811%2F021315104H2%2F150213104H2-3-1200.jpg&refer=http%3A%2F%2Fimg.jj20.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1651817947&t=5467a207f845ddfc7737d55934e6b26d', 
            url:'', 
            id:1
        }
    ]

    return (
        <View className={styles.swiper_con} style={style}>
            <Swiper
                className={styles.xswiper}
                indicatorColor='#ccc'
                indicatorActiveColor='#fff'
                circular
                indicatorDots
                autoplay>
                {
                list.map(item => {
                    return <SwiperItem key={item.id}>
                    <View className={styles.image_item} onClick={() => goLink(`/pages/classList/index?id=${item.id}`)}>
                        <Image mode="aspectFill" src={item.img}></Image>
                    </View>
                    </SwiperItem>
                })
                }
            </Swiper>
        </View>
    )
   
}