<template>
	<app-layout>
		<view class="container">
				<template v-if="lists.length > 0">
					<view class="cell-box main-left"  v-for="(item,index) in lists":key="index">
						<view class="head-img">
							<u-image
									width="140"
									height="140"
									:src="item.head_img"
									shape="circle"></u-image>
						</view>
						<view class="nickname dir-top-wrap main-center">
							<view class="title main-left cross-center">
								<text>{{item.nickname}}</text>
								<u-image
										width="35"
										height="35"
										src="@/static/images/vip.png"
										v-if="item.is_vip"
								></u-image>
							</view>
							<view class="sub-title">
								绑定时间：{{item.become_child_at}}
							</view>
						</view>
					</view>
					<u-line></u-line>
				</template>
			<view class="no-data main-center cross-center" v-else>
				<text>暂无数据</text>
			</view>
		</view>
	</app-layout>
</template>

<script>
	import appLayout from "@/components/app-layout"
	export default {
		components:{
			appLayout,
		},
		data() {
			return {
				lists: [],
				currentPage: 1,
				totalPage: 0
			}
		},
		methods: {
			getList(page){
				this.$u.api.userShares(page).then(res => {
					this.currentPage = res.current_page
					this.totalPage = res.last_page
					this.lists = this.lists.concat(res.data);
				})
			}
		},
		onLoad(){
			this.getList();
		},
		onReachBottom(){
			if(this.currentPage < this.totalPage){
				this.getList(this.currentPage+1)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.cell-box{
		padding: 30rpx 0;
		.head-img{}
		.nickname{
			flex: 1;
			padding: 0 30rpx;
			color: #333333;
			font-size: 32rpx;
			font-weight: 500;
			.title{
				text{
					margin-right: 12rpx;
				}
			}
			.sub-title{
				color: #666666;
				font-size: 28rpx;
				line-height: 2em;
			}
		}
	}
</style>
