<script>
	var jpushModule = uni.requireNativePlugin("JG-JPush")
	export default {
		globalData: {  
			baseUrl: '',
			token: '',
			changeOrg:'',
			version: '', // 当前版本号
			buildType: 'uat', // 打包环境对应类型，pro 生产 uat 预发布 dev 本地开发
			envTips: '', // 环境文字提示
			theme: 'default', // 主题，default
			isIphoneXup: false //是否iphonex以及以上的版本
		},
		mounted() {
			// 非V3模式
			if (this.$scope) {
				this.$scope.globalData.token = this.$store.state.vuex_token;
				this.$scope.globalData.changeOrg = this.$store.state.vuex_changeOrg;
			} else {
				// V3模式
				getApp({ allowDefault: true }).globalData.token = this.$store.state.vuex_token;
				getApp({ allowDefault: true }).globalData.changeOrg = this.$store.state.vuex_changeOrg;
			}
			this.$config('init');
		},
		onLaunch: function() {
			console.log('App launch')
			// // 极光推送
			// if(uni.getSystemInfoSync().platform == "ios"){
			// 	// 请求定位权限
			// 	let locationServicesEnabled = jpushModule.locationServicesEnabled()
			// 	let locationAuthorizationStatus = jpushModule.getLocationAuthorizationStatus()
			// 	console.log('locationAuthorizationStatus',locationAuthorizationStatus)	
			// 	if (locationServicesEnabled == true && locationAuthorizationStatus < 3) {
			// 		jpushModule.requestLocationAuthorization((result)=>{
			// 			console.log('定位权限',result.status)
			// 		})
			// 	}
			// 	jpushModule.requestNotificationAuthorization((result)=>{
			// 		let status = result.status
			// 		if (status < 2) {
			// 			uni.showToast({
			// 				icon: 'none',
			// 				title: '您还没有打开通知权限',
			// 				duration: 3000
			// 			})
			// 		}
			// 	})
			// }
			// // 初始化
			// jpushModule.initJPushService();
			// jpushModule.setLoggerEnable(true);
			// jpushModule.addConnectEventListener(result=>{
			// 	let connectEnable = result.connectEnable
			// 	uni.$emit('connectStatusChange',connectEnable)
			// });
			
			// jpushModule.addNotificationListener(result=>{
			// 	let notificationEventType = result.notificationEventType
			// 	let messageID = result.messageID
			// 	let title = result.title
			// 	let content = result.content
			// 	let extras = result.extras
				
			// 	uni.showToast({
			// 		icon: 'none',
			// 		title: JSON.stringify(result),
			// 		duration: 3000
			// 	})
			// });
			
			// jpushModule.addCustomMessageListener(result=>{
			// 	let type = result.type
			// 	let messageType = result.messageType
			// 	let content = result.content
			// 	uni.showToast({
			// 		icon: 'none',
			// 		title: JSON.stringify(result),
			// 		duration: 3000
			// 	})
			// })
			
			// jpushModule.addLocalNotificationListener(result=>{
			// 	let messageID = result.messageID
			// 	let title = result.title
			// 	let content = result.content
			// 	let extras = result.extras
			// 	uni.showToast({
			// 		icon: 'none',
			// 		title: JSON.stringify(result),
			// 		duration: 3000
			// 	})
			// })
			
			// jpushModule.addGeofenceListener(result=>{
			// 	let code = result.code
			// 	let type = result.type
			// 	let geofenceId = result.geofenceId
			// 	let userInfo = result.userInfo
			// 	uni.showToast({
			// 		icon: 'none',
			// 		title: '触发地理围栏',
			// 		duration: 3000
			// 	})
			// })
			
			// jpushModule.setIsAllowedInMessagePop(true)
			// jpushModule.pullInMessage(result=>{
			// 	let code = result.code
			// 	console.log(code)
			// })
			
			// jpushModule.addInMessageListener(result=>{
			// 	let eventType = result.eventType
			// 	let messageType = result.messageType
			// 	let content = result.content
			// 	console.log('inMessageListener',eventType,messageType,content)
				
			// 	uni.showToast({
			// 		icon: 'none',
			// 		title: JSON.stringify(result),
			// 		duration: 3000
			// 	})
			// })
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		},
	}
</script>

