<template>
	<view class="page_view">
		<top-return text="孩子名片" color="#FFF"></top-return>
		<view class="detail_image"
			:style="{backgroundImage:`linear-gradient(to top, #f3f4f9, rgba(255, 255, 255, 0)),url(${image})`}"></view>
		<!-- 孩子头部信息 -->
		<view class="top_info">
			<image class="top_avatar" v-if="childInfo.avatar === '默认'" :src="childInfo.gender==='男'?'/static/default_icons/boy_avatar.svg':'/static/default_icons/girl_avatar.svg'"></image>
			<image class="top_avatar" v-if="childInfo.avatar != '默认'" :src="childInfo.avatar"></image>
			<view class="top_name">
				<text class="name">{{childInfo.name}}</text>
				<text class="detail">{{childInfo.school}}</text>
			</view>
		</view>
		<!-- 卡片信息 -->
		<view class="main_card">
			<view class="flex_row">
				<view class="t-icon t-icon-baike"></view>
				<view class="flex_cloumn">
					<view class="subtitle">基础信息</view>
					<view class="title" style="margin-top: 10rpx;">性别 {{childInfo.gender}} 年龄 {{childInfo.age}}岁</view>
				</view>
			</view>
			<view class="flex_row" style="margin-top: 50rpx;">
				<view class="t-icon t-icon-tuandui1"></view>
				<view class="flex_cloumn">
					<view class="subtitle">孩子班级</view>
					<view class="title">{{childInfo.class}}</view>
				</view>
			</view>
			<view class="flex_row" style="margin-top: 50rpx;">
				<view class="t-icon t-icon-xuewei"></view>
				<view class="flex_cloumn">
					<view class="subtitle">学期信息</view>
					<view class="title">{{childInfo.semester}}</view>
				</view>
			</view>
			
			<view class="card_view" style="margin-top: 40rpx;">
				<view class="flex_cloumn_box" style="margin:0 auto 0 -40rpx;">
					<view class="cloumn_title">勋章卡片</view>
					<view class="bottom_tag"></view>
				</view>
			</view>
			
			<u-avatar-group :urls="medals" size="40" gap="0.2"></u-avatar-group>
		</view>

	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex'
	export default {
		computed: {
			...mapState('m_children', ['childInfo']),
		},
		data() {
			return {
				image: 'https://images.unsplash.com/photo-1648522102128-ef9759d8d27c?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=764&q=80',
				medals: [
					
				]
			};
		},
		methods: {
			updateAvatar() {
				uni.chooseImage({
					count: 1, //默认1个图片
					sourceType: ['album'], //从相册选择
					success: function(res) {
						console.log(JSON.stringify(res.tempFilePaths));
					}
				})
			},


		},
	}
</script>

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

	.page_view {
		display: flex;
		flex-direction: column;
		width: 100vw;
		height: 100vh;
		overflow: hidden;
	}

	.detail_image {
		position: fixed;
		width: 100%;
		height: 1000rpx;
	}

	.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;
			}

			.detail {
				color: $subtitle;
				font-size: 32rpx;
				font-weight: bold;
				z-index: 55;
			}
		}
	}

	.main_card {
		display: flex;
		flex-direction: column;
		padding: 80rpx 80rpx 200rpx 80rpx;
		position: relative;
		background-color: #FFF;
		top: 80rpx;
		left: 50rpx;
		border-radius: 50rpx;
		height: 1200rpx;
		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;
		}
	}

	.box_title {
		line-height: 35rpx;
		font-size: 35rpx;
		font-weight: bold;
		color: $title;
	}
	
	.flex_cloumn_box{
		display:flex;
		flex-direction: column;
		.cloumn_title{
			line-height: 35rpx;
			font-size: 32rpx;
			font-weight: bold;
			color: $title;
		}
		.bottom_tag{
			margin-top: -10rpx;
			margin-left: 20%;
			height: 20rpx;
			width: 90%;
			border-radius: 6rpx;
			background-image: linear-gradient(to right, #4169E1, #FFF);
			z-index: -1;
		}
	}
</style>
