<script>
	//#ifdef APP-PLUS
	var alog = uni.requireNativePlugin("AndroidLog")
	// var device = uni.requireNativePlugin("DeviceInfo")
	import update from '@/utils/update.js';
	import deviceUt from '@/utils/deviceUtils.js';
	import pushreg from '@/utils/pushUtils.js';
	//#endif
	export default {
		onLaunch: function() {
			//#ifdef APP-PLUS
			update(this); //软件更新
			deviceUt.devicereg(this);  //设备注册
			pushreg();  //推送注册
			//#endif
			//#ifdef H5
			  this.$u.api.deviceReg({
			  		deviceNo: '123456789',
			  		pushCid: '123456789'
			  	})
			  	.then(res => {
			  		if (res.code == 200) {
						uni.showToast({
							title: '设备注册成功',
							duration: 2000
						});
			  		} else {
						uni.showToast({
							title: '设备注册失败',
							duration: 2000
						});
			  		}
			  	}).catch(err => {
					uni.showToast({
						title: '设备注册失败',
						duration: 2000
					});
			  	});
			//#endif
		},
		onShow: function() {
			// console.log('App Show')

		},
		onHide: function() {
			// console.log('App Hide')
		}
	}
</script>

<style lang="scss">
	@import "uview-ui/index.scss";
	/*每个页面公共css */
</style>
