App.vue 1.9 KB
Newer Older
1
<script>
DCloud_JSON's avatar
DCloud_JSON 已提交
2 3
	import initApp from '@/common/appInit.js';
	import checkIsAgree from '@/uni_modules/uni-agree/utils/uni-agree.js';
4 5 6
	export default {
		globalData: {
			searchText: '',
DCloud_JSON's avatar
DCloud_JSON 已提交
7
			appVersion: {},
DCloud_JSON's avatar
DCloud_JSON 已提交
8
			config:{}
9 10
		},
		onLaunch: function() {
DCloud_JSON's avatar
DCloud_JSON 已提交
11 12 13 14
			console.log('App Launch')
			initApp();
			// #ifdef APP-PLUS
			//checkIsAgree(); 暂时先用默认生成的,自定义的等待原生支持后实现。因为启动vue界面时已经,请求了部分权限这并不符合国家的法规
15
			// #endif
16

17
			// #ifdef APP-PLUS
DCloud_JSON's avatar
DCloud_JSON 已提交
18
			//一键登录 功能预登录
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
			plus.oauth.getServices(oauthServices => {
				// console.log(oauthServices);
				oauthServices.forEach(({
					_id
				}, item) => {
					if (_id == 'provider') {
						uni.preLogin({
							provider: item,
							complete: e => {
								console.log(e);
							}
						})
					}
				})
				uni.preloadPage({
					url: "/pages/ucenter/login-page/index/index"
				});
			}, err => {
				console.error('获取服务供应商失败:' + JSON.stringify(err));
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
			})
			
			//idfa有需要的用户在应用首次启动时自己获取存储到storage中
			//https://ask.dcloud.net.cn/article/36107
			/*if(~plus.storage.getItem('idfa')){
				plus.device.getInfo({//需要勾选IDFA
					success:function(e){  
						console.log('idfa =  '+JSON.stringify(e.idfa));  
					},
					fail:function(e){
						console.log('getDeviceInfo failed: '+JSON.stringify(e));  
					}  
				});
			}*/
			// #endif
53 54 55 56 57 58 59 60 61 62 63 64
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style>
	/*每个页面公共css */
DCloud_JSON's avatar
DCloud_JSON 已提交
65
/* #ifndef APP-NVUE */
66 67 68 69 70 71 72 73 74 75 76 77 78 79
	view,
	scroll-view,
	text,
	image,
	switch,
	navigator,
	icons {
		display: flex;
		box-sizing: border-box;
		flex-direction: column;
	}
	scroll-view {
		-webkit-overflow-scrolling: touch;
	}
DCloud_JSON's avatar
DCloud_JSON 已提交
80 81
/* #endif */
</style>