<template>
	<view class="container">
		<!-- 顶部个人信息区域 -->
		<view class="header">
			<img class="header_img" src="../../static/images/center-bg.png" />
			<img mode="aspectFill" class="user_photo" src="../../static/images/header.png" />
			<view class="user_name">张三</view>
			<view class="user_grade">万载三中 / 初一 / 2班</view>
		</view>

		<!-- 列表区域 -->
		<view class="body">
			<!-- 每一个盒子区域 -->
			<view class="body_box" v-for="item in list" :key="item.id" @click="goPage(item.page)">
				<img class="box_img" :src="item.url" />
				<text class="box_title">{{ item.title }}</text>
				<img class="box_icon" src="../../static/images/right.png" />
			</view>
		</view>
	</view>
</template>

<script setup>
import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'

onLoad(() => {})

// 列表信息
const list = ref([
	{
		id: 1,
		title: '我的信息',
		url: '../../static/images/message.png',
		page: '/pages/myMsg/myMsg'
	},
	{
		id: 2,
		title: '消息提醒',
		url: '../../static/images/warn.png',
		page: '/pages/msgWarn/msgWarn'
	}
])

// 跳转页面函数
const goPage = (url) => {
	uni.navigateTo({
		url
	})
}
</script>

<style lang="scss" scoped>
.container {
	padding: 0 20rpx;
	min-height: 100vh;
	background-color: #f1f6fe;

	// 顶部个人信息区域样式
	.header {
		position: relative;
		width: 710rpx;
		height: 260rpx;
		text-align: end;
		overflow: hidden;

		.header_img {
			margin-top: -24rpx;
			margin-right: -45rpx;
			width: 589rpx;
			height: 320rpx;
		}

		.user_photo {
			position: absolute;
			top: 80rpx;
			left: 20rpx;
			width: 120rpx;
			height: 120rpx;
			border-radius: 50%;
		}

		.user_name {
			position: absolute;
			top: 90rpx;
			left: 167rpx;
			font-size: 40rpx;
			font-weight: bold;
		}

		.user_grade {
			position: absolute;
			top: 160rpx;
			left: 167rpx;
			font-size: 24rpx;
			color: #666666;
		}
	}

	// 列表区域样式
	.body {
		padding: 0 30rpx;
		background-color: #fff;

		.body_box {
			display: flex;
			align-items: center;
			height: 110rpx;

			.box_img {
				width: 50rpx;
				height: 50rpx;
				border-radius: 50%;
			}

			.box_title {
				flex: 1;
				margin-left: 18rpx;
				font-size: 32rpx;
			}

			.box_icon {
				width: 31rpx;
				height: 31rpx;
			}
		}
	}
}
</style>
