<template>
	<view class="container">
		<!-- <view :style="{height: statusBarHeight + 'px'}"></view> -->
		<!-- <view :style="{height: navBarHeight + 'px'}"></view> -->
		<u-navbar :is-back="false" title="" :background="{ background: '#f7f7f7' }" :border-bottom="false">
			<view class="slot-wrap">
				<image src="/static/images/login-icon.png" mode="aspectFit" style="width: 200rpx;"></image>
			</view>
		</u-navbar>
		<view class="page-content">
			<button @click="toPage">是否登录</button>
		</view>
	</view>
</template>

<script setup>
	import {
		ref
	} from 'vue'
	import {
		onReady,
		onLoad
	} from '@dcloudio/uni-app'
	import { useAuthStore } from '@/store/authStore'
	const authStore = useAuthStore()
	// 屏幕状态栏高度
	const statusBarHeight = ref(0)
	// 顶部导航栏高度
	const navBarHeight = ref(0)
	const toPage = () => {
		if(!authStore.isAuthenticated){
			uni.navigateTo({
				url: "/pages/login/login"
			})
			return
		}
		console.log("登陆了")
	}
	onReady(() => {
		uni.getSystemInfo({
			success(e) {
				statusBarHeight.value = e.statusBarHeight;
				let custom = uni.getMenuButtonBoundingClientRect();
				navBarHeight.value = custom.height + (custom.top - e.statusBarHeight) * 2;
			}
		})
	})
	onLoad(() => {
		uni.setTabBarBadge({ //显示数字  
			index: 1, //tabbar下标
			text: '999' //数字
		})
	})
</script>

<style lang="scss" scoped>
	.container {
		height: 100vh;
		width: 100vw;
		background-color: $uni-bg-color;
		padding: 0 20rpx;
	}
	.slot-wrap{
		padding-left: 20rpx;
	}
</style>