<template>
	<view>
		<u-navbar title="首页" :autoBack="true" :placeholder="true" v-hideNav></u-navbar>
		<u-sticky class="sticky_wrap" :customNavHeight="isWeixin ? 0 : undefined"  bgColor="#fff">
			<view class="header_wrap">
				<view class="header_top_wrap" @click="toPerson">
					<view class="header_info_left">
						<u-avatar :src="$avatar(userInfo.avatar)" size="60rpx"></u-avatar>
						<view class="info_wrap">
							<text class="follow_name">{{userInfo.userName ? userInfo.userName : "-"}}</text>
							<text class="deptName">{{userInfo.dept ? userInfo.dept.deptName : "-"}}</text>
						</view>
					</view>
				</view>
			</view>
			<u-tabs class="uTabsWrap" :list="list" :activeStyle="{
			color: '#303133',
			fontWeight: 'bold',
			fontSize : '36rpx'
			}" :inactiveStyle="{
			color: '#606266',
			fontWeight: 'bold',
			fontSize : '32rpx'}" @change="handleTabChange">
			</u-tabs>
	<!-- 		<view class="dayNum_wrap" @click="handleClickDayNum">
				<view class="text">{{dayName}}</view>
				<u-icon name="arrow-down-fill" color="#aaa" size="10"></u-icon>
			</view> -->
		</u-sticky>
		<view class="main_warp" id="main_warp">
			<team :class="[activeTab !== 'team' ? 'hidden' : '' ]"	ref="team"></team>
			<personage :class="[activeTab !== 'personage' ? 'hidden' : '' ]" ref="personage"></personage>
		</view>

	</view>
</template>

<script>
	import dayjs from "dayjs";
	import personage from "./personage/index.vue";
	import team from "./team/index.vue";
	import { is_weixin } from "../../utils/util";
	export default {
		components : { personage , team },
		data() {
			return {
				list: [{
					name: '团队管理',
					value: "team"
				}, {
					name: '个人跟进',
					value: "personage"
				}],
				activeTab: "team",
				isWeixin : is_weixin(),
				userInfo: this.$store.state.user.userInfo,
			};
		},
		methods: {
			toPerson() {
				uni.switchTab({
					url: `/pages/person/index`
				})
			},
			handleTabChange({
				value
			}) {
				this.activeTab = value;
			}
		},
	}
</script>

<style lang="scss" scoped>
	.uTabsWrap{
		background-color: #fff;
	}
	.header_wrap {
		box-sizing: border-box;
		padding: 10rpx;
		background: #fff;
		.header_top_wrap {
			display: flex;
			justify-content: space-between;
			align-items: center;

			.header_info_left {
				display: flex;
				align-items: center;

				// image {
				// 	width: 100rpx;
				// 	height: 100rpx;
				// 	margin-right: 30rpx;
				// 	border-radius: 50%;
				// }

				.info_wrap {
					margin-left: 20rpx;
					.follow_name {
						font-size: 32rpx;
						color: #202020;
						font-weight: bold;
						margin-right: 20rpx;
					}
					.deptName{
						font-size: 28rpx;
						color: #666666;
					}
				}
			}

			.header_info_right {
				::v-deep .u-icon__icon {
					font-size: 30rpx !important;
				}
			}
		}

		.parson_menu_wrap {
			background: #ffffff;
			border-radius: 20px;
			box-shadow: 0px 4px 20px 0px rgba(16, 140, 255, 0.10);
			margin-top: 58rpx;

			.parson_menu_list {
				display: flex;
				padding: 40rpx 0;

				.menu_item {
					width: 33%;
					display: flex;
					flex-direction: column;
					align-items: center;

					image {
						width: 48rpx;
						height: 48rpx;
						margin-bottom: 24rpx;
					}

					text {
						font-size: 28rpx;
						color: #202020;
					}
				}
			}
		}

	}


	.sticky_wrap {
		position: relative;
	}

	.hidden {
		padding: 0;
		height: 0;
		overflow: hidden;
	}

	.personClue {
		background-color: #fff;
		display: flex;
		justify-content: flex-start;
	}

	.main_warp {
		padding-top: 20rpx;
		padding-bottom: 100rpx;
	}
</style>