import React, { useState } from 'react'
import ActivityListItem from '@/components/ActivityListItem/index'
import ScrollPageRefresh from '@/components/ScrollPageRefresh/index'
import '@/assets/css/reset.less'
import '@/assets/css/iconfont.less'
import './index.less'

export default function ShouYeHuoDong () {

  const [PageList, setPageList] = useState([])

  const Refresh = (e) => { // 下拉刷新
    setPageList(e)
  }

  const Push = (e) => { // 上拉加载
    setPageList(PageList.concat(e))
  }

  return (
    <view className='ShouYeHuoDong'>
      <ScrollPageRefresh ApiName={`getActivityList`} ListName={`list`} Refresh={Refresh} Push={Push}>
        <view className='ShouYeHuoDongContent'>
          {
            PageList.map((item, index) => (
              <view className='ListItem' key={`ActivityItem-${index}`}>
                <ActivityListItem Data={item}></ActivityListItem>
              </view>
            ))
          }
        </view>
      </ScrollPageRefresh>
    </view >
  )
}
