<template>
	<view class="layout-container">
		<!-- 顶部填充区 -->
		<view class="top-fill" :style="{height: safeArea.statusBarHeight+'px'}"></view>
		
		<!-- 顶部胶囊区 -->
		<view class="capsule-container" 
		:style="{
			height: safeArea.capsuleBarHeight+'px',
			width: safeArea.capsuleBarLeft+'px',
			'padding-top': safeArea.capsuleBarMarginTop+'px', 
			'padding-bottom': safeArea.capsuleBarMarginBottom+'px'}">
			<view class="back-container" :style="{
				height: safeArea.capsuleBarContentHeight+'px',
				width: safeArea.capsuleBarContentHeight+'px',
			}">
				<navigator url="/pages/index/index">
					<uni-icons type="back" :size="safeArea.capsuleBarContentHeight" color="#FFFFFF"></uni-icons>
				</navigator>
			</view>
		</view>
		
		<!-- 内容区 -->
		<view class="content-container">
			<view class="login-container">
				<view class="avator-container">
					<uni-icons type="person" size="130" color="#FFFFFF"></uni-icons>
				</view>
				<view class="btn-container" @click="logout">注销</view>
			</view>
		</view>
		
		<!-- 底部填充区 -->
		<view class="bottom-fill" :style="{height: safeArea.bottomHeight+'px'}"></view>
	</view>
</template>

<script setup>
	import { ref } from 'vue';
	import { onLoad } from "@dcloudio/uni-app";
	import { getSafeArea } from '@/utils/system.js';
	
	/**
	 * 安全区
	 */
	const safeArea = ref({});
	
	onLoad(() => {
		safeArea.value = getSafeArea();
	});
	
	const logout = () => {
		uni.removeStorageSync("token");
		uni.reLaunch({
			url: "/pages/index/index"
		});
	}
</script>

<style lang="scss" scoped>
	.back-container {
		border-radius: 50%;
		background-color: rgba(0, 0, 0, 0.1);
		
		display: flex;
		justify-content: center;
		align-items: center;
	}
	
	.login-container {
		width: 100%;
		height: 100%;
		display: flex;
		justify-content: center;
		align-items: center;
		flex-direction: column;
		
		.avator-container {
			left: 222rpx;
			top: 254rpx;
			width: 307rpx;
			height: 307rpx;
			background: #D2EFF3;
			border-radius: 50%;
			box-shadow: 0px 2px 2px 0px #DBDBDB;
		
			display: flex;
			justify-content: center;
			align-items: center;
		}
		
		.btn-container {
			margin-top: 57rpx;
			
			width: 500rpx;
			height: 100rpx;
			border-radius: 20rpx;
			background: #FA2525;
		
			font-size: 48rpx;
			font-weight: 700;
			letter-spacing: 0rpx;
			line-height: 69.5rpx;
			color: #FFFFFF;
			
			display: flex;
			justify-content: center;
			align-items: center;
		}
	}	   
</style>
