<template>
	<view class="container">
		<!-- 头部分段选择器区域 -->
		<view class="control">
			<uni-segmented-control :current="current" :values="items" styleType="text" @clickItem="onClickItem"
				activeColor="#0082FC"></uni-segmented-control>
		</view>

		<!-- 选中人物区域 -->
		<view class="choose">

			<view class="box" v-for="item in chooseList" :key="item.id">
				<view class="name">
					{{item.name}}
				</view>
				<view class="icon" @click="handleDelete(item.id)">
					<img src="../../static/close.png">
				</view>
			</view>
		</view>

		<!-- 人员展示区域 -->
		<view class="list">
			<!-- 每一个人员区域 -->
			<view class="item" v-for="item in list" :key="item.id">
				{{item.name}} - {{item.type}} - {{item.number}}
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				items: ['管理员', '子管理员'],
				current: 0,
				list: [{
						id: 1,
						name: "张三",
						number: 360730199525462589,
						type: "学生"
					},
					{
						id: 2,
						name: "李四",
						number: 360730199525462589,
						type: "老师"
					},
					{
						id: 3,
						name: "王五",
						number: 360730199525462589,
						type: "教职工"
					},
				],
				chooseList: [{
						id: 1,
						name: "张三",
					},
					{
						id: 2,
						name: "李四",
					},
					{
						id: 3,
						name: "王五",
					},
					{
						id: 4,
						name: "李四",
					},
					{
						id: 5,
						name: "王五",
					},
					{
						id: 6,
						name: "李四",
					},
					{
						id: 7,
						name: "王五",
					},
				]
			};
		},
		methods: {
			onClickItem(e) {
				console.log(e.currentIndex);
				// if (e.currentIndex == 0) {
				// 	this.list = this.list2
				// } else {
				// 	this.list = this.list3
				// }
			},
			handleDelete(id){
				console.log(id);
			}
		}
	}
</script>

<style lang="scss" scoped>
	.container {
		padding-top: 20rpx;

		.control {
			display: flex;
			flex-direction: column;
			justify-content: center;
			width: 750rpx;
			height: 86rpx;
			background-color: #fff;
		}

		.choose {
			display: flex;
			flex-wrap: wrap;
			justify-content: space-evenly;
			align-items: center;
			margin-top: 20rpx;
			padding: 30rpx;
			width: 690rpx;
			border-bottom: 1rpx solid #E5E5E5;
			background-color: #fff;

			.box {
				display: flex;
				align-items: center;
				width: 150rpx;
				height: 60rpx;

				.name {
					flex: 2;
					text-align: center;
					font-size: 28rpx;
				}

				.icon {
					flex: 1;
					display: flex;
					align-items: center;
					height: 50rpx;

					img {
						width: 30rpx;
						height: 30rpx;
					}
				}
			}
		}

		.list {
			display: flex;
			flex-direction: column;
			justify-content: space-evenly;
			padding-top: 22rpx;
			width: 750rpx;
			border-bottom: 1rpx solid #E5E5E5;
			background-color: #fff;

			.item {
				margin-bottom: 22rpx;
				margin-left: 65rpx;
				height: 41rpx;
				font-size: 28rpx;
			}
		}
	}
</style>
