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

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

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

  return (
    <>
      <Swiper defaultValue={0} height={item?.height} indicator style={{ height: item?.height + 'px', display: 'none' }}>
        {item?.imageList?.map((item) => (
          <Swiper.Item key={item}>
            <Image width="100%" height="100%" src={item.url} mode={'scaleToFill'} lazyLoad={false} style={{ height: item.height + 'px' }} />
          </Swiper.Item>
        ))}
      </Swiper>
    </>
  )
}
export default MyPage
