<template>
	<view class="pageBgImg">
		<topNavbar title="信息资讯"></topNavbar>
		<view class="ul">
			<view class="card" v-for="(item,index) in infoList" :key="index">
				<newItem :item="item"></newItem>
			</view>
		</view>
		<view style="padding-bottom: 20rpx;" v-if="infoList.length">
			<u-loadmore :status="status" />
		</view>
		<nodata v-if="!infoList.length"></nodata>
	</view>
</template>

<script>
	import newItem from '../comp/newItem'
	import { getExamSiteInfo } from '@/config/api.js'
	export default {
		components: { newItem },
		data() {
			return {
				infoList: [],
				params: {id: '',pageNo: 1,pageSize: 20, },
				status: 'loading'
			}
		},
		onLoad(options) {
			this.params.id = options.id
			this.getExamSiteInfoFn()
		},
		methods: {
			async getExamSiteInfoFn() {
				const {data: res} = await getExamSiteInfo(this.params)
				this.params.pageNo ++
				this.infoList.push(...res.list)
				this.total = res.total
				if(this.infoList.length>=this.total) this.status = 'nomore'
			}
		}
	}
</script>

<style lang="scss" scoped>
	.ul {
		padding: 28rpx;
	}
	.card {
		margin-bottom: 20rpx;
	}
</style>