<template>
	<view>
		<view class="line"></view>
		
		<view class="block_box" v-for="(box,index) in blocksList" :key="index">
			<view class="block_title">
				<view class="icon"></view>
				<view class="name">{{box.title}}</view>
			</view>
			<view class="block_inner">
				<view class="inner_list">
					<view class="item" v-for="item in box.children">
						<view class="item_border" @click="go_block_detail(item.link)">
							<view class="name">
								<text>{{item.title}}</text>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props:[
			"blocksList"
		],
		data() {
			return {
				
			};
		},
		methods:{
			go_block_detail(href){
				console.log(href)
				uni.navigateTo({
					url:"../../i-block-detail/i-block-detail",
					success: function(res) {
						// 通过eventChannel向被打开页面传送数据
						res.eventChannel.emit('acceptDataFromOpenerPage', { href: href })
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.line{
		width: 100%;
		height: 6rpx;
		background-color: #F0F0F0;
	}
	.block_box{
		box-sizing: border-box;
		padding-top: 34rpx;
		padding-left: 42rpx;
		padding-right: 68rpx;
		padding-bottom: 20rpx;
		
		border-bottom: 1rpx solid #eee;
		.block_title{
			display: flex;
			.icon{
				margin-right: 16rpx;
				width: 52rpx;
				height: 52rpx;
				background-image: url(icon/icon_title.png);
				background-size: cover;
				background-repeat: no-repeat;
			}
			.name{
				height: 52rpx;
				font-size: 37rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #121212;
				line-height: 52rpx;
				text-shadow: 0px 2rpx 6rpx rgba(0, 0, 0, 0.5);

			}
		}
		.block_inner{
			margin-top: 25rpx;
			.inner_list{
				display: flex;
				flex-wrap: wrap;
				// justify-content: space-between;
				.item{
					margin-bottom: 16rpx;
					margin-right: 17rpx;
					width: 144rpx;
					height: 82rpx;
					border-radius: 26rpx;
					border: 2rpx solid #4AA0D5;

					.item_border{
						width: 138rpx;
						height: 78rpx;
						background: #FFFFFF;
						border-radius: 20rpx;
						// border: 2rpx solid #D5D5DB;

						.name{
							text-align: center;
							height: 82rpx;
							font-size: 20rpx;
							font-family: PingFangSC-Regular, PingFang SC;
							font-weight: 400;
							color: #009FE8;
							line-height: 82rpx;

						}
					}
				}
				.item:nth-child(4n){
					margin-right: 0;
				}
			}
		}
	}
</style>
