<script>
	import upapp from "/utils/upapp.js"
	export default {
		onLaunch: function() {

			uni.getPushClientId({
				success: (res) => {}
			})
			let _Android = uni.getStorageSync('cid') || new Date().getTime()
			// #ifdef APP
			// 获取设备码
			function getAndroidId() {
				plus.android.importClass("android.provider.Settings");
				const context = plus.android.runtimeMainActivity().getApplicationContext();
				const androidId = plus.android.invoke("android.provider.Settings$Secure", "getString",
					context.getContentResolver(), "android_id");
				return androidId;
			}
			_Android = getAndroidId() || plus.device.getOAID() || uni.getSystemInfoSync().deviceId;
			// #endif
			uni.setStorageSync('cid', _Android)
			if (uni.getStorageSync('token')) {
				// #ifdef APP-PLUS
				let _toure = getCurrentPages();
				if (_toure[0].route != 'pages/index') {
					uni.reLaunch({
						url: "/pages/index",
						success() {}
					})
				}
				// #endif
				// #ifdef H5
				uni.reLaunch({
					url: "/pages/index",
					success() {}
				})
				// #endif
				
				
			} else {
				uni.reLaunch({
					url: "/pages/signIn",
					success() {

					}
				})
			}
				
			// #ifdef APP-PLUS
				setTimeout(() => {
					plus.navigator.setFullscreen(true)
				}, 500)
				// 检查是否要更新APP
				setTimeout(() => {
					upapp()
				}, 5000)
			// #endif
			
		},
		onShow: function() {

			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style>
	view {
		box-sizing: border-box;
		color: #667085;
		font-size: 14rpx;
	}

	.numcolor1 {
		background: #3336E0;
		color: #fff;
	}

	.numcolor3 {
		background: #07C688;
		color: #fff;
	}

	.numcolor2 {
		background: #FF9521;
		color: #fff;
	}

	.numcolor4 {
		background: #333333;
		color: #fff;
	}

	/* :root{  

	  font-size: calc(100vw / 960px * 32px) !important;  
	} */
</style>