<script>
	import $api from 'static/js/api.js';
	import $app from 'static/js/app.js';
	export default {
		onLaunch: function(options) {
			console.log('App Launch')
		},
		onShow: function() {
			// 自动更新管理-------------------------------------------------------------------
			const updateManager = uni.getUpdateManager();
			updateManager.onUpdateReady(function(res) {
				uni.showModal({
					title: '更新提示',
					content: '新版本已经准备好，是否重启应用？',
					success(res) {
						if (res.confirm) updateManager.applyUpdate();
					}
				});
			});
			updateManager.onUpdateFailed(function(res) {
				uni.showModal({
					title: '更新失败',
					content: '小程序已有新版本,请稍后重试更新!',
					showCancel: false
				});
			});

			// 自动登录用户-------------------------------------------------------------------
			const userInfo = $app.storage.get("USER_INFO");
			if (!userInfo) $api.login();
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style>
	/*每个页面公共css */
	@import "components/ax/ax.css";
	@import "static/css/app.css";
</style>