<script setup>
	import { onLaunch, onShow, onHide } from '@dcloudio/uni-app'
	import { onBeforeMount } from 'vue'
	
	// #ifdef APP
	import { useSystemStore } from '@/store/system.js';
	const systemStore = useSystemStore()
	// #endif
	
	import { useUserStore } from '@/store/user.js';
	const userStore = useUserStore();
	
	onLaunch(() => {
		console.log('App Launch')
		// #ifdef APP
		const appInfo = uni.getAppBaseInfo()
		systemStore.setAppInfo(appInfo)
		// #endif
		
		uni.getNetworkType({
			success ({ networkType }) {
				console.log('enter network', networkType)
				if (networkType === 'none') {
					uni.showModal({
						title: '提示',
						content: '当前无网络，请连接网络',
						showCancel: false
					})
				}
			}
		})
	})
	
	onShow(() => {
		console.log('App Show')
	})
	
	onHide(() => {
		console.log('App Hide')
	})
	
	onBeforeMount(() => {
		// const userInfo = uni.getStorageSync('uInfo')
		const userInfo = userStore.getUserInfo();
		if (userInfo) {
			userStore.setUserInfo(userInfo)
		}
	})
</script>

<style>
#app {
	min-height: 100vh;
	background-color: #efeff4;
	/* background-color: #000; */
	/* height: auto; */
}
</style>
