<script>
	import api from '@/utils/api'
	export default {
		// computed: {
		// 	i18n() {
		// 		return this.$t('index')
		// 	},
		// }, 
		onLaunch: function() {
			console.log('App Launch')
		// #ifdef APP-PLUS 
		this.appVersion()
		// #endif 
			api.indexInfo().then(res => {
				uni.setStorageSync('coinTypeInfo', res)
			})
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		},
		methods: {
			// 校验APP应用版本
			async appVersion() {
				let param = {
					'appId': uni.getSystemInfoSync().platform
				}
				// console.log('ss' + JSON.stringify(uni.getSystemInfoSync()))
				const response = await this.$api.appVersion(param)
				// console.log(response)
				if(!response.isUpgrade){
					return;
				}
				plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
					// console.log('当前版本号' + wgtinfo.versionCode)
					// console.log((wgtinfo.versionCode < response.versionCode))
					// console.log(wgtinfo.versionCode, response.versionCode)
					if (wgtinfo.versionCode < response.versionCode) {
						// console.log('更新了吗')
						let that = this;
						uni.showModal({
							title: this.$t("login").Versionupdate,
							content: response.info,
							showCancel: false,
							success: function(res) {
								if (res.confirm) {
									plus.runtime.openURL(response.appUrl);
								}
							}
						});
					}
				});
			},
	
	}
}
</script>

<style lang="scss">
	/*每个页面公共css */
	@import "uview-ui/index.scss";
	.main .body{
	    margin-top: 100rpx !important; 
		}
	/deep/ .u-loadmore__content__text {
		line-height: 50rpx !important;
	}

	/deep/body {
		// max-width: 828rpx; //最大宽度自己可以调整
		// margin: auto !important;

		background-color: #15141F;
		height: auto;
		margin: 0;
	}

	/deep/ .u-empty {
		position: absolute;
		top: 50%;
		left: 50%;
		transform: translate(-50%, -50%);
	}

	page {
		color: #fff;
		min-height: 100vh;
	}

	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>
