import { Swiper, SwiperItem,View} from '@tarojs/components';
import { getTipList} from '@/services/home'
import { useState,useEffect } from 'react';
import icontip from '@/assets/icons/housemantj/tip.png'
import './index.less'

export default ()=>{  
  const [tips,setTips]=useState([])
  useEffect(() => {
    getTipList(1).then((res)=>{
      setTips(res.records||[])
    })
  },[])
    return (      
      <view className='tip'>
        <image className='tipicon' src={icontip} />
      <Swiper
      className='swp'
        vertical
        circular        
        interval="3000"        
        autoplay>
          {
            tips==''?<SwiperItem>Tip:暂无公告  欢迎使用十公里小程序</SwiperItem>:
            tips.map((item)=>
              <SwiperItem>
                <View>Tip:{item.content}</View>
              </SwiperItem>
            )
          }        
      </Swiper>
      </view>
    )  
}