<script>
	import config from 'common/config.js';
	import {
		mapMutations
	} from 'vuex'
	export default {

		methods: {
			...mapMutations(['onLuanchLogin', 'getBLEDeviceList', 'getFinalUseDevice']),

		},
		onLaunch: function() {
			console.log('App Launch');
			// 先判断 系统版本
			const _systemInfo = uni.getSystemInfoSync();
			// uni.getSystemInfo({
			// 	success: (res) => {
			// 		console.log("系统信息:", res);
			// 		this.$store.state.clientName = res.model;
			// 		this.$store.state.system = res.system;
			// 		this.$store.state.platform = res.platform;
			// 		this.$store.state.systemInfo = res;
			// 	},
			// 	fail: (err) => {},
			// 	complete: () => {}
			// })
			console.log("系统信息:", _systemInfo);
			this.$store.state.clientName = _systemInfo.model;
			this.$store.state.system = _systemInfo.system;
			this.$store.state.platform = _systemInfo.platform;
			this.$store.state.systemInfo = _systemInfo;
			//获取记录的最后一次连接
			this.getFinalUseDevice();
			//获取记录的蓝牙列表数据
			this.getBLEDeviceList();

			// #ifdef APP-PLUS
			plus.runtime.getProperty(plus.runtime.appid, (info) => {
				console.log("version:", info);
				this.$store.state.version = info.version;
				this.$store.state.versionCode = info.versionCode;
				this.$store.state.appName = info.name;
			});

			// 锁住屏幕正方向
			plus.screen.lockOrientation('portrait-primary');
			// 屏幕常亮
			// 下面这个打包要开启手机设置权限
			plus.device.setWakelock(true);
			// #endif

			// #ifdef MP
			//开始登陆
			this.onLuanchLogin({});
			// #endif
		},
		onShow: function() {
			console.log('App Show');
			// #ifdef APP-PLUS
			// 锁住屏幕正方向
			// plus.screen.lockOrientation('portrait-primary');
			// 屏幕常亮
			// plus.device.setWakelock(true);
			// 下面这个打包要开启手机设置权限
			// uni.setScreenBrightness({
			//     value: 0.8,
			//     success: function () {
			//         console.log('setScreenBrightness success');
			//     }
			// });
			// uni.setKeepScreenOn({
			// 	keepScreenOn: true,
			// 	success: function () {
			// 	    console.log('setKeepScreenOn success');
			// 	}
			// });
			// let self = this;
			// uni.getScreenBrightness({
			//     success: function (res) {
			//         console.log('屏幕亮度值：' + res.value);
			// 		self.Test = '=='+plus.device.isWakelock()+ '=getScreenBrightness success';
			// 		self.screenValue = res.value;
			//     }
			// });
			// #endif
		},
		onHide: function() {
			console.log('App Hide')
		}

	}
</script>

<style>
	/*每个页面公共css */
	// #ifndef APP-PLUS-NVUE
	@import "util/util-css/main.css";
	@import "util/util-css/icon.css";
	// #endif
</style>
