<template>
	<view class="dy">
		<statusBar :item="navBarData"></statusBar>
		
		<view class="bigBox" v-for=" i in applyUserlist">
			<view class="imgblk">
				<image class="img" :src="i.avatar" mode="aspectFill"></image>
			</view>
			<view class="info">
				<view class="uname">
					<view class="nameTxt">
						{{i.username}}
					</view>
					<view class="sch">{{i.create_at}}</view>
				</view>
				<view class="sch1">深圳城市××大学</view>
			</view>
		</view>
		
		<view class="loading">
			<view v-if="newsLoading==1">数据加载中...</view>
			<view v-if="newsLoading==2">没有更多了~~</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			navBarData: {
				title: '新增订阅',
				btn: 1
			},
			// 报名列表
			applyUserlist:[],
						
			// 活动id	
			acId:'',
			// 触底加载动画提示
			newsLoading: 0, //0默认值  1加载中 2没有更多了
			currentPage: 1,
			// items:[   //1回粉 2关注 3相互关注
			// 	{tit:'hf',btn:1},
			// 	{tit:'hf2',btn:1},
			// 	{tit:'gz',btn:2},
			// 	{tit:'hx',btn:3},
			// ]
		};
	},
	methods:{
		// 获取报名用户
		getUsers(){
			let data = {
				oid: this.$store.state.user.openid, //用户id
				aid:this.acId,
				type: 2,
				page: this.currentPage, //下拉获取更多的备用字段
				lim: 20 //一次获取多少数据
			}
			this.$request('/selectApplyUser', 'POST', data).then(res => {
				console.log('获取报名用户列表', res[0]);
				if (!res[0].length) {
					this.newsLoading = 2
				} else {
					this.newsLoading = 0
				}
				this.applyUserlist=[...this.applyUserlist,...res[0]]
			})
		}
	
	},
	// 触底加载更多
	onReachBottom() {
		if (this.newsLoading == 2) {
			return
		}
		this.newsLoading = 1
		this.currentPage++
		setTimeout(this.getUsers(),1500)
		
	},
	onLoad(e) {
		console.log('接受参数',e);
		this.acId=e.acId
		this.getUsers()
	}
};
</script>

<style lang="scss" scoped>
	.dy{
		
	}
	.bigBox{
		background-color: white;
		width: 750rpx;
		height: 136rpx;
		padding: 0rpx 30rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		.imgblk{
			height: 80rpx;
			display: flex;
			justify-content: center;
			align-items: center;
			// background-color: #888;
			.img{
				width: 72rpx;
				height: 72rpx;
				border-radius: 50%;
			}
		}
		
		.info{
			flex: 1;
			display: flex;
			flex-direction: column;
			height: 80rpx;
			justify-content: space-between;
			margin-left: 20rpx;
			// background-color: rebeccapurple;
			.uname{
				display: flex;
				justify-content: space-between;
				.nameTxt{
					font-size: 28rpx;
					color: rgba(0, 0, 0, 0.8);
					// line-height: 50%;
				}
				.sch{
					font-size: 24rpx;
					color: rgba(0, 0, 0, 0.6);
				}
			}
			.sch1{
				// flex: 1;
				font-size: 24rpx;
				color: rgba(0, 0, 0, 0.6);
			}
		}
		
		
	}
	.loading{
		height: 50rpx;
		text-align: center;
		padding-top: 20rpx;
		padding-bottom: 100rpx;
		font-size: 26rpx;
		color:#888;
		line-height: 2em;
	}

</style>