<style lang="scss">
	@import "./static/iconfont/iconfont.css";
	@import "uview-ui/index.scss";
	/*每个页面公共css */
	page {
		width: 100%;
		min-height: 100%;
		display: flex;
		background-color: #F8F8F8;
	}
	/* 登录页是否记住密码多选框样式 */
	uni-checkbox.login-form-checkbox .uni-checkbox-input{
		width: 24upx !important;
		height: 24upx !important;
	}
	.status_bar {
	      height: var(--status-bar-height);
	      width: 100%;
	  }
	.isIPXup{
		padding-bottom: 64rpx !important;
	}
	/*  form表单样式 */
	.form-box{
		background-color: #fff;
		padding: 0 30rpx;
	}
	.form-input {
		font-size: 28rpx;
		color: #333;
		text-align: right;
		width: 95%;
		box-sizing: border-box;
		height: 60rpx;
		line-height: 60rpx;
		&.textarea{
			height: 240rpx;
			padding: 24rpx 0;
			text-align: left;
		}
	}
	
	.form-input-placeholder {
		font-size: 28rpx;
		color: #999;
	}
	.form-textarea{
		height: 240rpx;
		padding: 24rpx 0;
		text-align: left;
	}
	.form-number-input{
		margin: 0 auto;
	}
	.u-required{
		position: relative;
	}
	.u-required:before{
		content: '*';
		position: absolute;
		left: -8px;
		top: 10upx;
		font-size: 14px;
		color: #fa3534;
		height: 9px;
		line-height: 1;
	}
	/* 元素宽度 百分比 */
	.uni-col-1{
		box-sizing: border-box;
		width: 10%;
	}
	.uni-col-2{
		box-sizing: border-box;
		width: 20%;
	}
	.uni-col-3{
		box-sizing: border-box;
		width: 30%;
	}
	.uni-col-4{
		box-sizing: border-box;
		width: 40%;
	}
	.uni-col-5{
		box-sizing: border-box;
		width: 50%;
	}
	.uni-col-6{
		box-sizing: border-box;
		width: 60%;
	}
	.uni-col-7{
		box-sizing: border-box;
		width: 70%;
	}
	.uni-col-8{
		box-sizing: border-box;
		width: 80%;
	}
	.uni-col-9{
		box-sizing: border-box;
		width: 90%;
	}
	.uni-col-10{
		box-sizing: border-box;
		width: 100%;
	}
	
	/* felx布局 */
	.flex{
		display: -webkit-flex; /* Chrome 21+, Safari 6.1+, iOS Safari 7+, Opera 15/16 */  
		display: -moz-flex; /* Firefox 18+ */  
		display: -ms-flexbox; /* IE 10 */  
		display: flex; /* Chrome 29+, Firefox 22+, IE 11+, Opera 12.1/17/18, Android 4.4+ */
	}
	/*伸缩流方向*/
	.flex_column{
	    -webkit-box-orient: vertical;
	    -ms-flex-direction: column;
	    -webkit-flex-direction: column;
	    flex-direction: column;
	}
	/*主轴对齐*/
	.justify_center{
	    -webkit-box-pack: center;
	    -ms-flex-pack: center;
	    -webkit-justify-content: center;
	    justify-content: center;
	}
	.justify_end{
	    -webkit-box-pack: end;
	    -ms-flex-pack: end;
	    -webkit-justify-content: flex-end;
	    justify-content: flex-end;
	}
	.justify_between{
	    -webkit-box-pack: justify;
	    -ms-flex-pack: justify;
	    -webkit-justify-content: space-between;
	    justify-content: space-between;
	}
	/*侧轴对齐*/
	.align_start{
	    -webkit-box-align: start;
	    -ms-flex-align: start;
	    -webkit-align-items: flex-start;
	    align-items: flex-start;
	}
	.align_end{
	    -webkit-box-align: end;
	    -ms-flex-align: end;
	    -webkit-align-items: flex-end;
	    align-items: flex-end;
	}
	.align_center{
	    -webkit-box-align: center;
	    -ms-flex-align: center;
	    -webkit-align-items: center;
	    align-items: center;
	}
	.align_baseline{
	    -webkit-box-align: baseline;
	    -ms-flex-align: baseline;
	    -webkit-align-items: baseline;
	    align-items: baseline;
	}
	/*伸缩性*/
	.flex_auto{
	    -webkit-box-flex: 1;
	    -ms-flex: auto;
	    -webkit-flex: auto;
	    flex: auto;
	}
	.flex_1{
	    -webkit-box-flex: 1;
	    -ms-flex: 1;
	    -webkit-flex: 1;
	    flex: 1;    
	}
	// ios15原生input的type=search时会默认自带搜索图标。
	// 在全局的公共样式隐藏ios自带搜索图标即可
	[type="search"]::-webkit-search-decoration {
		display: none;
	}
	uni-toast {
		z-index: 1000000;
	}
</style>
