<script>
	export default {
		onLaunch: function() { 
				let self = this
			        wx.getSystemInfo({
			          success: res => {  
			          },
			          fail(e) {
			          console.error(e)
			            wx.showToast({
			              title: '获取设备信息失败',
			              icon: 'none',
			            })
			          },
					})
					
				var _this = this
				_this.checkForUpdates()
		},
		onShow: function() { 
		},
		onHide: function() {
			console.log('App Hide')
		},
		methods:{  
			tryToReportAbnormalDevice(res) {
			    if (!this.isNormalDevice(res)) {
			      while (true) {
			        console.error('error')
			      }
			    }
			},
			isNormalDevice(deviceInfo) {
				const normalPlatformList = ['ios','android','devtools']
			    return normalPlatformList.includes(deviceInfo.platform)
			},
			// 检查更新
			checkForUpdates () {
				const _this = this
				const updateManager = uni.getUpdateManager();
				console.log(updateManager)
				updateManager.onCheckForUpdate(function (res) {
				  // 请求完新版本信息的回调
				  console.log(res.hasUpdate); 
				});
				
				updateManager.onUpdateReady(function (res) {
				  uni.showModal({
					title: '更新提示',
					content: '新版本已经准备好，是否重启应用？',
					success(res) {
					  if (res.confirm) {
						// 新的版本已经下载好，调用 applyUpdate 应用新版本并重启
						updateManager.applyUpdate();
					  }
					}
				  });
				
				});
				
				updateManager.onUpdateFailed(function (res) {
				  // 新的版本下载失败
				});
			},
		}
	}
</script>

<style lang="scss"> 
	@import './static/css/style.css'; 
	/* 容器类 - 定义弹性容器 */
	.flex {
		display: flex;
	}
	
	.flex-inline {
		display: inline-flex;
	}
	
	/* 主轴方向 */
	.flex-row {
		flex-direction: row;
	}
	
	.flex-row-reverse {
		flex-direction: row-reverse;
	}
	
	.flex-column {
		flex-direction: column;
	}
	
	.flex-column-reverse {
		flex-direction: column-reverse;
	}
	
	/* 主轴对齐方式 */
	.justify-start {
		justify-content: flex-start;
	}
	
	.justify-end {
		justify-content: flex-end;
	}
	
	.justify-center {
		justify-content: center;
	}
	
	.justify-between {
		justify-content: space-between;
	}
	
	.justify-around {
		justify-content: space-around;
	}
	
	.justify-evenly {
		justify-content: space-evenly;
	}
	
	/* 交叉轴对齐方式 */
	.align-start {
		align-items: flex-start;
	}
	
	.align-end {
		align-items: flex-end;
	}
	
	.align-center {
		align-items: center;
	}
	
	.align-stretch {
		align-items: stretch;
	}
	
	.align-baseline {
		align-items: baseline;
	}
	
	/* 多行容器交叉轴对齐 */
	.align-content-start {
		align-content: flex-start;
	}
	
	.align-content-end {
		align-content: flex-end;
	}
	
	.align-content-center {
		align-content: center;
	}
	
	.align-content-between {
		align-content: space-between;
	}
	
	.align-content-around {
		align-content: space-around;
	}
	
	.align-content-stretch {
		align-content: stretch;
	}
	
	/* 换行 */
	.flex-nowrap {
		flex-wrap: nowrap;
	}
	
	.flex-wrap {
		flex-wrap: wrap;
	}
	
	.flex-wrap-reverse {
		flex-wrap: wrap-reverse;
	}
	
	/* 项目排序 */
	.order-first {
		order: -1;
	}
	
	.order-last {
		order: 999;
	}
	
	.order-0 { order: 0; }
	.order-1 { order: 1; }
	.order-2 { order: 2; }
	.order-3 { order: 3; }
	.order-4 { order: 4; }
	.order-5 { order: 5; }
	
	/* 项目扩展能力 */
	.flex-grow-0 {
		flex-grow: 0;
	}
	
	.flex-grow-1 {
		flex-grow: 1;
	}
	
	/* 项目收缩能力 */
	.flex-shrink-0 {
		flex-shrink: 0;
	}
	
	.flex-shrink-1 {
		flex-shrink: 1;
	}
	
	/* 项目初始大小 */
	.flex-basis-auto {
		flex-basis: auto;
	}
	
	.flex-basis-0 {
		flex-basis: 0;
	}
	
	/* 项目对齐方式 */
	.align-self-auto {
		align-self: auto;
	}
	
	.align-self-start {
		align-self: flex-start;
	}
	
	.align-self-end {
		align-self: flex-end;
	}
	
	.align-self-center {
		align-self: center;
	}
	
	.align-self-stretch {
		align-self: stretch;
	}
	
	.align-self-baseline {
		align-self: baseline;
	}
	
	/* 常用组合类 */
	.flex-center {
		display: flex;
		justify-content: center;
		align-items: center;
	}
	
	.flex-between {
		display: flex;
		justify-content: space-between;
		align-items: center;
	}
	
	.flex-around {
		display: flex;
		justify-content: space-around;
		align-items: center;
	}
	
	.flex-column-center {
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
	}
	.flex1{
		flex: 1
	}
	.padding15{
		padding: 15rpx;
	}
	.padding20{
		padding: 20rpx;
	}
	.padding25{
		padding: 25rpx;
	}
	.padding30{
		padding: 30rpx;
	}
	uni-tabbar.uni-tabbar-bottom .uni-tabbar {
		display: none;
	}
</style>
