<template>
	<div class="center">
		<!-- 用户信息 -->
		<div class="user-info">
			<div class="user-box">
				<div class="user-img">
					<image :src="userInfo.headImage" mode="widthFix"></image>
				</div>
				<div class="base">
					<div class="user-name"
					v-if="userInfo.auth">{{ userInfo.auth.name }}</div>
					<!-- <div class="user-project">高新区项目一队项目1</div> -->
					<view class="user-project"
					v-if="userInfo.team">{{ userInfo.team.name }}</view>
				</div>
			</div>
			<image class="user-bg" src="https://tennis-oss.xzaiyp.top/2024-10-22/b51d97b2-f2a1-4471-9b6d-7fbc2f3f774a.png" mode="widthFix"></image>
		</div>

		<!-- 菜单 -->
		<div class="menus">
			<uv-cell-group :border="false">
				<uv-cell @click="clickMenu(1)" title="打卡记录" isLink arrow-direction="right" center>
					<template v-slot:icon>
						<image style="width: 30rpx;" src="https://tennis-oss.xzaiyp.top/2024-10-22/a57869c1-1451-47db-805d-8e29f5c37637.png" mode="widthFix"></image>
					</template>
				</uv-cell>
				<uv-cell @click="clickMenu(2)" icon="setting-fill" isLink arrow-direction="right" title="实名认证" center>
					<template v-slot:icon>
						<image style="width: 30rpx;" src="https://tennis-oss.xzaiyp.top/2024-10-22/a7f27701-49fe-4a1f-8171-19efb1af1102.png" mode="widthFix"></image>
					</template>
				</uv-cell>
				<uv-cell @click="$store.commit('logout')" icon="setting-fill" isLink arrow-direction="right" title="退出登录" center>
					<template v-slot:icon>
						<image style="width: 30rpx;" src="https://tennis-oss.xzaiyp.top/2024-10-22/a7f27701-49fe-4a1f-8171-19efb1af1102.png" mode="widthFix"></image>
					</template>
				</uv-cell>
				<uv-cell @click="clickMenu" icon="integral-fill" title="版本" value="版本1.0" center>
					<template v-slot:icon>
						<image style="width: 30rpx;" src="https://tennis-oss.xzaiyp.top/2024-10-22/6878084d-4c1e-4577-8c8b-dd92aebbe2a2.png" mode="widthFix"></image>
					</template>
				</uv-cell>
			</uv-cell-group>
		</div>

		<tabbar :select="1"></tabbar>
	</div>
</template>

<script>
	import tabbar from '../../components/base/tabbar.vue'
	import { mapState } from 'vuex'
	export default {
		name: "Center",
		components: {
			tabbar
		},
		data() {
			return {

			}
		},
		onShow() {
			this.$store.commit('getUserInfo')
		},
		computed : {
			...mapState(['teamList', 'userInfo']),
		},
		methods: {
			clickMenu(index){
				if(index == 1){
					uni.navigateTo({
						url: "/pages/subPack/record/record"
					})
				}else if(index == 2){
					uni.navigateTo({
						url: "/pages/subPack/autonym/autonym"
					})
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.center {

		// 用户信息
		.user-info {
			display: flex;
			align-items: center;
			position: relative;
			height: 325rpx;
			overflow: hidden;
			padding-top: var(--status-bar-height);

			.user-box {
				display: flex;
				width: 90%;
				position: absolute;
				left: 50%;
				transform: translateX(-50%);
				z-index: 10;
				color: white;

				.user-img {
					width: 130rpx;
					height: 130rpx;
					overflow: hidden;

					image {
						width: 100%;
					}
				}

				.base {
					width: calc(100% - 150rpx);
					display: flex;
					flex-direction: column;
					justify-content: space-around;
					box-sizing: border-box;
					padding: 10rpx 0rpx 10rpx 10rpx;
					
					.user-name {
						font-size: 36rpx;
					}
					
					.user-project {
						font-size: 30rpx;
					}
				}
			}

			.user-bg {
				width: 750rpx;
				position: absolute;
				left: 0;
				top: 0;
			}
		}

		// 菜单
		.menus {
			width: 90%;
			margin: 0rpx auto;
		}
	}
</style>