import { useEffect, useState } from 'react'
import { Swiper } from '@nutui/nutui-react-taro'
import {CmsAd} from "@/api/cms/cmsAd/model";
import {getCmsAd} from "@/api/cms/cmsAd";

const MyPage = () => {
  const [item, setItem] = useState<CmsAd>()
  const reload = () => {
    getCmsAd(366).then(data => {
      setItem(data)
    })
  }

  useEffect(() => {
    reload()
  }, [])

  return (
    <>
      <Swiper defaultValue={0} height={279} indicator style={{ height: '280px' }}>
        {item?.imageList?.map((item) => (
          <Swiper.Item key={item}>
            <img width="100%" height="100%" src={item.url} alt="" style={{ height: '280px' }} />
          </Swiper.Item>
        ))}
      </Swiper>
    </>
  )
}
export default MyPage
