<template>
	<view class="highway_home">
		<view style="text-align: center;">
			<image v-if="routersData.name" :src="'../../static/image/' + routersData.name + '01.png'" class="highway_logo"></image>
			<view class="home_title">{{routersData.meta.title}}</view>
		</view>
		<view class="act_wrap" v-for="(item,index) in routersData.children" :key="index">
			<view class="act_box" @click="changeShowStatus(index)">
				<image v-if="index == 0" src="../../static/image/icon_rundata.png" class="act_logo"></image>
				<image v-else src="../../static/image/icon_runstatus.png" class="act_logo"></image>
				<text class="act_txt">{{item.meta.title}}</text>
			</view>
			<!-- 子路由 -->
			<view v-show="index === showIndex">
				<view @click="goPage('/pages'+ routersData.path + '/' + item.name+'/form?type=add')" class="act_sub_box" style="margin-bottom: 30rpx;">
					报送
				</view>
				<view @click="goPage('/pages'+ routersData.path + '/' + item.name+'/list')" class="act_sub_box">
					报送记录
				</view>
			</view>
		</view>
		<!-- 底部备注 -->
		<view class="foot_intro">
			<view>如有填报问题，请咨询公共服务中心</view>
			<view>中心值班电话：<text class="tel">66007587</text></view>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				routersData: [],
				showIndex: 0
			}
		},
		onLoad(options) {
			if(this.routersData.length == 0 && options.routers) {
				this.routersData = JSON.parse(options.routers);
				this.routersData.children.map((item,index) => {
					item.show = index == 0 ? true : false;
				})
				console.log(this.routersData)
			}
		},
		methods: {
			//切换展示
			changeShowStatus(index) {
				this.showIndex = index;
				console.log('changeShow', index)
			},
			goPage(url) {
				console.log('gopage', url)
				uni.navigateTo({
					url: url
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.highway_home {
		position: relative;
		height: calc(100vh - 50rpx);
		padding: 0 50rpx 50rpx;
		background-color: #fff;
		overflow: auto;

		.highway_logo {
			width: 128rpx;
			height: 128rpx;
			margin: 78rpx auto 0;
		}

		.home_title {
			color: #333;
			line-height: 40rpx;
			font-size: 28rpx;
			font-family: PingFang SC-Bold, PingFang SC;
			font-weight: bold;
			text-align: center;
			margin-bottom: 75rpx;
		}

		.act_wrap{
			margin-bottom: 40rpx;
			.act_box {
				display: flex;
				align-items: center;
				justify-content: center;
				height: 100rpx;
				background: #EFF7FF;
				border-radius: 20rpx;
				margin-bottom: 30rpx;

				.act_logo {
					width: 44rpx;
					height: 44rpx;
				}

				.act_txt {
					font-size: 28rpx;
					font-family: PingFang SC-Regular, PingFang SC;
					font-weight: 400;
					color: #2D8CF0;
				}
			}
			.act_sub_box{
				color: #333333;
				font-size: 28rpx;
				font-family: PingFang SC-Regular, PingFang SC;
				font-weight: 400;
				line-height: 100rpx;
				text-align: center;
				border: 1rpx solid #C1C1C1;
				border-radius: 20rpx;
			}
		}
		.foot_intro{
			position: fixed;
			left: 0;
			right: 0;
			bottom: 44rpx;
			color: #666;
			font-size: 26rpx;
			font-family: PingFang SC-Bold, PingFang SC;
			line-height: 48rpx;
			text-align: center;
			.tel{
				color: #2D8CF0;
				font-weight: bold;
			}
		}
	}
</style>