<template>
	<div>
		<!-- 主体内容 -->
		<div v-if="!showDetail" class="babyalbum-box">
			<div v-if="isNothing" class="babyalbum-item-box" @click="goDetail(index)" v-for="(item,index) in babyArr" :key="index">
				<img :src="item.Head_Img" alt="">
				<span>{{item.StuName}}的相册</span>
				<div :style="{background:'#9C7CFA'}">{{item.PhotoCount}}张图</div>
			</div>
			<div v-if="!isNothing" class="nothing-box">
				<img src="../../static/img/attendancedetail/icon-nothing.png">
				<div>暂无宝宝相册</div>
			</div>
		</div>
		<babyAlbumDetail v-if="showDetail" :babyalbumList="babyalbumList" @backBaby="backBaby"></babyAlbumDetail>
	</div>
</template>
<script>
	import babyAlbumDetail from '@/components/babyAlbumDetail.vue';
	export default {
		components:{
			babyAlbumDetail
		},
		name: 'babyActivity',
		data() {
			return {
				babyArr:[],
				isNothing:true,
				showDetail:false,
				babyalbumList:[]
			}
		},
		methods: {
			goDetail(e){
				this.babyobj = this.babyArr[e];
				this.showDetail = true;
				this.babyphotodetailsEv(this.babyobj.UserGuid);
			},
			backBaby(e){
				this.showDetail = e;
			},
			// 查询宝宝列表
			async babyphotoEv() {
				let data = await this.$axios({
					// 调用 serviceAPI
					url: this.$https.babyphoto,
					methods: "get",
					params: {
						EquipmentID: "yaohaotest001",
					},
				});
				this.babyArr = data.data.data;
				if(this.babyArr.length==0) {
					this.isNothing = false;
				}
			},
			// 查询宝宝详情
			async babyphotodetailsEv(userGuid) {
				let data = await this.$axios({
					// 调用 serviceAPI
					url: this.$https.babyphotodetails,
					methods: "get",
					params: {
						StuGuid:userGuid
					},
				});
				this.babyalbumList = data.data.data;
			},
		},
		mounted() {
			this.babyphotoEv();
		}
	}
</script>
