<template>
	<view class="content">
		<page-header :name="'自动化监控系统'" :bg="'#009fe8'" :showLeft="false"></page-header>
		<view class="scroll-wrap">
			<image class="img-wrap" src="@/static/index.jpg" />
			<view class="classify-wrap">
				<view class="left">
					<view @click="tabChange(index)"
						:class="active === index ? 'item-wrap active' : 'item-wrap deactive'"
						v-for="(item, index) in list" :key="index">
						{{ item.name }}
					</view>
				</view>
				<view class="right">
					<view @click="goPage(item)" v-for="(item, index) in list[active].children" class="item-wrap">
						<image src="@/static/gxsx.png" />
						<view class="title">
							{{ item.name }}
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				active: 0, // 当前激活的tab
				list: [{ // 列表数据
					name: '智能监测',
					children: [{
						name: '人员定位',
						path: `/pages/data/znjc/page`,
						src: 'http://anstatic.nxmy.com:8011/assets/html/zhks-quankuang/ningmeijituan/h5/#/pages/production/personnel_orientation/personnel_orientation?mine=640181B0011010026856'
					}, {
						name: '安全监测',
						path: `/pages/data/znjc/page`,
						src: 'http://anstatic.nxmy.com:8011/assets/html/zhks-quankuang/ningmeijituan/h5/#/pages/production/safety_monitoring/safety_monitoring?mine=640181B0011010026856'
					}, {
						name: '工业视频',
						path: `/pages/data/znjc/page`,
						src: 'http://anstatic.nxmy.com:8011/assets/html/zhks-quankuang/ningmeijituan/video_ws/video_XXX/?mine_code=qingshuiying_jituan#/'
					}]
				}, {
					name: '排水系统',
					children: [{
						name: '+786m水泵房',
						path: `/pages/data/supply-water/supply-room/supply-room`,
						params: `786`
					}, {
						name: '+1065m水泵房',
						path: `/pages/data/supply-water/supply-room/room1065`,
						params: `1065`
					}]
				}, {
					name: '提升系统',
					children: [{
						name: '副立井提升',
						path: '/pages/data/ts-system/flj'
					}, {
						name: '副斜井绞车',
						path: '/pages/data/ts-system/fxj_jc'
					}, {
						name: '副斜井轨道运输',
						path: '/pages/data/ts-system/fxj_gd'
					}]
				}, {
					name: '采掘系统',
					children: [{
						name: '矿井矿压',
						path: '/pages/data/cj-system/kjky'
					}, {
						name: '矿井视频智能调速',
						path: '/pages/data/cj-system/kjsp'
					}, {
						name: '智能掘进工作面',
						path: '/pages/data/cj-system/gzm'
					}]
				}, {
					name: '通风系统',
					children: [{
						name: '主通风机监控系统',
						path: '/pages/data/ventilation/air-system/air-system'
					}, {
						name: '制氮监控系统',
						path: '/pages/data/nitrogen/compress-system/compress-system'
					}, {
						name: '压风监控系统',
						path: '/pages/data/nitrogen/nitrogen-system/nitrogen-system'
					}, {
						name: '副立井压风监控系统',
						path: '/pages/data/nitrogen/flj_yf'
					}]
				}, {
					name: '运输系统',
					children: [{
							name: '架空人车监控系统',
							path: '/pages/data/transport/passenger/passenger'
						},
						{
							name: '甲带给料机监控',
							path: '/pages/data/transport/jdgl'
						}, {
							name: '主运输06机巷皮带',
							path: '/pages/data/transport/belt/belt'
						}, {
							name: '主运输07风巷皮带',
							path: '/pages/data/transport/belt/belt07'
						}, {
							name: '井下皮带监控',
							path: '/pages/data/transport/belt/jxpdjk'
						}, {
							name: '二煤上山皮带监控',
							path: '/pages/data/transport/belt/emss'
						}
					]
				}, {
					name: '供水系统',
					children: [{
						name: '生活水供水监控',
						path: '/pages/data/gs-system/shs'
					}, {
						name: '消防供水监控',
						path: '/pages/data/gs-system/xfs'
					}, {
						name: '生产水供水监控',
						path: '/pages/data/gs-system/scs'
					}]
				}, {
					name: '热力系统',
					children: [{
						name: '燃气锅炉房监控',
						path: '/pages/data/rl-system/rqgl'
					}, {
						name: '新锅炉房监控',
						path: '/pages/data/rl-system/xgl'
					}, {
						name: '换热站监控',
						path: '/pages/data/rl-system/hrz'
					}]
				}, {
					name: '供电系统',
					children: [{
						name: '井下高压监控',
						path: '/pages/data/electron/line-picture/line-picture'
					}, {
						name: '井下低压监控',
						path: '/pages/data/electron/line-picture/line-picture'
					}, {
						name: '地面10KV监控',
						path: '/pages/data/electron/line-picture/line-picture'
					}, {
						name: '地面低压监控',
						path: '/pages/data/electron/line-picture/line-picture'
					}]
				}]
			}
		},
		onLoad() {
		},
		methods: {
			tabChange(index) {
				this.active = index
			},
			goPage(item) {
				uni.navigateTo({
					url: item.path + `?data=${JSON.stringify(item)}`
				})
			},
		}
	}
</script>

<style scoped lang="scss">
	.content {
		height: 100vh;
		background-color: #fff;

		.scroll-wrap {
			height: calc(100vh - 85rpx);
			overflow-y: scroll;

			.img-wrap {
				width: 100%;
				height: 500rpx;
				margin-bottom: 10rpx;
				vertical-align: bottom; // 解决image背景图片下方有10rpx 的白边
			}

			.classify-wrap {
				display: flex;
				flex-direction: row;
				background-color: #f4f5f9;
				padding-bottom: 100rpx;

				.left {
					border-radius: 0 20rpx 20rpx 0;
					overflow: hidden;
					width: 30vw;
					margin-right: 10rpx;

					.item-wrap {
						text-align: center;
						padding: 30rpx 20rpx;
					}

					.active {
						font-weight: 700;
					}

					.deactive {
						color: #c0c0c0;
						background-color: #fff;
					}
				}

				.right {
					padding-top: 40rpx;
					display: flex;
					align-content: flex-start;
					flex-direction: row;
					flex-wrap: wrap;
					overflow: hidden;
					border-radius: 20rpx 0 0 20rpx;
					width: calc(70vw - 10rpx);
					background-color: #fff;

					.item-wrap {
						width: 50%;
						margin-bottom: 40rpx;
						display: flex;
						justify-content: start;
						align-items: center;
						flex-direction: column;

						image {
							width: 90rpx;
							height: 90rpx;
							margin-bottom: 20rpx;
						}

						.title {
							font-weight: 700;
							text-align: center;
						}
					}

					.item-wrap:nth-child(2n) {
						.title {
							padding: 0 10px 0 5px;
						}
					}

					.item-wrap:nth-child(2n-1) {
						.title {
							padding: 0 5px 0 10px;
						}
					}
				}
			}
		}
	}
</style>