<style lang="scss">
	/*  #ifdef  H5  */
	body {
		max-width: 828rpx; //最大宽度自己可以调整
		margin: auto !important;
	}
	/*  #endif  */
	@import "uview-ui/index.scss";
	page{margin-top:50rpx}
	
</style>

<script>
	export default {  
		computed: {
			i18n() {
				return this.$t('index')
			},
		},
		onLaunch: function() {
			const clientInfo = plus.push.getClientInfo()
							console.log(clientInfo,'APP的CID')
			// #ifdef APP-PLUS
			this.appVersion()
			this.getIp();
			// #endif	
		},
 
 
 

		onShow: function() {
			if(!uni.getStorageSync('walletInfo')){
				// uni.reLaunch({
				// 	url:'/pages/register/index'
				// })
				return;
			}
			// 用户进入时间
					var date=new Date();
					//停留时间(毫秒)
					 // var year=date.getFullYear(); //获取当前年份
					   // var mon=date.getMonth()+1; //获取当前月份
					   // var da=date.getDate(); //获取当前日
					   // var day=date.getDay(); //获取当前星期几
					   // var h=date.getHours(); //获取小时
					   // var m=date.getMinutes(); //获取分钟
					     // var s=date.getSeconds(); //获取秒
						var s= Math.round(new Date() / 1000) 
					  var hideSecond= uni.getStorageSync('hideSecond')
					   console.log(s-hideSecond,'隐藏时间')
					   var time=s-hideSecond
					   var addTime=time+2
					console.log('App Show') 
					if(addTime>60){
						if(uni.getStorageSync('fingerPass')){
									   uni.reLaunch({
									   	url:'/pages/fingerPage/index' 
									   })
						}else{
									   uni.reLaunch({
									   	url:'/pages/fingerPage/password/index'
									   })
						}
					}
	
   
	
		},
		onHide: function() {
			// 用户退出时间
					var date=new Date();
					//停留时间(毫秒)
					 // var year=date.getFullYear(); //获取当前年份
					   // var mon=date.getMonth()+1; //获取当前月份
					   // var da=date.getDate(); //获取当前日
					   // var day=date.getDay(); //获取当前星期几
					   // var h=date.getHours(); //获取小时
					   // var m=date.getMinutes(); //获取分钟
					   // var s=date.getSeconds(); //获取秒
					     var s=Math.round(new Date() / 1000)
					console.log('页面隐藏'+s); 
					uni.setStorageSync('hideSecond',s)
		},
		methods: {
			async getIp() {
				let param = {
					'key': 'is_ban_china'
				}

				try {
					const response = await this.$api.getConfig(param);
					if (response.data.value == 'Y') {
						const response2 = await this.$api.checkIp();
						if (response2.data.country == '中国') {
							uni.showModal({
								content: this.i18n.mainInfo,
								showCancel: false,
								confirmText: this.i18n.Confirm, //这块是确定按钮的文字
								success: function(res) {
									if (res.confirm) {
										// #ifdef APP-PLUS 
										plus.runtime.quit();
										// #endif
									}
								}
							});
						}
					}


				} catch (e) {
					console.log(e)

				}
			},

			async appVersion() {
				let param = {
					'appId': uni.getSystemInfoSync().platform
				}
				console.log('ss' + JSON.stringify(uni.getSystemInfoSync()))
				const response = await this.$api.versionUpgrade(param)
				plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
					console.log('当前版本号' + wgtinfo.versionCode)

					console.log((wgtinfo.versionCode < response.data.versionId))
					console.log(wgtinfo.versionCode, response.data.versionId)
					if (wgtinfo.versionCode < response.data.versionId) {
						console.log('更新了吗')
						let that = this;
						uni.showModal({
							title: that.i18n.updateTitle,
							content: that.i18n.updateMsg,
							confirmText: that.i18n.Confirm, //这块是确定按钮的文字
							showCancel: false,
							success: function(res) {
								if (res.confirm) {
									plus.runtime.openURL(response.data.appUrl);
								}
							}
						});

					}
				});
			},
		}
	}
</script>

<style lang="scss">
	button::after {
		border: none;
	}




	uni-tabbar {
		.uni-tabbar {
			// tab背景
			padding-top: 28rpx;
			padding-bottom: 30rpx !important;
			background-image: linear-gradient(to top, #FAF8F8, #FFFFFF) !important; // tab背景图片或者渐变色，背景色和背景图片最多选择一个进行设置

			.uni-tabbar-border {
				// tabBar上边框
				background-color: #F7F4F4 !important; // tabBar上边框的颜色
			}

			.uni-tabbar__bd {

				// tabBar单项
				.uni-tabbar__icon {
					// 图标
					width: 48rpx !important;
					height: 48rpx !important;
				}

				.uni-tabbar__label {
					// 文字
					font-size: 20rpx !important;

				}
			}
		}
	}
</style>
