<script>
	import Vue from 'vue'
	import util from './utils/util';
	export default {
		onLaunch: function() {
			this.updateManager();

			wx?.onNeedPrivacyAuthorization?.((resolve, eventInfo) => {
				console.log('触发本次事件的接口是：' + eventInfo.referrer)
				// 需要用户同意隐私授权时
				// 弹出开发者自定义的隐私授权弹窗
				this.globalData.resolvePrivacyAuthorization = resolve;
				// resolve({ buttonId: 'agree-btn', event:'agree' })
				uni.navigateTo({ url: `/subpackage/common/pages/privacy`});
			})
		},
		methods: {	
			isLogin(){
				
        		return !!uni.getStorageSync('token');
			},
			updateManager(){
				const updateManager = uni.getUpdateManager();
				updateManager.onCheckForUpdate(res=>console.log('请求完新版本信息的回调-->',res.hasUpdate));
				updateManager.onUpdateReady(function () {
					util.showModal({
						title: '更新提示',
						content: '新版本已经准备好，请重启应用！',
						showCancel:false,
						confirmText:'重启',
						success:res=>updateManager.applyUpdate(),
					})
				});
				updateManager.onUpdateFailed(err=>console.log('版本更新失败——>',err));
			},
		}
	}
</script>

<style>
	/*每个页面公共css */
	page{
		background-color: #f2f2f7;
	}
	view,scroll-view,text,picker{
		box-sizing: border-box;
	}
	.ox-dark-mask{
		position: fixed;
		left: 0;
		top: var(--window-top);
		right: 0;
		bottom: 0;
		background-color: rgba(0, 0, 0, .5);
	}

	/* btn hover-class */ 
	.hover-active{
		position: relative;
		overflow: hidden;
	}

	.hover-active::after{
		content: '';
		position: absolute;
		left: 0;
		right: 0;
		top: 0;
		bottom: 0;
		z-index: 2;
		background-color: rgba(0,0,0,.1);
	}
	/* btn hover-class */ 
</style>
