<template>
	<view>
		<view class="title">
			<image src="@/static/image/home.png" mode="aspectFill"
				style="width: 38rpx;height: 38rpx;margin-right: 8rpx;">
			</image>
			寝室{{info.name}}
		</view>
		<view class="listTitlte" v-if="list.filter(e=>e.tick).length">
			已归寝
		</view>
		<view class="list">
			<view v-for="(item, index) in list" :key="index" class="item" v-show="item.tick">
				<view class="topBox">
					<image :src="item.faceUrl" mode="aspectFill" style="width: 160rpx;height: 160rpx;border-radius:10rpx">
					</image>
					<view class="des">
						<view class="top">
							<view class="status">
								已归寝
							</view>
							<view class="name">
								{{item.name}}
							</view>
						</view>
						<view class="depart">
							系部：{{item.majorName}}
						</view>
						<view class="bottom">
							<view class="major">专业：{{item.depName}}</view>
							<view class="class">班级：{{item.personSetName}}</view>
						</view>
					</view>
				</view>
				<view class="returnTime">
					归寝时间：{{item.tick?item.tick:'-'}}
				</view>
			</view>
		</view>
		<view class="listTitlte" v-if="list.filter(e=>!e.tick).length">
			未归寝
		</view>
		<view class="list">
			<view v-for="(item, index) in list" :key="index" class="item" v-show="!item.tick">
				<view class="topBox">
					<image :src="item.faceUrl" mode="aspectFill" style="width: 160rpx;height: 160rpx;border-radius:10rpx">
					</image>
					<view class="des">
						<view class="top">
							<view class="status error">
								未归寝
							</view>
							<view class="name">
								{{item.name}}
							</view>
						</view>
						<view class="depart">
							系部：{{item.majorName}}
						</view>
						<view class="bottom">
							<view class="major">专业：{{item.depName}}</view>
							<view class="class">班级：{{item.personSetName}}</view>
						</view>
					</view>
				</view>
				<view class="returnTime">
					归寝时间：{{item.tick?item.tick:'-'}}
				</view>
			</view>
		</view>
	</view>
	</view>
</template>

<script>
	import {
		returnInfo
	} from '@/api/work/returnBed.js'
	export default {
		data() {
			return {
				list: [],
				info:{},
				checkboxValue: [],
			}
		},
		mounted() {
			const {id,ReturnTime} = this.options
			this.LOADING('加载中...')
			returnInfo({id,ReturnTime}).then(res=>{
				this.HIDE_LOADING()
				if(res.code != 200)return
				this.info = res.data
				this.list = res.data.personInfos || []
				this.list.forEach(e=>{
					e.faceUrl = e.faces&&e.faces.length?'/api/'+e.faces[0].faceUrl:''
					if(res.data.attendanceDtos){
						let obj = res.data.attendanceDtos.find(e1=>e1.personId==e.personId)
						if(obj)e.tick = obj.tick
					}
				})
			})
		},
		methods: {}
	}
</script>

<style scoped lang="scss">
	.title {
		display: flex;
		color: #333333;
		padding: 26rpx;
		background: #fff;
		border-top: 1rpx solid rgba(0, 0, 0, 0.03);
		font-size: 30rpx;
	}

	.listTitlte {
		color: #777777;
		font-size: 28rpx;
		padding: 18rpx 30rpx;
		font-weight: 700;
	}

	.list {
		padding: 0 26rpx;
		margin-bottom: 16rpx;

		&:last-child {
			padding-bottom: 60rpx;
		}

		.item {
			margin-bottom: 28rpx;
			background-color: #fff;
			padding: 30rpx;

			&:last-child {
				margin-bottom: 0;
			}

			.topBox {
				flex: 1;
				border-radius: 18rpx;
				display: flex;

				.des {
					flex: 1;
					padding-left: 24rpx;
					font-size: 26rpx;
					color: #333;

					.top {
						color: #333;
						font-size: 32rpx;
						display: flex;

						.status {
							display: inline-block;
							font-size: 24rpx;
							line-height: 1.8;
							background-color: #0FAF76;
							color: #fff;
							padding: 0 12rpx;
							border-radius: 8rpx;
							margin-right: 12rpx;
						}

						.status.error {
							background-color: #EF2D2D;
						}
						.name{
							font-weight: 700;
						}
					}

					.depart {
						margin-top: 28rpx;
						font-size: 26rpx;
					}

					.bottom {
						font-size: 26rpx;
						margin-top: 18rpx;
						display: flex;
						justify-content: space-between;

						.major {}

						.class {}
					}
				}
			}
		}

		.returnTime {
			margin-top: 30rpx;
			border-top: 1rpx solid rgba(0, 0, 0, 0.1);
			font-size: 26rpx;
			padding-top: 26rpx;
		}
	}
</style>