<template>
	<view class="content">
		<view class="section_1">
			<view class="tab">
				<view class="title" @click="change_active(1)" :class="active==1?'active':''">机关部室</view>
				<view class="title" @click="change_active(2)" :class="active==2?'active':''">基层区队</view>
			</view>
			<view class="list">
				<view class="item" v-for="(item,index) in list.children" :key="index" @click="go_record(item)">
					{{item.title}}
				</view>
			</view>
		</view>



	</view>
</template>

<script>
	import {goToLink} from "@/common/common.js"
	
	export default {
		name: "t-i-jinjiaqu",
		props: [
			"mine_code",
			"home_link"
		],
		data() {
			return {
				active: 1,
				list: [],
			};
		},
		mounted() {
			this.get_home_link()
		},
		methods: {
			change_active(item) {
				this.active = item

				if (item == 1) {
					this.list = this.home_link[0]
				} else if (item == 2) {
					this.list = this.home_link[1]
				}
			},
			get_home_link(){
				setTimeout(()=>{
					this.list = this.home_link[0]
				},1000)
			},

			go_record(item) {
				goToLink(item,this.mine_code)

			}
		}
	}
</script>

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

	.section_1 {
		box-sizing: border-box;
		padding: 25rpx;

		.tab {
			display: flex;
			justify-content: space-around;

			.title {
				line-height: 80rpx;
				font-weight: 700;
			}

			.active {
				color: #009fe8;
				border-bottom: 6rpx 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;

		.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;
			font-weight: 700;
		}

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

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

				border-radius: 20rpx;
				overflow: hidden;

				image {
					width: 340rpx;
					height: 220rpx;
				}
			}
		}
	}
</style>
