<template>
	<view class="page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
		<cus-header title='视频监控'></cus-header>
		<div class="nums">
			<div class="pre">摄像机：<span class="mr">{{8}}</span></div>
			<div class="pre">正常：<span class="zc">{{20}}</span></div>
			<div class="pre">离线：<span class="lx">{{1}}</span></div>
		</div>
		<div class="boxs" v-if="list.length">
			<div class="box" v-for="(item,index) in list" :key="index" @tap="toDetail(item)">
				<div class="image">
					<div class="online" :style="{'background-image':'url('+imgBase+'home/video_example.png)'}" v-if="item.status==1">
						<image :src="imgBase+'home/video_play.png'"></image>
					</div>
					<div class="unline" v-else-if="item.status==2">
						<image :src="imgBase+'home/video_unline.png'"></image>
						<text>设备离线</text>
					</div>
				</div>
				<div class="info">
					<div class="text">{{item.title}}</div>
					<div class="tip">设备序列号：{{item.no}}</div>
				</div>
			</div>
		</div>
		<template v-else>
			<page-empty :height="'calc(100vh - 200px)'"></page-empty>
		</template>
	</view>
</template>

<script>
	import pageEmpty from '@/components/pageEmpty/index.vue'
	export default {
		components:{
			pageEmpty
		},
		data(){
			return {
				list:[
					{
						title:'研发大厅',
						no:'E49771728',
						status:1
					},
					{
						title:'前台',
						no:'E49771728',
						status:2
					},
					{
						title:'室外大门',
						no:'E49771728',
						status:1
					},
					{
						title:'研发大厅',
						no:'E49771728',
						status:1
					},
					{
						title:'研发大厅',
						no:'E49771728',
						status:1
					},
					{
						title:'室外仓库',
						no:'E49771728',
						status:1
					}
				]
			}
		},
		methods:{
			toDetail(item){
				uni.navigateTo({
					url:'/pagesHome/video/detail'
				})
			}
		}
	}
</script>

<style scoped lang="less">
	.page{
		width: 100%;
		padding: 0 24rpx 20rpx;
		box-sizing: border-box;
		background: #F4F8FB;
		
		.nums{
			width: 100%;
			background: #FFFFFF;
			border-radius: 16rpx;
			padding: 37rpx 24rpx;
			box-sizing: border-box;
			display: flex;
			margin-top: 20rpx;
			.pre{
				width: calc(100% / 3);
				font-family: PingFangSC, PingFang SC;
				font-weight: 400;
				font-size: 30rpx;
				color: #4E5969;
				line-height: 36rpx;
				text-align: left;
				span{
					font-family: PingFang-SC, PingFang-SC;
					font-weight: bold;
					font-size: 32rpx;
					line-height: 36rpx;
					text-align: left;
					&.mr{
						color: #1D2129;
					}
					&.zc{
						color: #14CC8C;
					}
					&.lx{
						color: #F95050;
					}
				}
			}
		}
		
		.boxs{
			width: 100%;
			display: flex;
			flex-wrap: wrap;
			justify-content: space-between;
			.box{
				width: calc(50% - 11rpx);
				margin-top: 20rpx;
				.image{
					width: 100%;
					height: 230rpx;
					border-radius: 16rpx 16rpx 0rpx 0rpx;
					&>div{
						width: 100%;
						height: 100%;
						display: flex;
						align-items: center;
						justify-content: center;
						border-radius: 16rpx 16rpx 0rpx 0rpx;
					}
					.online{
						background-size: 100% 100%;
						background-repeat: no-repeat;
						image{
							width: 64rpx;
							height: 64rpx;
						}
					}
					.unline{
						display: flex;
						flex-direction: column;
						background: #657588;
						image{
							width: 48rpx;
							height: 48rpx;
						}
						text{
							font-family: PingFangSC, PingFang SC;
							font-weight: 400;
							font-size: 24rpx;
							color: #FFFFFF;
							line-height: 36rpx;
							margin-top: 20rpx;
						}
					}
				}
				.info{
					width: 100%;
					padding: 24rpx 20rpx;
					box-sizing: border-box;
					background: #FFFFFF;
					.text{
						font-family: PingFang-SC, PingFang-SC;
						font-weight: bold;
						font-size: 30rpx;
						color: #1D2129;
						line-height: 30rpx;
						text-align: left;
						overflow: hidden;
						text-overflow: ellipsis;
						white-space: nowrap;
					}
					.tip{
						font-family: PingFangSC, PingFang SC;
						font-weight: 400;
						font-size: 24rpx;
						color: #999999;
						line-height: 24rpx;
						text-align: left;
						margin-top: 20rpx;
					}
				}
			}
		}
	}
</style>