<template>
	<view class="content">
		<view class="section_1" v-if="bottom[2].data.length > 0">
			<scroll-view scroll-x>
				<view class="tab_box">
					<view class="tab" v-for="(item,index) in bottom[2].data[0].children" :key="index">
						<view class="title" @click="change_active(index+1)" :class="active==index+1?'active':''">{{item.title}}</view>
					</view>
				</view>
			</scroll-view>
			<view v-for="(item,index) in bottom[2].data[0].children" :key="index">
				<view class="list" v-if="index+1 == active">
					<view class="item" v-for="(item_2,index_2) in item.children" :key="index_2" @click="go_record(item_2)">
						{{item_2.title}}
					</view>
				</view>
			</view>
			
		</view>

		<!-- 图片链接 -->
		<view class="section_2" v-if="bottom[3].data.length > 0">
			<view class="title">{{bottom[3].type_name}}</view>
			<view class="list">
				<view class="item" v-for="(item,index) in bottom[3].data[0].children" :key="index" @click="go_record(item)">
					<image :src="item.thumb" mode=""></image>
				</view>
			</view>
		</view>

		<!-- 快速通道 -->
		<view class="section_3" v-if="bottom[4].data.length > 0">
			<view class="title">{{bottom[4].type_name}}</view>
			<view class="list">
				<view class="item" v-for="(item,index) in bottom[4].data[0].children" :key="index" @click="go_record(item)">
					<image :src="item.thumb" mode="widthFix"></image>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		goToLink
	} from "@/common/common.js"

	export default {
		name: "t-i-bottom",
		props: [
			"bottom",
			"mine_code"
		],
		data() {
			return {
				active: 1,
			};
		},
		methods: {
			change_active(index) {
				console.log(index)
				this.active = index
			},
			go_record(item) {
				goToLink(item, this.mine_code)
			}
		}
	}
</script>

<style lang="scss">
	.content {
		margin-top: 10rpx;
		padding-bottom: 40rpx;
		background-color: #FFFFFF;
	}

	.section_1 {
		box-sizing: border-box;
		padding: 25rpx;
		.tab_box{
			display: flex;
			.tab {
				margin-right: 40rpx;
				text-align: center;
				
				.title {
					width: 160rpx;
					line-height: 80rpx;
					font-size: 36rpx;
				}
			
				.active {
					color: #009fe8;
					border-bottom: 4rpx solid #009fe8;
				}
			}
		}

		.list {
			margin-top: 30rpx;
			overflow: hidden;

			.item {
				float: left;
				margin-right: 20rpx;
				margin-bottom: 30rpx;

				width: 160rpx;
				box-sizing: border-box;
				border: 2rpx solid #009fe8;
				border-radius: 20rpx;
				font-size: 28rpx;
				line-height: 70rpx;
				//超过一行省略号
				overflow: hidden;
				white-space: nowrap;
				text-overflow: ellipsis;

				padding: 0 10rpx;
				background-color: #66C7F218;
				color: #009FE8;

				text-align: center;
			}

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

	}


	.section_2 {
		box-sizing: border-box;
		padding: 0 25rpx;

		.title {
			line-height: 120rpx;
			font-size: 36rpx;
		}

		.list {
			display: flex;
			flex-wrap: wrap;
			justify-content: space-between;

			.item {
				margin-bottom: 20rpx;
				width: 340rpx;
				height: 180rpx;

				border-radius: 20rpx;
				overflow: hidden;

				image {
					width: 340rpx;
					height: 180rpx;
				}
			}
		}
	}

	.section_3 {
		box-sizing: border-box;
		padding: 0 25rpx;

		.title {
			line-height: 120rpx;
			font-size: 36rpx;
		}

		.list {
			display: flex;
			flex-wrap: wrap;
			justify-content: space-between;

			.item {
				margin-bottom: 20rpx;
				width: 700rpx;

				border-radius: 10rpx;
				overflow: hidden;

				image {
					width: 700rpx;
				}
			}
		}
	}

</style>
