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

export default function ShouYeZiXun () {

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

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

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

  return (
    <view className='ShouYeZiXun'>
      <ScrollPageRefresh ApiName={`getNewsList`} Refresh={Refresh} Push={Push}>
        <view className='ShouYeHuoDongContent'>
          {
            PageList.map((item, index) => (
              <view className='ListItem' key={`ActivityItem-${index}`}>
                <NewsListItem Data={item} ShowTips={index === 0}></NewsListItem>
              </view>
            ))
          }
        </view>
      </ScrollPageRefresh>
    </view >
  )
}
