<template>
	<view class="container">
		<!-- 背景图片区域 -->
		<img class="img_bg" src="../../static/images/center-bg.png" />
		<!-- 背景墙区域 -->
		<view class="wall_bg"></view>
		<!-- 背景文字区域 -->
		<view class="text_bg">欢迎使用访客预约</view>

		<!-- 主体内容区域 -->
		<view class="body">
			<view class="body_title">选择预约方式</view>

			<!-- 学生家长预约选项区域 -->
			<view class="body_box" @click="goPage('/pagesReservation/register/register?type=1')" v-if="userType == 0">
				<img class="box_img" src="../../static/images/reservation.png" />
				<view class="box_text">学生家长预约</view>
				<img class="box_icon" src="../../static/images/right-blue.png" />
			</view>

			<!-- 其他访客预约选项区域 -->
			<view class="body_box" @click="goPage('/pagesReservation/register/register?type=2')" v-if="userType == 1">
				<img class="box_img" src="../../static/images/reservation2.png" />
				<view class="box_text">其他访客预约</view>
				<img class="box_icon" src="../../static/images/right-blue.png" />
			</view>

			<!-- 生成邀请预约码选项区域 -->
			<!-- <view class="body_box" @click="goPage('/pagesReservation/QRCode/QRCode')">
				<img class="box_img" src="../../static/images/reservation3.png" />
				<view class="box_text">生成邀请预约码</view>
				<img class="box_icon" src="../../static/images/right-blue.png" />
			</view> -->
		</view>

		<!-- 底部导航栏区域 -->
		<tabber />
	</view>
</template>

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

const userType = ref('')

onLoad(() => {
	userType.value = uni.getStorageSync('userType')
	console.log(userType.value)
})
const goPage = (url) => {
	uni.navigateTo({
		url
	})
}
</script>

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

	// 背景图片区域样式
	.img_bg {
		position: absolute;
		top: -70rpx;
		right: -32rpx;
		width: 589rpx;
		height: 320rpx;
		pointer-events: none;
	}

	// 背景墙区域样式
	.wall_bg {
		width: 750rpx;
		height: 340rpx;
		background-color: #0061ff;
		border-radius: 0 0 10rpx 10rpx;
	}

	// 背景文字区域样式
	.text_bg {
		position: absolute;
		top: 56rpx;
		left: 20rpx;
		color: #fff;
		font-size: 54rpx;
		font-weight: bold;
	}

	// 主体内容区域样式
	.body {
		position: relative;
		margin: auto;
		margin-top: -160rpx;
		padding: 0 50rpx;
		box-sizing: border-box;
		width: 710rpx;
		height: 775rpx;
		border-radius: 12rpx;
		background-color: #fff;
		overflow: hidden;

		.body_title {
			margin: 44rpx 0 34rpx 0;
			font-size: 40rpx;
			font-weight: bold;
		}

		.body_box {
			margin: auto;
			margin-bottom: 40rpx;
			padding: 0 30rpx 0 45rpx;
			box-sizing: border-box;
			display: flex;
			align-items: center;
			width: 607rpx;
			height: 110rpx;
			border-radius: 18rpx;
			background-color: #f2f4f9;

			.box_img {
				width: 40rpx;
				height: 40rpx;
			}

			.box_text {
				margin-left: 22rpx;
				color: #0061ff;
				font-size: 28rpx;
			}

			.box_icon {
				margin-left: auto;
				width: 31rpx;
				height: 31rpx;
			}
		}
	}
}
</style>
