<template>
	<div class="apply_box">
		<div class="list_box">
			<div class="list_item" v-for="(item,index) in lkeiLIst" :key="index">
				<img :src="item.facePic" alt="" class="icon">
				<div class="list_rig" >
					<div class="list_r_name">
						<span>{{item.name}}</span>
						<!-- <img src="''" alt="" class="img_na"> -->
						<img :src=" item.sex == 0? '/static/icon_bdxs_ns.png' : item.sex == 1? '/static/icon_bdxs_nss.png' : ''  " alt="" class="img_nv">
					</div>
					<div class="list_class">
						<span>{{item.schoolName}}</span>
						<span>{{item.gradeName}}</span>
						<span>{{item.className}}</span>
					</div>
				</div>
			</div>
		</div>
		<div class="fot_box">
			<div class="fot_btn" @click="tj_btn" v-if="!shou ">添加绑定</div>
			<p>* 一个账号最多可绑定三名学生</p>
		</div>
	</div>
</template>

<script>

	export default{
		data() {
			return {
				phone:'',
				shou:false,
				lkeiLIst:[]
			}
		},
		components: {
		},
		computed:{
		},
		onShow(){
			this.bingeList()
			 
		},
		onHide() {
			
			 
		},
		onLoad(e) {
		  	// let phone = 
			let token = uni.getStorageSync('phone')
			this.phone = uni.getStorageSync('phone')
			if(!token){
				uni.redirectTo({
					url: '/pages/load/roles'
				})
				return  false
			}
			
		},
		methods:{
			bingeList(){
				const _this = this
				this.$http.get("applet/getChildren/" + this.phone).then(res => {
					console.log(res)
					if(res.code == 200){
						console.log(res.data.length)
						if(res.data.length == 0){
							uni.redirectTo({
								url: '/pages/parents/bind_student'
							})
							return  false
						}else if(res.data.length == 3 || res.data.length > 3){
						  	this.shou = true
							console.log(45)
						}else if(res.data.length < 3){
							this.shou = false
						}
						console.log(this.shou)
						this.lkeiLIst =  res.data
						console.log(this.lkeiLIst)
						// this.studenList = res.data
						// _this.children_name = this.studenList.name
						// // _this.telephone = this.studenList.phone
						// // _this.DocumentType = this.studenList.cardType
						// _this.Identification = this.studenList.cardId
						// _this.children_img = this.studenList.facePic
						// _this.scollid = this.studenList.deptId
						// _this.gender_index = this.studenList.sex
						// _this.schoolUserId = this.studenList.schoolUserId
						// _this.schoolId = this.studenList.schoolId
						// if(this.studenList.className == null){
							// this.select = this.studenList.deptId
							// this.case_index = 1
							// this.ieiuer = this.studenList.deptId
						// }else {
						// 	this.select = this.studenList.gradeName + this.studenList.className 
						// 	this.scollid = this.studenList.classInfoId
							
						// }
						
					}else {
						uni.showToast({
							title: res.msg,
							duration: 1000,
							icon: 'none'
						});
					}
					console.log(this.studenList)
				})
			},
			
			tj_btn(){
				uni.navigateTo({
					url: '/pages/parents/bind_student'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.apply_box{
		.list_box{
			.list_item{
				padding: 42upx 38upx;
				width: calc(100vw - 76upx);
				margin: 0 auto;
				box-sizing: border-box;
				border-bottom: 1upx solid #E5E5E5;
				display: flex;
				.icon{
					width: 125upx;
					height: 125upx;
					border-radius: 50%;
					margin-right: 42upx;
				}
				.list_rig{
					flex: 1;
					display: flex;
					flex-direction: column;
					justify-content: center;
					.list_r_name{
						display: flex;
						color: #333333;
						font-size: 32upx;
						margin-bottom: 30upx;
						align-items: center;
						span{
							margin-right: 13upx;
							font-weight: bold;
						}
						img{
							width: 28upx;
							height: 28upx;
						}
					}
					.list_class{
						font-size: 26upx;
						display: flex;
						color: #222222;
						span{
							margin-right: 21upx;
						}
					}
				}
			}
		}
	}
	.fot_box{
		margin-top: 256upx;
		// border-top: 1upx solid #F4F4F4;
		padding: 20upx 38upx 0;
		margin-bottom: 96upx;
		p{
			color: #AAAAAA;
			font-size: 22upx;
			text-align: center;
			padding: 17upx 0;
		}
		.fot_btn{
			height: 96upx;
			border-radius: 14upx;
			background: #1678FF;
			text-align: center;
			line-height: 96upx;
			color: #fff;
			font-size: 36upx;
		}
	}
</style>
