<template>
	<view class="page-view" style="width: 100vw;height: 100vh;">
		<top-return text="个人信息" color="#FFF"></top-return>
		<view class="detail-image"
			:style="{backgroundImage:`linear-gradient(to top, #f3f4f9, rgba(255, 255, 255, 0) 60%),url(${image})`}">
		</view>
		<!-- 个人头部信息 -->
		<view class="top-info">
			<image class="top-avatar" :src="parentInfo.avatarUrl"></image>
			<view class="top-name">
				<text class="name">{{parentInfo.nickName}}</text>
				<view class="tag-fill">
					<view class="t-icon t-icon-lianmengzhuanjia"></view>
					<view class="tag-text" style="color: #4169E1;font-size: 28rpx;">{{phoneNumber}} 绑定手机</view>
				</view>
			</view>
		</view>
		<!-- 卡片信息 -->
		<view class="main-card">
			<view class="flex-row">
				<view class="t-icon t-icon-huangguan"></view>
				<view class="flex-column">
					<view class="subtitle">我的订阅</view>
					<view class="title">{{userData.subscribeLevel}}</view>
				</view>
			</view>
			<view class="flex-row" style="margin-top: 50rpx;">
				<view class="t-icon t-icon-jiesuo"></view>
				<view class="flex-column">
					<view class="subtitle">订阅时间</view>
					<view class="title">{{userData.subscribeTime}}</view>
				</view>
			</view>
			<view class="flex-row" style="margin-top: 50rpx;">
				<view class="t-icon t-icon-quanxian"></view>
				<view class="flex-column">
					<view class="subtitle">订阅权益</view>
					<view class="title">{{userData.subscribePrivilege}}</view>
				</view>
			</view>

			<view class="card-view" style="margin-top: 40rpx;">
				<view class="flex-column-box" style="margin:0 auto 0 -40rpx;">
					<view class="column-title">孩子名片</view>
					<view class="bottom-tag"></view>
				</view>
			</view>

			<view class="card-box">
				<view class="card" v-for="(item,index) in childrenData" :key="index" @click="navChildInfo(index)">
					<image class="avatar" :src="item.gender==='M'?'/static/default_icons/boy_avatar.svg':item.gender===null?'/static/default_icons/boy_avatar.svg':'/static/default_icons/girl_avatar.svg'"></image>
					<view class="card-info">
						<view class="flex-baseline">
							<view class="YS-title">{{item.name}}</view>
							<view class="card-title">{{item.periodName}}学段</view>
						</view>
						<view class="flex-row">
							<view class="t-icon t-icon-xuewei1"></view>
							<view class="card-subtitle">{{item.schoolName}}</view>
							<view class="t-icon t-icon-zhengceguizhang2" style="margin-left: 20rpx;"></view>
							<view class="card-subtitle">{{item.className}}</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex'
	export default {
		computed: {
			...mapState('m_parent', ['parentInfo', 'phoneNumber', 'userData', 'childrenData']),
		},
		data() {
			return {
				image: 'https://image.meiye.art/pic_1628493294944',
			};
		},
		methods: {
			//孩子名片
			navChildInfo(index) {
				uni.navigateTo({
					url: `/subpkg/mine/childInfo?index=${index}`
				})
			},
		},
	}
</script>

<style lang="scss">
	.flex-column {
		display: flex;
		flex-direction: column;
		height: 80rpx;
		justify-content: space-between;
	}

	.detail-image {
		position: fixed;
		width: 100%;
		height: 800rpx;
	}

	.top-info {
		display: flex;
		align-items: center;
		margin-top: 180rpx;

		.top-avatar {
			margin-left: 50rpx;
			width: 140rpx;
			height: 140rpx;
			border-radius: 100%;
			border: 6rpx solid #FFF;
			box-shadow: 0 10rpx 20rpx rgba(0, 0, 0, 0.2);
			z-index: 55;
		}

		.top-name {
			margin-left: 50rpx;
			height: 130rpx;
			display: flex;
			flex-direction: column;
			justify-content: space-around;
			font-weight: bold;

			.name {
				color: $title;
				font-size: 45rpx;
				font-weight: bold;
				z-index: 55;
			}

			.t-icon {
				width: 32rpx;
				height: 32rpx;
				margin-right: 5rpx;
			}
		}
	}

	.main-card {
		display: flex;
		flex-direction: column;
		padding: 80rpx 80rpx 0 80rpx;
		position: relative;
		background-color: #FFF;
		height: 100%;
		top: 80rpx;
		left: 50rpx;
		border-radius: 50rpx;
		border-bottom-left-radius: 0;
		z-index: 55;

		.title {
			line-height: 32rpx;
			font-size: 32rpx;
			font-weight: 400;
			color: $title;
		}

		.subtitle {
			line-height: 28rpx;
			font-size: 28rpx;
			color: $subtitle;
			font-weight: 400;
		}

		.t-icon {
			margin-right: 30rpx;
			width: 80rpx;
			height: 80rpx;
		}
	}

	.flex-column-box {
		display: flex;
		flex-direction: column;

		.column-title {
			line-height: 35rpx;
			font-size: 32rpx;
			font-weight: bold;
			color: $title;
		}
	}

	.card-box {
		display: flex;
		align-items: center;
		flex-wrap: wrap; //元素换行

		.card {
			width: 100%;
			margin: 10rpx 0 10rpx 0;
			padding: 20rpx;
			display: flex;
			align-items: center;
			border: 2rpx solid #f3f4f9;
			background-color: #FFFFFF;
			border-radius: $border-radius;
			z-index: 99;

			.card-title {
				margin-left: 20rpx;
				font-size: 28rpx;
				color: $title;
			}

			.card-subtitle {
				line-height: 26rpx;
				font-size: 26rpx;
				color: $subtitle;
			}

			.avatar {
				width: 100rpx;
				height: 100rpx;
			}
		}
	}

	.tag-fill {
		background-color: #d8deff;
		width: fit-content;
		z-index: 99;
	}

	.card-info {
		display: flex;
		flex-direction: column;
		margin-left: 30rpx;
		height: 100rpx;
		justify-content: space-around;

		.t-icon {
			width: 32rpx;
			height: 32rpx;
			margin-right: 5rpx;
		}
	}
</style>
