Kaynağa Gözat

1. 2.1.4版本 ,版本号:21012601。
2. 调整了ios 适配提示。增加了ios 跳转设置页面

apple 5 yıl önce
ebeveyn
işleme
97631907ab

+ 3 - 3
common/config.js

@@ -1,12 +1,12 @@
 //设置游戏列表的更新时间,超过这个时间,不显示出来
 //"2020-07-14"
-const endTime = "2021-01-25"
+const endTime = "2021-01-26"
 
 
 //线上地址,腾讯云服务器
-// const host="https://www.9527fun.cn/api_prd"
+const host="https://www.9527fun.cn/api_prd"
 //测试地址,阿里云服务器
-const host="https://www.9527fun.cn/api_dev"
+// const host="https://www.9527fun.cn/api_dev"
 //本地测试地址
 // const host = "http://192.168.0.112:9090/api_dev"
 // const host = "http://47.104.216.192:9090/api_dev"

+ 2 - 2
manifest.json

@@ -2,8 +2,8 @@
     "name" : "哔蹦",
     "appid" : "__UNI__2635DF5",
     "description" : "",
-    "versionName" : "2.1.3",
-    "versionCode" : 21012502,
+    "versionName" : "2.1.4",
+    "versionCode" : 21012601,
     "transformPx" : false,
     /* 5+App特有相关 */
     "app-plus" : {

+ 741 - 728
pages/personal-page/devices-hardware/devices-hardware.vue

@@ -1,731 +1,744 @@
-<template>
-	<view>
-		<uni-nav-bar id="nav-bar" status-bar="true" @clickLeft="onBack()" @clickRight="onNavUpdateDevice()" title="选择设备类型"
-		 color="#000000" fixed="true" :border="false">
-			<view slot="left">
-				<view class=" flex align-center margin-left">
-					<image class="p-left-arrow" src="../../../static/p-left-arrow.png"></image>
-				</view>
-			</view>
-			<view slot="right">
-				<view class=" flex align-center " style="margin-right: 10rpx;">
-					<image style="width: 60rpx;height: 50rpx;" src="../../../static/devicesIconSimple/upgrade.png"></image>
-				</view>
-			</view>
-		</uni-nav-bar>
-		<view class="card-view padding-top padding-bottom" v-for="(item,index) in devicesList" :key="index" :class="item.bRatio?'hardware-border':''">
-			<view class="flex justify-between align-center">
-				<view class="flex justify-start align-center">
-					<image style="margin-left: 30rpx; width: 200rpx;height: 120rpx;" :src="item.icon" mode="aspectFit"></image>
-					<view>
-						<view style="margin: 20rpx 50rpx; font-weight: bold; font-size: 18px; color: #565656;">{{item.cname}}</view>
-						<view style="margin-left: 50rpx; font-size: 12px;" class="make-text-bPurple">{{item.describe}}</view>
-					</view>
-
-				</view>
-				<image style="margin-right: 60rpx; width: 60rpx;height: 60rpx;" :src="item.bRatio?'/static/devicesOther/radio-b.png':'/static/devicesOther/radio-g.png'"
-				 mode="aspectFit" @tap="_onRadio(item,$event)"></image>
-			</view>
-		</view>
-
-	</view>
-
-
-</template>
-
-<script>
-	import config from '@/common/config.js'
-	import reqUtil from '@/util/util-js/requstUtil.js';
-
-	import {
-		mapState,
-		mapMutations
-	} from 'vuex';
-
-	export default {
-		computed: mapState(['bOpenBluetooth', 'bOpenSuccess', 'bListenAdapterStateChange', 'bListenDeviceFound',
-			'BLEConnectDevice', 'BLEGetServices', 'cIndex', 'bConnection', 'bVerifiedConnection', 'BLEInfoList',
-			'BLEDeviceShowList', 'finallyUseDevice'
-		]),
-		data() {
-			return {
-				// 设备列表
-				devicesList: [],
-				currentItem: null,
-				//设置一个旧的连接item
-				oldItem: null,
-				searchObj: null,
-				//设置搜索超时时间
-				searchTimeOut: null,
-				option: null,
-				saveObj: null,
-				//搜索提示定时器
-				searchMac: null,
-				//
-				getServicesTimeout: null,
-				writeMacTimeout: null,
-				//限制关闭连接
-				bLimitClose: false,
-				
-				//是否需要检测发起的连接蓝牙是否匹配上
-				bTestBondConnect:true
-			}
-		},
-		onLoad(op) {
-			// if (op.deviceType) {
-			// 	console.log(op);
-			// 	this.option = op;
-			// }
-			//目前是固定这个值,去掉了一级页面
-			this.option = {
-				cname: "手柄盒子",
-				deviceType: 'BLEHandle'
-			};
-			if (this.option.deviceType == 'BLEHandle') {
-				this.BLEInfoList.forEach((item, index, selfarr) => {
-					if (item.deviceType == 'BLEHandle') {
-						let item = Object.assign({}, selfarr[index]);
-						this.devicesList.push(item);
-					}
-				})
-			}
-			uni.$on('callbackCloseBLE', this.hardCallbackCloseBLE);
-			uni.$on('listenerBLE', this.onListenerBLE);
-
-		},
-		onUnload() {
-			uni.$off('callbackCloseBLE', this.hardCallbackCloseBLE);
-			uni.$off('listenerBLE', this.onListenerBLE);
-
-			//清除定时器
-			this.onClearTimeout();
-		},
-		onShow() {
-
-			this.bLimitClose = false;
-			console.log(this.cIndex, this.BLEDeviceShowList, this.BLEConnectDevice,this.devicesList);
-			//this.bConnection &&
-			if (this.bVerifiedConnection && this.BLEConnectDevice) {
-				for (let i = 0; i < this.devicesList.length; i++) {
-					let eq = this.devicesList[i];
-					if (
-						(eq.ename.indexOf("mobilePhoneBandage") > -1 && this.BLEConnectDevice.id == 0) ||
-						(eq.ename.indexOf("hotman") > -1 && this.BLEConnectDevice.id == 1) ||
-						(eq.ename.indexOf("BLEHandle") > -1 && this.BLEConnectDevice.id == 2)) {
-						eq.bRatio = true;
-						this.currentItem = eq;
-						
-						this.onCheckBondDevice();
-					}
-				}
-			} else {
-				//如果没连接的话,设置一下显示状态
-				for (let i = 0; i < this.devicesList.length; i++) {
-					let eq = this.devicesList[i];
-					eq.bRatio = false;
-				}
-				// this.currentItem = null;
-			}
-
-
-		},
-		onHide() {},
-		methods: {
-			...mapMutations(['initAdapter', 'onCreateBLESuccess', 'onGetBLEDeviceServices', 'onOnlyCloseBLEConnection',
-				'onGetRSSITransDistance',
-				'addBLEDevice', 'onWriteBLEConnectionValue', 'deleteBLEDevice' ,'B_GetBondedDevices','B_OpenBLESetting'
-			]),
-			//
-			onClearTimeout() {
-				// 退出后,清除计时器
-				if (this.searchMac) {
-					clearTimeout(this.searchMac);
-					this.searchMac = null;
-				}
-				//servicesTimeout
-				if (this.getServicesTimeout) {
-					clearTimeout(this.getServicesTimeout);
-					this.getServicesTimeout = null;
-				}
-				//写入指令writeMacTimeout
-				if (this.writeMacTimeout) {
-					clearTimeout(this.writeMacTimeout);
-					this.writeMacTimeout = null;
-				}
-
-				if (this.searchTimeOut) {
-					clearTimeout(this.searchTimeOut);
-					this.searchTimeOut = null;
-				}
-			},
-			//监听回调
-			onListenerBLE(res) {
-				console.log('onListenerBLE:', res);
-				if (res.type !== 'mac') return;
-				//如果mac 回调了不用提示
-				if (this.searchMac) {
-					clearTimeout(this.searchMac);
-					this.searchMac = null;
-				}
-				let _self = this;
-				let mac = res.value;
-				console.log('mac =====', mac);
-				//用返回的mac 判断,如果非法,则断开连接
-				//就判断一下是否
-				//测试
-				// mac="BB:34:24:22:77:88";
-
-				reqUtil.requestData(config.URL.BLEFINDHASBIND, {
-					mac: mac,
-				}).then(
-					res => {
-						console.log('BLEFINDHASBIND:', res);
-						if (res.code == 0) {
-							//code = 0 是新的地址,没绑定过
-							//绑定设备使用者
-							reqUtil.requestData(config.URL.BLEBIND, {
-								mac: mac,
-							}).then(
-								res => {
-									// console.log('BLEBIND:', res);
-									if (res.code == 0) {
-										//绑定成功,添加设备
-										if (_self.saveObj == null) return;
-										_self.addBLEDevice(_self.saveObj);
-										_self.ConnectionSuccess();
-									}
-								},
-								e => {
-									console.log(e);
-									//绑定失败, 关闭当前连接
-									_self.onOnlyCloseBLEConnection({
-										getSuccess: () => {
-											_self.currentItem.bRatio = false;
-											_self.currentItem = null;
-											_self.saveObj = null;
-										}
-									});
-								}
-							);
-
-						} else if (res.code == 721) {
-							//是自己绑定的,添加设备
-							if (_self.saveObj == null) return;
-							_self.addBLEDevice(_self.saveObj);
-							_self.ConnectionSuccess();
-
-
-						} else if (res.code == 711 || res.code == 722) {
-							//res.code = 711  蓝牙设备不是我们自己的
-							//res.code = 722  蓝牙设备别人使用过
-							uni.hideToast();
-							uni.showModal({
-								title: '绑定蓝牙失败',
-								content: res.msg + ',可重新尝试连接。如有疑问请联系官方客服。'
-							})
-							//关闭当前连接
-							_self.onOnlyCloseBLEConnection({
-								getSuccess: () => {
-									_self.currentItem = null;
-									_self.saveObj = null;
-								}
-							});
-						}
-					},
-					e => {
-						console.log(e);
-					}
-				);
-			},
-			ConnectionSuccess() {
-				// console.log(this.cIndex, this.BLEDeviceShowList, this.BLEConnectDevice);
-				uni.showToast({
-					icon: "none",
-					title: "连接设备成功!",
-					duration: 2000
-				})
-				for (let i = 0; i < this.devicesList.length; i++) {
-					let eq = this.devicesList[i];
-					if (
-						(eq.ename.indexOf("mobilePhoneBandage") > -1 && this.BLEConnectDevice.id == 0) ||
-						(eq.ename.indexOf("hotman") > -1 && this.BLEConnectDevice.id == 1) ||
-						(eq.ename.indexOf("BLEHandle") > -1 && this.BLEConnectDevice.id == 2)) {
-
-						eq.bRatio = true;
-						this.currentItem = eq;
-						/**
-						 * 已验证的连接设置true
-						 */
-						this.$store.state.bVerifiedConnection = true;
-						
-						this.onCheckBondDevice();
-					}
-				}
-			},
-			onCheckBondDevice(){
-				if(this.bTestBondConnect){
-					/**
-					 * 假如手机没有匹配,断开连接
-					 */
-					this.B_GetBondedDevices({success:(bondedDevice)=>{
-						if(bondedDevice == null ){
-							//此问题 华为手机容易出现
-							//android手机已配对的设备 不存在,但是app 又直接连接成功了。提示,并且断开app连接
-							//1.关闭当前连接
-							this.onOnlyCloseBLEConnection({
-								getSuccess: () => {
-									this.currentItem.bRatio = false;
-									this.currentItem = null;
-									this.saveObj = null;
-								}
-							});
-							//2.跳转蓝牙设置
-							uni.showModal({
-								title:'蓝牙提示',
-								content:'1.请在弹出框点击确定匹配蓝牙。\r\n2.如没有提示框,重新刷新手机蓝牙,是否跳转手机蓝牙页面?',
-								success: (res) => {
-									if(res.confirm){
-										this.B_OpenBLESetting();
-									}
-								}
-							})
-						}
-					}});
-					this.bTestBondConnect = false;
-				}
-			},
-			hardCallbackCloseBLE() {
-				//如果限制不走重连
-				if (this.bLimitClose) return;
-
-				console.log(this.currentItem, this.oldItem);
-				if (this.oldItem && this.currentItem && this.currentItem.id == this.oldItem.id) {
-					// this.$store.state.bConnection = false;
-					if (this.currentItem.bRatio) {
-						uni.showToast({
-							title: '设备断开连接!',
-							icon: 'none',
-							duration: 2000,
-							mask: true
-						})
-						this.currentItem.bRatio = false;
-						this.oldItem = null;
-						this.currentItem = null;
-						//断开连接
-						this.$store.state.bVerifiedConnection = false;
-					}
-				} else if (this.bConnection && this.BLEConnectDevice) {
-					//假如匹配过程中断开连接
-					this.$store.state.BLEConnectDevice = null;
-					this.$store.state.bConnection = false;
-					// uni.hideToast();
-					// console.log("//假如匹配过程中断开连接");
-					uni.showToast({
-						title:'连接失败,请检查设备是否正常。',
-						icon:'none',
-						mask:true,
-						duration:2000
-					})
-					if (this.getServicesTimeout) {
-						clearTimeout(this.getServicesTimeout);
-						this.getServicesTimeout = null;
-					}
-				}
-
-			},
-			/**
-			 * 开始查找设备
-			 * */
-			startBluetoothDeviceDiscovery() {
-				//在页面显示的时候判断是都已经初始化完成蓝牙适配器若成功,则开始查找设备
-				let _self = this;
-				if (_self.bOpenBluetooth) {
-					
-					//先查询最近使用的硬件,如果最近使用的和当前需要连接的item id一样,则认为是
-					if (_self.finallyUseDevice !== null) {
-						if (_self.finallyUseDevice.id == _self.currentItem.id) {
-							//currentItem 是mode 页面选中的item
-							let obj = Object.assign({}, _self.finallyUseDevice, _self.currentItem);
-							//finallyUserDevice 就是最后一次使用搜索到的设备信息
-							_self.saveObj = _self.finallyUseDevice;
-							uni.showToast({
-								title: '设备连接中...',
-								icon: 'loading',
-								duration: 12000,
-								mask: true
-							})
-							// 先直连,然后判断版本
-							_self._onConnectDevice(obj);
-						} else {
-
-							uni.showModal({
-								title: '连接提示!',
-								content: "1.确定则连接最近使用的设备。\r\n2.取消则重新搜索设备。",
-								success: (res) => {
-									if (res.confirm) {
-										//currentItem 是mode 页面选中的item
-										let obj = Object.assign({}, _self.finallyUseDevice, _self.currentItem);
-										//finallyUserDevice 就是最后一次使用搜索到的设备信息
-										_self.saveObj = Object.assign({}, _self.finallyUseDevice, {
-											id: _self.currentItem.id
-										});
-										uni.showToast({
-											title: '设备连接中...',
-											icon: 'loading',
-											duration: 12000,
-											mask: true
-										})
-										console.log("_onConnectDevice:::===", obj);
-										// 先直连,然后判断版本
-										_self._onConnectDevice(obj);
-									} else if (res.cancel) {
-										_self.onBondedDeviceConnect();
-									}
-								}
-							})
-
-						}
-					}else{
-						_self.onBondedDeviceConnect();
-					}
-					
-				} else {
-					_self.initAdapter(() => {
-						_self.startBluetoothDeviceDiscovery();
-					});
-				}
-			},
-			/**
-			 * 通过检测手机连接的设备进行连接,null 的话进行搜索操作
-			 */
-			onBondedDeviceConnect(){
-				let _self = this;
-				// _self.onCanStart();
-				
-				//获取手机本身已连接的硬件,
-				//示例
-				// {
-				// 	"deviceId": "C5:5C:19:04:00:30",
-				// 	"name": "BGBox_202012",
-				// 	"RSSI": -74,
-				// 	"localName": "BGBox_20201",
-				// 	"advertisServiceUUIDs": ["00001812-0000-1000-8000-00805F9B34FB", "0000FFF0-0000-1000-8000-00805F9B34FB"]
-				// }
-				_self.B_GetBondedDevices({success:(bondedDevice)=>{
-					//获取已和蓝牙连接的设备
-					if(bondedDevice != null){
-						//如果用户匹配了对应的设备,直接用对应的设备来连接
-						let setDevice = {
-							"deviceId": bondedDevice.address,
-							"name": bondedDevice.name,
-							"RSSI": -74,
-							"localName": "",
-							"advertisServiceUUIDs": ["00001812-0000-1000-8000-00805F9B34FB", "0000FFF0-0000-1000-8000-00805F9B34FB"]
-						}
-						
-						let obj = Object.assign({}, setDevice, _self.currentItem);
-						//finallyUserDevice 就是最后一次使用搜索到的设备信息
-						_self.saveObj = Object.assign({}, setDevice, {
-							id: _self.currentItem.id
-						});
-						uni.showToast({
-							title: '设备连接中...',
-							icon: 'loading',
-							duration: 12000,
-							mask: true
-						})
-						console.log("B_GetBondedDevices:::===", obj);
-						// 先直连,然后判断版本
-						_self._onConnectDevice(obj);
-						
-						//getBond后发起的连接,不需要检测了
-						_self.bTestBondConnect = false;
-					}else{
-						_self.onCanStart();
-					}
-				}});
-			},
-			//开始搜索
-			onCanStart() {
-				let _self = this;
-				uni.showToast({
-					title: '设备连接中...',
-					icon: 'loading',
-					duration: 12000,
-					mask: true
-				})
-				// 1.已经搜索到的,根据蓝牙回调的mac 地址判断合法性。
-				uni.startBluetoothDevicesDiscovery({
-					allowDuplicatesKey: true,
-					success: res => {
-						console.log("startBluetoothDevicesDiscovery:", res);
-						_self.onBluetoothDeviceFound();
-					},
-					fail: res => {
-						console.log("搜索失败!");
-						_self.initAdapter(() => {
-							_self.startBluetoothDeviceDiscovery();
-						});
-					}
-				});
-				// 2.没有搜索到的,一段时间后处理。比如手机已经连接了设备,但是app 里面搜索不到,也没记录使用过的。
-				if (_self.searchTimeOut) {
-					clearTimeout(_self.searchTimeOut);
-					_self.searchTimeOut = null;
-				}
-				_self.searchTimeOut = setTimeout(() => {
-					//1.搜索12秒钟之后,停止搜索
-					_self.stopBluetoothDevicesDiscovery();
-					uni.showModal({
-						title: '搜索失败',
-						content: '1.请开启设备。\r\n2.或者断开手机蓝牙页面连接的手柄。\r\n待蓝色设备灯闪烁,再重新搜索连接。'
-					})
-				}, 12000)
-			},
-			/**
-			 * 停止搜索蓝牙设备
-			 */
-			stopBluetoothDevicesDiscovery() {
-				uni.stopBluetoothDevicesDiscovery({
-					success: e => {
-						console.log('停止搜索蓝牙设备:' + e.errMsg);
-					},
-					fail: e => {
-						console.log('停止搜索蓝牙设备失败,错误码:' + e.errCode);
-					}
-				});
-			},
-			/**
-			 * 发现外围设备
-			 */
-			onBluetoothDeviceFound() {
-				let _self = this;
-				_self.searchObj = null;
-				uni.onBluetoothDeviceFound(res => {
-					/**
-					 * 获取在蓝牙模块生效期间所有已发现的蓝牙设备。包括已经和本机处于连接状态的设备。
-					 */
-					// console.log("onBluetoothDeviceFound:", res);
-					res.devices.forEach(device => {
-						if (device.name.indexOf('PBox') > -1 || device.name.indexOf('BGBox') > -1) {
-							//如果搜索的设备名 不是对应当前设备类型,过滤
-							// if (device.name.indexOf(_self.currentItem.deviceName) == -1) return;
-							if (_self.currentItem.deviceName.indexOf('PBox') == -1 && _self.currentItem.deviceName.indexOf('BGBox') == -
-								1) return;
-							//寻找到对应设备时候,其余的返回
-							if (_self.searchObj) return;
-							_self.searchObj = device;
-							if (_self.searchTimeOut) {
-								clearTimeout(_self.searchTimeOut);
-								_self.searchTimeOut = null;
-							}
-							//currentItem 是mode 页面选中的item
-							let obj = Object.assign({}, device, _self.currentItem);
-							
-							_self.saveObj = Object.assign({}, {
-								id: _self.currentItem.id
-							}, device);
-
-							console.log(device,"****", obj, _self.saveObj, _self.currentItem)
-							// 先直连,然后判断版本
-							_self._onConnectDevice(obj);
-							_self.stopBluetoothDevicesDiscovery();
-						}
-					})
-
-				})
-			},
-
-			onBack() {
-				uni.navigateBack({
-					delta: 1
-				})
-			},
-
-			// 提示点击连接设备
-			_onConnectDevice(item) {
-				//servicesTimeout
-				if (this.getServicesTimeout) {
-					clearTimeout(this.getServicesTimeout);
-					this.getServicesTimeout = null;
-				}
-				//写入指令writeMacTimeout
-				if (this.writeMacTimeout) {
-					clearTimeout(this.writeMacTimeout);
-					this.writeMacTimeout = null;
-				}
-				//如果已经连接,加上服务不存在,直接获取服务
-				if (this.bConnection && this.BLEGetServices && this.BLEGetServices.length == 0) {
-					console.log("***直接获取服务*******");
-					this.onGetBLEDeviceServices({
-						item: item,
+<template>
+	<view>
+		<uni-nav-bar id="nav-bar" status-bar="true" @clickLeft="onBack()" @clickRight="onNavUpdateDevice()" title="选择设备类型"
+		 color="#000000" fixed="true" :border="false">
+			<view slot="left">
+				<view class=" flex align-center margin-left">
+					<image class="p-left-arrow" src="../../../static/p-left-arrow.png"></image>
+				</view>
+			</view>
+			<view slot="right">
+				<view class=" flex align-center " style="margin-right: 10rpx;">
+					<image style="width: 60rpx;height: 50rpx;" src="../../../static/devicesIconSimple/upgrade.png"></image>
+				</view>
+			</view>
+		</uni-nav-bar>
+		<view class="card-view padding-top padding-bottom" v-for="(item,index) in devicesList" :key="index" :class="item.bRatio?'hardware-border':''">
+			<view class="flex justify-between align-center">
+				<view class="flex justify-start align-center">
+					<image style="margin-left: 30rpx; width: 200rpx;height: 120rpx;" :src="item.icon" mode="aspectFit"></image>
+					<view>
+						<view style="margin: 20rpx 50rpx; font-weight: bold; font-size: 18px; color: #565656;">{{item.cname}}</view>
+						<view style="margin-left: 50rpx; font-size: 12px;" class="make-text-bPurple">{{item.describe}}</view>
+					</view>
+
+				</view>
+				<image style="margin-right: 60rpx; width: 60rpx;height: 60rpx;" :src="item.bRatio?'/static/devicesOther/radio-b.png':'/static/devicesOther/radio-g.png'"
+				 mode="aspectFit" @tap="_onRadio(item,$event)"></image>
+			</view>
+		</view>
+
+	</view>
+
+
+</template>
+
+<script>
+	import config from '@/common/config.js'
+	import reqUtil from '@/util/util-js/requstUtil.js';
+
+	import {
+		mapState,
+		mapMutations
+	} from 'vuex';
+
+	export default {
+		computed: mapState(['bOpenBluetooth', 'bOpenSuccess', 'bListenAdapterStateChange', 'bListenDeviceFound',
+			'BLEConnectDevice', 'BLEGetServices', 'cIndex', 'bConnection', 'bVerifiedConnection', 'BLEInfoList',
+			'BLEDeviceShowList', 'finallyUseDevice'
+		]),
+		data() {
+			return {
+				// 设备列表
+				devicesList: [],
+				currentItem: null,
+				//设置一个旧的连接item
+				oldItem: null,
+				searchObj: null,
+				//设置搜索超时时间
+				searchTimeOut: null,
+				option: null,
+				saveObj: null,
+				//搜索提示定时器
+				searchMac: null,
+				//
+				getServicesTimeout: null,
+				writeMacTimeout: null,
+				//限制关闭连接
+				bLimitClose: false,
+
+				//是否需要检测发起的连接蓝牙是否匹配上
+				bTestBondConnect: true
+			}
+		},
+		onLoad(op) {
+			// if (op.deviceType) {
+			// 	console.log(op);
+			// 	this.option = op;
+			// }
+			//目前是固定这个值,去掉了一级页面
+			this.option = {
+				cname: "手柄盒子",
+				deviceType: 'BLEHandle'
+			};
+			if (this.option.deviceType == 'BLEHandle') {
+				this.BLEInfoList.forEach((item, index, selfarr) => {
+					if (item.deviceType == 'BLEHandle') {
+						let item = Object.assign({}, selfarr[index]);
+						this.devicesList.push(item);
+					}
+				})
+			}
+			uni.$on('callbackCloseBLE', this.hardCallbackCloseBLE);
+			uni.$on('listenerBLE', this.onListenerBLE);
+
+		},
+		onUnload() {
+			uni.$off('callbackCloseBLE', this.hardCallbackCloseBLE);
+			uni.$off('listenerBLE', this.onListenerBLE);
+
+			//清除定时器
+			this.onClearTimeout();
+		},
+		onShow() {
+
+			this.bLimitClose = false;
+			console.log(this.cIndex, this.BLEDeviceShowList, this.BLEConnectDevice, this.devicesList);
+			//this.bConnection &&
+			if (this.bVerifiedConnection && this.BLEConnectDevice) {
+				for (let i = 0; i < this.devicesList.length; i++) {
+					let eq = this.devicesList[i];
+					if (
+						(eq.ename.indexOf("mobilePhoneBandage") > -1 && this.BLEConnectDevice.id == 0) ||
+						(eq.ename.indexOf("hotman") > -1 && this.BLEConnectDevice.id == 1) ||
+						(eq.ename.indexOf("BLEHandle") > -1 && this.BLEConnectDevice.id == 2)) {
+						eq.bRatio = true;
+						this.currentItem = eq;
+
+						this.onCheckBondDevice();
+					}
+				}
+			} else {
+				//如果没连接的话,设置一下显示状态
+				for (let i = 0; i < this.devicesList.length; i++) {
+					let eq = this.devicesList[i];
+					eq.bRatio = false;
+				}
+				// this.currentItem = null;
+			}
+
+
+		},
+		onHide() {},
+		methods: {
+			...mapMutations(['initAdapter', 'onCreateBLESuccess', 'onGetBLEDeviceServices', 'onOnlyCloseBLEConnection',
+				'onGetRSSITransDistance',
+				'addBLEDevice', 'onWriteBLEConnectionValue', 'deleteBLEDevice', 'B_GetBondedDevices', 'B_OpenBLESetting'
+			]),
+			//
+			onClearTimeout() {
+				// 退出后,清除计时器
+				if (this.searchMac) {
+					clearTimeout(this.searchMac);
+					this.searchMac = null;
+				}
+				//servicesTimeout
+				if (this.getServicesTimeout) {
+					clearTimeout(this.getServicesTimeout);
+					this.getServicesTimeout = null;
+				}
+				//写入指令writeMacTimeout
+				if (this.writeMacTimeout) {
+					clearTimeout(this.writeMacTimeout);
+					this.writeMacTimeout = null;
+				}
+
+				if (this.searchTimeOut) {
+					clearTimeout(this.searchTimeOut);
+					this.searchTimeOut = null;
+				}
+			},
+			//监听回调
+			onListenerBLE(res) {
+				console.log('onListenerBLE:', res);
+				if (res.type !== 'mac') return;
+				//如果mac 回调了不用提示
+				if (this.searchMac) {
+					clearTimeout(this.searchMac);
+					this.searchMac = null;
+				}
+				let _self = this;
+				let mac = res.value;
+				console.log('mac =====', mac);
+				//用返回的mac 判断,如果非法,则断开连接
+				//就判断一下是否
+				//测试
+				// mac="BB:34:24:22:77:88";
+
+				reqUtil.requestData(config.URL.BLEFINDHASBIND, {
+					mac: mac,
+				}).then(
+					res => {
+						console.log('BLEFINDHASBIND:', res);
+						if (res.code == 0) {
+							//code = 0 是新的地址,没绑定过
+							//绑定设备使用者
+							reqUtil.requestData(config.URL.BLEBIND, {
+								mac: mac,
+							}).then(
+								res => {
+									// console.log('BLEBIND:', res);
+									if (res.code == 0) {
+										//绑定成功,添加设备
+										if (_self.saveObj == null) return;
+										_self.addBLEDevice(_self.saveObj);
+										_self.ConnectionSuccess();
+									}
+								},
+								e => {
+									console.log(e);
+									//绑定失败, 关闭当前连接
+									_self.onOnlyCloseBLEConnection({
+										getSuccess: () => {
+											_self.currentItem.bRatio = false;
+											_self.currentItem = null;
+											_self.saveObj = null;
+										}
+									});
+								}
+							);
+
+						} else if (res.code == 721) {
+							//是自己绑定的,添加设备
+							if (_self.saveObj == null) return;
+							_self.addBLEDevice(_self.saveObj);
+							_self.ConnectionSuccess();
+
+
+						} else if (res.code == 711 || res.code == 722) {
+							//res.code = 711  蓝牙设备不是我们自己的
+							//res.code = 722  蓝牙设备别人使用过
+							uni.hideToast();
+							uni.showModal({
+								title: '绑定蓝牙失败',
+								content: res.msg + ',可重新尝试连接。如有疑问请联系官方客服。'
+							})
+							//关闭当前连接
+							_self.onOnlyCloseBLEConnection({
+								getSuccess: () => {
+									_self.currentItem = null;
+									_self.saveObj = null;
+								}
+							});
+						}
+					},
+					e => {
+						console.log(e);
+					}
+				);
+			},
+			ConnectionSuccess() {
+				// console.log(this.cIndex, this.BLEDeviceShowList, this.BLEConnectDevice);
+				uni.showToast({
+					icon: "none",
+					title: "连接设备成功!",
+					duration: 2000
+				})
+				for (let i = 0; i < this.devicesList.length; i++) {
+					let eq = this.devicesList[i];
+					if (
+						(eq.ename.indexOf("mobilePhoneBandage") > -1 && this.BLEConnectDevice.id == 0) ||
+						(eq.ename.indexOf("hotman") > -1 && this.BLEConnectDevice.id == 1) ||
+						(eq.ename.indexOf("BLEHandle") > -1 && this.BLEConnectDevice.id == 2)) {
+
+						eq.bRatio = true;
+						this.currentItem = eq;
+						/**
+						 * 已验证的连接设置true
+						 */
+						this.$store.state.bVerifiedConnection = true;
+
+						this.onCheckBondDevice();
+					}
+				}
+			},
+			onCheckBondDevice() {
+				if (this.bTestBondConnect) {
+					/**
+					 * 假如手机没有匹配,断开连接
+					 */
+					this.B_GetBondedDevices({
+						success: (bondedDevice) => {
+							if (bondedDevice == null) {
+								//这里只处理android 的情况,ios暂未实现相关功能,一定返回null
+								if (plus.os.name == 'Android') {
+									//此问题 华为手机容易出现
+									//android手机已配对的设备 不存在,但是app 又直接连接成功了。提示,并且断开app连接
+									//1.关闭当前连接
+									this.onOnlyCloseBLEConnection({
+										getSuccess: () => {
+											this.currentItem.bRatio = false;
+											this.currentItem = null;
+											this.saveObj = null;
+										}
+									});
+									//2.跳转蓝牙设置
+									uni.showModal({
+										title: '蓝牙提示',
+										content: '1.请在弹出框点击确定匹配蓝牙。\r\n2.如没有提示框,重新刷新手机蓝牙,是否跳转手机蓝牙页面?',
+										success: (res) => {
+											if (res.confirm) {
+												this.B_OpenBLESetting();
+											}
+										}
+									})
+								}
+
+							}
+						}
+					});
+					this.bTestBondConnect = false;
+				}
+			},
+			hardCallbackCloseBLE() {
+				//如果限制不走重连
+				if (this.bLimitClose) return;
+
+				console.log(this.currentItem, this.oldItem);
+				if (this.oldItem && this.currentItem && this.currentItem.id == this.oldItem.id) {
+					// this.$store.state.bConnection = false;
+					if (this.currentItem.bRatio) {
+						uni.showToast({
+							title: '设备断开连接!',
+							icon: 'none',
+							duration: 2000,
+							mask: true
+						})
+						this.currentItem.bRatio = false;
+						this.oldItem = null;
+						this.currentItem = null;
+						//断开连接
+						this.$store.state.bVerifiedConnection = false;
+					}
+				} else if (this.bConnection && this.BLEConnectDevice) {
+					//假如匹配过程中断开连接
+					this.$store.state.BLEConnectDevice = null;
+					this.$store.state.bConnection = false;
+					// uni.hideToast();
+					// console.log("//假如匹配过程中断开连接");
+					uni.showToast({
+						title: '连接失败,请检查设备是否正常。',
+						icon: 'none',
+						mask: true,
+						duration: 2000
+					})
+					if (this.getServicesTimeout) {
+						clearTimeout(this.getServicesTimeout);
+						this.getServicesTimeout = null;
+					}
+				}
+
+			},
+			/**
+			 * 开始查找设备
+			 * */
+			startBluetoothDeviceDiscovery() {
+				//在页面显示的时候判断是都已经初始化完成蓝牙适配器若成功,则开始查找设备
+				let _self = this;
+				if (_self.bOpenBluetooth) {
+
+					//先查询最近使用的硬件,如果最近使用的和当前需要连接的item id一样,则认为是
+					if (_self.finallyUseDevice !== null) {
+						if (_self.finallyUseDevice.id == _self.currentItem.id) {
+							//currentItem 是mode 页面选中的item
+							let obj = Object.assign({}, _self.finallyUseDevice, _self.currentItem);
+							//finallyUserDevice 就是最后一次使用搜索到的设备信息
+							_self.saveObj = _self.finallyUseDevice;
+							uni.showToast({
+								title: '设备连接中...',
+								icon: 'loading',
+								duration: 12000,
+								mask: true
+							})
+							// 先直连,然后判断版本
+							_self._onConnectDevice(obj);
+						} else {
+
+							uni.showModal({
+								title: '连接提示!',
+								content: "1.确定则连接最近使用的设备。\r\n2.取消则重新搜索设备。",
+								success: (res) => {
+									if (res.confirm) {
+										//currentItem 是mode 页面选中的item
+										let obj = Object.assign({}, _self.finallyUseDevice, _self.currentItem);
+										//finallyUserDevice 就是最后一次使用搜索到的设备信息
+										_self.saveObj = Object.assign({}, _self.finallyUseDevice, {
+											id: _self.currentItem.id
+										});
+										uni.showToast({
+											title: '设备连接中...',
+											icon: 'loading',
+											duration: 12000,
+											mask: true
+										})
+										console.log("_onConnectDevice:::===", obj);
+										// 先直连,然后判断版本
+										_self._onConnectDevice(obj);
+									} else if (res.cancel) {
+										_self.onBondedDeviceConnect();
+									}
+								}
+							})
+
+						}
+					} else {
+						_self.onBondedDeviceConnect();
+					}
+
+				} else {
+					_self.initAdapter(() => {
+						_self.startBluetoothDeviceDiscovery();
+					});
+				}
+			},
+			/**
+			 * 通过检测手机连接的设备进行连接,null 的话进行搜索操作
+			 */
+			onBondedDeviceConnect() {
+				let _self = this;
+				// _self.onCanStart();
+
+				//获取手机本身已连接的硬件,
+				//示例
+				// {
+				// 	"deviceId": "C5:5C:19:04:00:30",
+				// 	"name": "BGBox_202012",
+				// 	"RSSI": -74,
+				// 	"localName": "BGBox_20201",
+				// 	"advertisServiceUUIDs": ["00001812-0000-1000-8000-00805F9B34FB", "0000FFF0-0000-1000-8000-00805F9B34FB"]
+				// }
+				_self.B_GetBondedDevices({
+					success: (bondedDevice) => {
+						//获取已和蓝牙连接的设备
+						if (bondedDevice != null) {
+							//如果用户匹配了对应的设备,直接用对应的设备来连接
+							let setDevice = {
+								"deviceId": bondedDevice.address,
+								"name": bondedDevice.name,
+								"RSSI": -74,
+								"localName": "",
+								"advertisServiceUUIDs": ["00001812-0000-1000-8000-00805F9B34FB", "0000FFF0-0000-1000-8000-00805F9B34FB"]
+							}
+
+							let obj = Object.assign({}, setDevice, _self.currentItem);
+							//finallyUserDevice 就是最后一次使用搜索到的设备信息
+							_self.saveObj = Object.assign({}, setDevice, {
+								id: _self.currentItem.id
+							});
+							uni.showToast({
+								title: '设备连接中...',
+								icon: 'loading',
+								duration: 12000,
+								mask: true
+							})
+							console.log("B_GetBondedDevices:::===", obj);
+							// 先直连,然后判断版本
+							_self._onConnectDevice(obj);
+
+							//getBond后发起的连接,不需要检测了
+							_self.bTestBondConnect = false;
+						} else {
+							_self.onCanStart();
+						}
+					}
+				});
+			},
+			//开始搜索
+			onCanStart() {
+				let _self = this;
+				uni.showToast({
+					title: '设备连接中...',
+					icon: 'loading',
+					duration: 12000,
+					mask: true
+				})
+				// 1.已经搜索到的,根据蓝牙回调的mac 地址判断合法性。
+				uni.startBluetoothDevicesDiscovery({
+					allowDuplicatesKey: true,
+					success: res => {
+						console.log("startBluetoothDevicesDiscovery:", res);
+						_self.onBluetoothDeviceFound();
+					},
+					fail: res => {
+						console.log("搜索失败!");
+						_self.initAdapter(() => {
+							_self.startBluetoothDeviceDiscovery();
+						});
+					}
+				});
+				// 2.没有搜索到的,一段时间后处理。比如手机已经连接了设备,但是app 里面搜索不到,也没记录使用过的。
+				if (_self.searchTimeOut) {
+					clearTimeout(_self.searchTimeOut);
+					_self.searchTimeOut = null;
+				}
+				_self.searchTimeOut = setTimeout(() => {
+					//1.搜索12秒钟之后,停止搜索
+					_self.stopBluetoothDevicesDiscovery();
+					uni.showModal({
+						title: '搜索失败',
+						content: '请确认是否开启手柄设备。待手柄设备灯闪烁(已连接可断开配对)再搜索连接。\r\n* 注意:确定即跳转手机设置页面,可断开已连接设备。',
 						success: (res) => {
-							console.log("*****getBLEDeviceServices************");
-							//连接成功了,设置旧的item
-							this.oldItem = this.currentItem;
-							uni.showToast({
-								title: '正在验证设备信息...',
-								icon: 'loading',
-								duration: 6000,
-								mask: true
-							})
-							// 初始化服务后,获取版本,判断
-							// 停止蓝牙加速计
-							this.writeMacTimeout = setTimeout(() => {
-								//停止蓝牙加速计
-								this.onWriteBLEConnectionValue({
-									value: "4"
-								});
-								// 发送获取mac
-								this.onWriteBLEConnectionValue({
-									value: "M"
-								});
-								if (this.searchMac) {
-									clearTimeout(this.searchMac);
-									this.searchMac = null;
-								}
-								this.searchMac = setTimeout(() => {
-									uni.hideToast();
-									uni.showModal({
-										title: '提示',
-										content: '检测设备失败。\r\n1.检查手机蓝牙是否已连接上设备。\r\n2.再次尝试连接或者 重启手柄(Reset键位也可)后再尝试连接'
-									})
-									this.onOnlyCloseBLEConnection({
-										getSuccess: () => {
-											if (this.currentItem)
-												this.currentItem.bRatio = false;
-
-											this.currentItem = null;
-										}
-									});
-								}, 6000)
-							}, 3000)
-
-						}
-					});
-					return;
-				}
-				//创建一个连接,需要对应close
-				this.onCreateBLESuccess({
-					item: item,
-					getSuccess: () => {
-						console.log("****创建一个连接*******");
-						this.getServicesTimeout = setTimeout(() => {
-							this.onGetBLEDeviceServices({
-								item: item,
-								success: (res) => {
-									console.log("******getBLEDeviceServices************", res);
-									//连接成功了,设置旧的item
-									this.oldItem = this.currentItem;
-									uni.showToast({
-										title: '正在验证设备信息...',
-										icon: 'loading',
-										duration: 6000,
-										mask: true
-									})
-									// 初始化服务后,获取版本,判断
-									// 停止蓝牙加速计
-									this.writeMacTimeout = setTimeout(() => {
-										//停止蓝牙加速计
-										this.onWriteBLEConnectionValue({
-											value: "4"
-										});
-										// 发送获取mac
-										this.onWriteBLEConnectionValue({
-											value: "M"
-										});
-										if (this.searchMac) {
-											clearTimeout(this.searchMac);
-											this.searchMac = null;
-										}
-										this.searchMac = setTimeout(() => {
-											uni.hideToast();
-											uni.showModal({
-												title: '提示',
-												content: '检测设备失败。\r\n1.检查手机蓝牙是否已连接上设备。\r\n2.再次尝试连接或者 重启手柄(Reset键位也可)后再尝试连接'
-											})
-											this.onOnlyCloseBLEConnection({
-												getSuccess: () => {
-													if (this.currentItem)
-														this.currentItem.bRatio = false;
-
-													this.currentItem = null;
-												}
-											});
-										}, 6000)
-									}, 3000)
-
-								}
-							});
-						}, 2500);
-					}
-				})
-			},
-
-			_onRadio(item, event) {
-
-				if (!item.bRatio) {
-					//设置默认值
-					this.bTestBondConnect = true;
-					console.log("this.currentItem ==:", this.currentItem, this.bOpenBluetooth, this.BLEConnectDevice);
-					if (this.BLEConnectDevice) {
-						this.onOnlyCloseBLEConnection({
-							getSuccess: () => {
-								if(this.currentItem)
-									this.currentItem.bRatio = false;
-									
-								this.currentItem = null;
-								this.currentItem = item;
-								this.startBluetoothDeviceDiscovery();
+							if (res.confirm) {
+								this.B_OpenBLESetting();
 							}
-						});
-						return;
-					}
-					this.currentItem = null;
-					this.currentItem = item;
-					this.startBluetoothDeviceDiscovery();
-				}
-			},
-			//跳转进入升级页面,
-			onNavUpdateDevice() {
-				// console.log('onNavUpdateDevice');
-				if (!this.option) {
-					uni.showToast({
-						title: 'option null',
-						icon: 'none'
-					})
-					return;
-				}
-				//需要连接设备后,才能进入升级
-				if (!this.currentItem || !this.currentItem.bRatio || !this.BLEConnectDevice) {
-					uni.showToast({
-						title: '选择一个连接后进入',
-						icon: 'none'
-					})
-					return;
-				}
-
-				if (this.BLEConnectDevice.deviceType != this.option.deviceType) {
-					uni.showToast({
-						title: '设备类型不对',
-						icon: 'none'
-					})
-					return;
-				}
-
-				this.bLimitClose = true;
-				uni.navigateTo({
-					url: "../devices-update/devices-update?deviceType=" + this.option.deviceType
-				})
-			}
-		}
-
-	}
-</script>
-
-<style>
-	.hardware-border {
-		border: 1rpx solid #9898FF;
-		box-sizing: border-box;
-	}
+						}
+					})
+				}, 12000)
+			},
+			/**
+			 * 停止搜索蓝牙设备
+			 */
+			stopBluetoothDevicesDiscovery() {
+				uni.stopBluetoothDevicesDiscovery({
+					success: e => {
+						console.log('停止搜索蓝牙设备:' + e.errMsg);
+					},
+					fail: e => {
+						console.log('停止搜索蓝牙设备失败,错误码:' + e.errCode);
+					}
+				});
+			},
+			/**
+			 * 发现外围设备
+			 */
+			onBluetoothDeviceFound() {
+				let _self = this;
+				_self.searchObj = null;
+				uni.onBluetoothDeviceFound(res => {
+					/**
+					 * 获取在蓝牙模块生效期间所有已发现的蓝牙设备。包括已经和本机处于连接状态的设备。
+					 */
+					// console.log("onBluetoothDeviceFound:", res);
+					res.devices.forEach(device => {
+						if (device.name.indexOf('PBox') > -1 || device.name.indexOf('BGBox') > -1) {
+							//如果搜索的设备名 不是对应当前设备类型,过滤
+							// if (device.name.indexOf(_self.currentItem.deviceName) == -1) return;
+							if (_self.currentItem.deviceName.indexOf('PBox') == -1 && _self.currentItem.deviceName.indexOf('BGBox') == -
+								1) return;
+							//寻找到对应设备时候,其余的返回
+							if (_self.searchObj) return;
+							_self.searchObj = device;
+							if (_self.searchTimeOut) {
+								clearTimeout(_self.searchTimeOut);
+								_self.searchTimeOut = null;
+							}
+							//currentItem 是mode 页面选中的item
+							let obj = Object.assign({}, device, _self.currentItem);
+
+							_self.saveObj = Object.assign({}, {
+								id: _self.currentItem.id
+							}, device);
+
+							console.log(device, "****", obj, _self.saveObj, _self.currentItem)
+							// 先直连,然后判断版本
+							_self._onConnectDevice(obj);
+							_self.stopBluetoothDevicesDiscovery();
+						}
+					})
+
+				})
+			},
+
+			onBack() {
+				uni.navigateBack({
+					delta: 1
+				})
+			},
+
+			// 提示点击连接设备
+			_onConnectDevice(item) {
+				//servicesTimeout
+				if (this.getServicesTimeout) {
+					clearTimeout(this.getServicesTimeout);
+					this.getServicesTimeout = null;
+				}
+				//写入指令writeMacTimeout
+				if (this.writeMacTimeout) {
+					clearTimeout(this.writeMacTimeout);
+					this.writeMacTimeout = null;
+				}
+				//如果已经连接,加上服务不存在,直接获取服务
+				if (this.bConnection && this.BLEGetServices && this.BLEGetServices.length == 0) {
+					console.log("***直接获取服务*******");
+					this.onGetBLEDeviceServices({
+						item: item,
+						success: (res) => {
+							console.log("*****getBLEDeviceServices************");
+							//连接成功了,设置旧的item
+							this.oldItem = this.currentItem;
+							uni.showToast({
+								title: '正在验证设备信息...',
+								icon: 'loading',
+								duration: 6000,
+								mask: true
+							})
+							// 初始化服务后,获取版本,判断
+							// 停止蓝牙加速计
+							this.writeMacTimeout = setTimeout(() => {
+								//停止蓝牙加速计
+								this.onWriteBLEConnectionValue({
+									value: "4"
+								});
+								// 发送获取mac
+								this.onWriteBLEConnectionValue({
+									value: "M"
+								});
+								if (this.searchMac) {
+									clearTimeout(this.searchMac);
+									this.searchMac = null;
+								}
+								this.searchMac = setTimeout(() => {
+									uni.hideToast();
+									uni.showModal({
+										title: '提示',
+										content: '检测设备失败。\r\n1.检查手机蓝牙是否已连接上设备。\r\n2.再次尝试连接或者 重启手柄(Reset键位也可)后再尝试连接'
+									})
+									this.onOnlyCloseBLEConnection({
+										getSuccess: () => {
+											if (this.currentItem)
+												this.currentItem.bRatio = false;
+
+											this.currentItem = null;
+										}
+									});
+								}, 6000)
+							}, 3000)
+
+						}
+					});
+					return;
+				}
+				//创建一个连接,需要对应close
+				this.onCreateBLESuccess({
+					item: item,
+					getSuccess: () => {
+						console.log("****创建一个连接*******");
+						this.getServicesTimeout = setTimeout(() => {
+							this.onGetBLEDeviceServices({
+								item: item,
+								success: (res) => {
+									console.log("******getBLEDeviceServices************", res);
+									//连接成功了,设置旧的item
+									this.oldItem = this.currentItem;
+									uni.showToast({
+										title: '正在验证设备信息...',
+										icon: 'loading',
+										duration: 6000,
+										mask: true
+									})
+									// 初始化服务后,获取版本,判断
+									// 停止蓝牙加速计
+									this.writeMacTimeout = setTimeout(() => {
+										//停止蓝牙加速计
+										this.onWriteBLEConnectionValue({
+											value: "4"
+										});
+										// 发送获取mac
+										this.onWriteBLEConnectionValue({
+											value: "M"
+										});
+										if (this.searchMac) {
+											clearTimeout(this.searchMac);
+											this.searchMac = null;
+										}
+										this.searchMac = setTimeout(() => {
+											uni.hideToast();
+											uni.showModal({
+												title: '提示',
+												content: '检测设备失败。\r\n1.检查手机蓝牙是否已连接上设备。\r\n2.再次尝试连接或者 重启手柄(Reset键位也可)后再尝试连接'
+											})
+											this.onOnlyCloseBLEConnection({
+												getSuccess: () => {
+													if (this.currentItem)
+														this.currentItem.bRatio = false;
+
+													this.currentItem = null;
+												}
+											});
+										}, 6000)
+									}, 3000)
+
+								}
+							});
+						}, 2500);
+					}
+				})
+			},
+
+			_onRadio(item, event) {
+
+				if (!item.bRatio) {
+					//设置默认值
+					this.bTestBondConnect = true;
+					console.log("this.currentItem ==:", this.currentItem, this.bOpenBluetooth, this.BLEConnectDevice);
+					if (this.BLEConnectDevice) {
+						this.onOnlyCloseBLEConnection({
+							getSuccess: () => {
+								if (this.currentItem)
+									this.currentItem.bRatio = false;
+
+								this.currentItem = null;
+								this.currentItem = item;
+								this.startBluetoothDeviceDiscovery();
+							}
+						});
+						return;
+					}
+					this.currentItem = null;
+					this.currentItem = item;
+					this.startBluetoothDeviceDiscovery();
+				}
+			},
+			//跳转进入升级页面,
+			onNavUpdateDevice() {
+				// console.log('onNavUpdateDevice');
+				if (!this.option) {
+					uni.showToast({
+						title: 'option null',
+						icon: 'none'
+					})
+					return;
+				}
+				//需要连接设备后,才能进入升级
+				if (!this.currentItem || !this.currentItem.bRatio || !this.BLEConnectDevice) {
+					uni.showToast({
+						title: '选择一个连接后进入',
+						icon: 'none'
+					})
+					return;
+				}
+
+				if (this.BLEConnectDevice.deviceType != this.option.deviceType) {
+					uni.showToast({
+						title: '设备类型不对',
+						icon: 'none'
+					})
+					return;
+				}
+
+				this.bLimitClose = true;
+				uni.navigateTo({
+					url: "../devices-update/devices-update?deviceType=" + this.option.deviceType
+				})
+			}
+		}
+
+	}
+</script>
+
+<style>
+	.hardware-border {
+		border: 1rpx solid #9898FF;
+		box-sizing: border-box;
+	}
 </style>

+ 3067 - 3064
pages/personal-page/personal/personal.vue

@@ -1,3065 +1,3068 @@
-<template>
-	<view class="content bg-person " :class="bEFHitShake?' screen-jitter ':''">
-		<!-- 自定义导航栏 backgroundColor="rgba(164, 136, 220, 1)"  @clickRight="onSyncData" @clickRight="onTestShare"-->
-		<uni-nav-bar id="nav-bar" status-bar="true" backgroundColor="rgba(153, 150, 252, 255)" @clickLeft="showClickEvent()"
-		 @clickRight="onNavAppInfo()" :title="title" color="#FFFFFF" fixed="true" :border="false">
-			<view slot="left">
-				<view class=" flex align-center margin-left">
-					<image class="png-more" src="/static/more.png"></image>
-				</view>
-			</view>
-			<!-- @clickRight="onNavFcGame()" -->
-			<!-- <view slot="right">
-				<view class=" flex align-center " style="margin-right: 10rpx;">
-					<view class="text-22px-before cuIcon-game"></view>
-				</view>
-			</view> -->
-			<view slot="right">
-				<view class=" flex align-center " style="margin-right: 10rpx;">
-					<view class="text-22px-before cuIcon-info"></view>
-				</view>
-			</view>
-		</uni-nav-bar>
-		<!-- 导航栏下面滚动区域 -->
-		<scroll-view class="scroll-class" @scroll="mainScroll" :scroll-top="scrollTop" :scroll-into-view="toView" scroll-y="true"
-		 :style="{ height: scrollviewHight + 'px' }">
-			<view class="flex align-center">
-				<view class="text-center">
-					<!-- 计划显示 区域 topScrollHight :style="{ height: + '100%' }"-->
-					<scroll-view scroll-y="true" style="height: 100%; width: 100%;">
-						<view class="plan-view">
-							<!-- 拳击模块 -->
-							<view v-if="currentMode == 'pkMode'" style="display: flex; flex-direction: row; height: 200rpx; margin-top: 120rpx; justify-content: space-around;align-items: center;">
-								<view>
-									<view class="cu-avatar-group" style="position: relative;">
-										<view class="cu-avatar round xl" :class="bAiHitShake?' screen-jitter':''" :style="[{ backgroundImage:'url('+avatarUrl+')' }]"></view>
-										<HitEffect ref="aiHitEffectRef"></HitEffect>
-									</view>
-									<view style="margin-top: 20rpx; width: 165rpx;" class="text-cut text-white">{{userName}}</view>
-								</view>
-
-								<view>
-									<image style="width: 104rpx; height: 42rpx ;margin-bottom: 60rpx;" src="/static/personal/pk@2x.png"></image>
-								</view>
-								<view>
-									<view class="cu-avatar-group" style="position: relative;">
-										<view class="cu-avatar round xl" :class="bHitShake?' screen-jitter':''" :style="[{ backgroundImage:'url('+aiObj.avatar+')' }]"></view>
-										<HitEffect ref="hitEffectRef"></HitEffect>
-									</view>
-									<view style="margin-top: 20rpx; width: 165rpx;" class="text-cut text-white">{{aiObj.name}}</view>
-								</view>
-
-								<view style="position: absolute;left: 0;right: 0;top: 0;bottom: 0; height: 200rpx; margin-top: 120rpx;">
-									<HitFistEffect ref="hitFistRef"></HitFistEffect>
-								</view>
-
-							</view>
-
-
-							<!-- 圆形进度条 -->
-							<view v-else class="qiun-charts-arcbar">
-								<!-- 进度条 -->
-								<canvas canvas-id="canvasArcbar" id="canvasArcbar" class="charts-arcbar "></canvas>
-								<!-- 水果卡路里-->
-								<view class="personal-fruit-container">
-									<fruit ref="personalFruitRef" :calorie="planData.allCalorie"></fruit>
-								</view>
-								<!-- 卡路里提示 -->
-								<view class="personal-fruit-container">
-									<prompt-box :calorie="planData.allCalorie"></prompt-box>
-								</view>
-								<!-- 计划运动时间提示 -->
-								<view class="personal-fruit-container">
-									<view style="margin-top: 130px;font-size:12px;color: #FFFFFF;">计划时间{{planData.sportTime}}分钟</view>
-								</view>
-								<!-- 计划按钮 -->
-								<!-- <view id="projectButtonView" style="position: absolute;left: 0;top: 18px;">
-									<view class="flex justify-center" style="width: 100%;">
-										<view class="charts-pring-button  make-line-bPurple " :class="bPlanExpired?'breathing-lamp':''" style="background-color: #FFFFFF;"
-										 @tap="openPlan">
-											<image src="/static/reform.png" class="p-data-png" mode="aspectFit"></image>
-											<view class="text-11px">改计划</view>
-										</view>
-									</view>
-								</view> -->
-							</view>
-
-							<!-- 计划按钮 -->
-							<view id="projectButtonView" style="position: absolute;left: 0;top: 18px;">
-								<view class="flex justify-center" style="width: 100%;">
-									<view class="charts-pring-button  make-line-bPurple " :class="bPlanExpired?'breathing-lamp':''" style="background-color: #FFFFFF;"
-									 @tap="openPlan">
-										<image src="/static/reform.png" class="p-data-png" mode="aspectFit"></image>
-										<view class="text-11px">改计划</view>
-									</view>
-								</view>
-							</view>
-
-							<!-- 用于定位 -->
-							<!-- <view id="boxingHitID" style="position: absolute;top: 180rpx; pointer-events: none;" ></view> -->
-							<view id="boxingHitID" v-if="currentModeIndex == 0" class="charts-pring-bottom">
-								<boxing-hit ref="boxingPostRef" :bUpdate="!bHide && cIndex!=-1 && BLEConnectDevice!=null &&
-								 (BLEConnectDevice.deviceType == 'mySelf'||BLEConnectDevice.deviceType == 'BLEHandle')"
-								 :showTime="localSportTime" :bRebound="BLEConnectDevice&&BLEConnectDevice.limitType == 'rebound'"
-								 @updateCalorie="boxingUpdateCalorie" @boxingPostCheck="onPersonalCheck" @shake="onScreenShake"
-								 @updateSportTime="onUpdateSportTime" @boxingGuideFinish="onBoxingGuideFinish" @boxingPostControlPlay="onBoxingPostControlPlay"
-								 @modeEvent="onModeEvent" @hitEvent="onHitEvent" @aiHitEvent="onAiHitEvent" @gameOver="onBoxingGameOver"
-								 @closeBoxingControl="onCloseBoxingHit"></boxing-hit>
-
-							</view>
-							<!-- <button @tap="onTestAddLocalCalorie">11</button> -->
-						</view>
-
-					</scroll-view>
-					<!-- <view class="margin flex flex-direction">
-						<view class="title">当前游戏链接:{{LocationGameUrl}}</view>
-						<input style="border: 1rpx solid #000000;margin: 10rpx;" @input="onKeyInput" placeholder="输入同步到view中" />
-					</view> -->
-					<!-- <button  @tap="onShowBoxingHitTip">11</button> -->
-					<!--数据展示部分 -->
-					<view class="bottom-view" style="position: relative;">
-						<view style="position: absolute; z-index: 1; background-color: #FFFFFF; width: 100%; height: 217px; " class="flex justify-center">
-							<view style="border: 3px solid #9797ff; width: 35px; height: 3px; border-radius: 5px; margin-top: 9px;"></view>
-						</view>
-						<view style="height: 26px ;"></view>
-
-						<view class="card-view">
-							<view class="flex justify-between margin-top margin-left">
-								<view class="flex justify-start">
-									<image src="/static/sync.png" class=" data-png" mode="aspectFit" @tap="onSyncData"></image>
-									<view class="text-gray" style="margin-left: 10rpx;">{{ currentDate }}同步</view>
-								</view>
-								<!-- <view class="flex justify-start margin-right">
-									<view class="text-gray">标准体重:</view>
-									<view class="make-text-bPurple" style="margin-left: 10rpx;">120斤</view>
-								</view> -->
-							</view>
-							<view class="text-xl padding">
-								<view class="make-text-bPurple">
-									{{ weight }}公斤
-									<!-- <span class="text-11px text-gray "> (过重)</span> -->
-								</view>
-							</view>
-							<!-- 曲线图绘制部分 -->
-							<view class="qiun-charts-area">
-								<canvas canvas-id="canvasLineA" id="canvasLineA" class="charts-area" @touchstart.prevent="touchLineA"
-								 @touchmove.prevent="moveLineA" @touchend.prevent="touchEndLineA"></canvas>
-							</view>
-							<view class="bg-white qiun-charts-bottom-container">
-								<view class="avatar-bg-arrow"></view>
-								<view class="avatar-bg-personal">
-									<image mode="aspectFit" :src="avatarUrl" style="width: 100%;height: 100%; border-radius: 45px;background-color: #000000;"></image>
-								</view>
-								<view class="qiun-charts-bottom-right" @tap.prevent="showModal" data-target="bottomModal">
-									<image src="/static/weightEdit.png" class="png-size-34" mode="aspectFit"></image>
-								</view>
-							</view>
-						</view>
-
-						<view class="cu-modal bottom-modal" :class="modalName == 'bottomModal' ? 'show' : ''">
-							<view class="cu-dialog" style=" border-top-right-radius: 20rpx; border-top-left-radius: 20rpx;">
-								<myPicker :pickerObj="pickerObj" @confirmEvent="onConfirm" @cancelEvent="hideModal"></myPicker>
-							</view>
-						</view>
-
-						<view class="card-view">
-							<!-- 累计消耗和计划 -->
-							<view class="flex margin-top-sm margin-bottom-sm justify-center">
-								<view class=" padding-sm margin-right plan-l-tip-view flex align-center">
-									<image src="/static/middlePlant.png" class="data-png-26 margin-sm" mode="aspectFit"></image>
-									<view class="flex justify-start flex-direction">
-										<text style="text-align: start; line-height: 24px; font-weight: 400;">累计消耗</text>
-										<view class="text-11px " style="text-align: start;font-weight: 400; line-height: 28px;">{{ planData.cumulativeCalorie }}/ka</view>
-										<view class="text-gray" style="font-size: 10px;">始于{{ planData.startTime }}</view>
-									</view>
-
-								</view>
-								<view style="height: 56px; width: 1rpx;margin-top: 16px; background-color: #EEEEEE;"></view>
-								<view class="padding-sm margin-left-xs margin-right-xl plan-r-tip-view  flex align-center">
-
-									<image src="/static/middleDay.png" class="data-png-26 margin-sm" mode="aspectFit"></image>
-									<view class="flex justify-start flex-direction">
-										<text style="text-align: start; line-height: 24px;font-weight: 400;">剩余天数</text>
-										<view class="text-11px " style="text-align: start;font-weight: 400;line-height: 28px;">{{ remainingDays }}/day</view>
-										<view class="text-gray" style="font-size: 10px;">计划天数{{ days }}</view>
-									</view>
-								</view>
-							</view>
-						</view>
-
-						<!-- 添加设备部分 -->
-						<view class="card-view">
-							<view class="text-left padding margin-xs flex justify-between">
-								<text class="text-black text-15px  margin-left">我的设备</text>
-								<!-- <view @tap="onNavToMore" class="flex  text-center justify-center align-center  margin-right">
-									<text class="text-gray text-11px">查看更多</text>
-									<image style="margin-left: 6rpx; width: 24rpx;height: 22rpx;" src="/static/right-g.png"></image>
-								</view> -->
-
-							</view>
-							<!-- 绑定的设备列表 拳击柱-->
-							<!-- <view class="container-device">
-								<view class="width-device flex align-center" v-for="(item, index) in DeviceBindingList" :key="index" @tap="onBindingDevice(item, index)"
-								 :data-index="index" :id="'bing-'+item.ename">
-
-									<view style="position: relative; height: 100%;">
-										<image :src="index == cIndex ? '/static/deviceBg.png' : '/static/deviceBg_off.png'" class="data-png-64" mode="aspectFit"></image>
-										<image :src="index == cIndex ?item.icon:item.mIcon" class="data-png-add" mode="aspectFit"></image>
-									</view>
-
-									<view class="flex-sub text-center">
-										<image :src="index == cIndex ? '/static/wifi_on.png' : '/static/wifi_off.png'" class="data-png-32" mode="aspectFit"></image>
-										<view class="text-gray">{{ item.cname }}</view>
-									</view>
-								</view>
-								<view id="QRDeviceView" class="width-device flex align-center" @tap="openQRCode">
-									<view style="position: relative;height: 100%;">
-										<image src="/static/deviceBg.png" class="data-png-64" mode="aspectFit"></image>
-										<image src="/static/deviceAdd.png" class="data-png-add" mode="aspectFit"></image>
-									</view>
-
-									<view class="flex-sub text-center">
-										<view class="text-gray">扫码添加设备</view>
-									</view>
-								</view>
-							</view> -->
-							<!-- 隐藏设备处 -->
-							<view class="container-device">
-								<view class="width-device flex align-center" v-for="(item, index) in BLEDeviceShowList" :key="index" @tap="onDevice(item, $event)"
-								 :data-index="index">
-									<!-- "/static/trampolineS.png" -->
-									<view style="position: relative; height: 100%;">
-										<image :src="index == cIndex ? '/static/deviceBg.png' : '/static/deviceBg_off.png'" class="data-png-64" mode="aspectFit"></image>
-										<image :src="item.mIcon" class="data-png-add" mode="aspectFit"></image>
-									</view>
-
-									<view class="flex-sub text-center">
-										<image :src="index == cIndex ? '/static/wifi_on.png' : '/static/wifi_off.png'" class="data-png-32" mode="aspectFit"></image>
-										<view class="text-gray">{{ item.cname }}</view>
-									</view>
-
-									<view style="position: absolute;right: 0;top: 0;" @tap.stop="onCloseDevice(item, $event)" :data-index="index">
-										<image :src="index == cIndex ? '/static/d_on.png' : '/static/d_off.png'" class="data-png-26" mode="aspectFit"></image>
-									</view>
-								</view>
-								<view id="addDeviceView" class="width-device flex align-center" @tap="openDeviceList">
-									<view style="position: relative;height: 100%;">
-										<image src="/static/deviceBg.png" class="data-png-64" mode="aspectFit"></image>
-										<image src="/static/deviceAdd.png" class="data-png-add" mode="aspectFit"></image>
-									</view>
-
-									<view class="flex-sub text-center">
-										<view class="text-gray">添加设备</view>
-									</view>
-								</view>
-							</view>
-
-
-						</view>
-
-						<!-- 游戏推荐 -->
-						<view class="card-view" v-if="gameList.length !== 0">
-							<view class="text-left padding margin-xs flex justify-between">
-								<text class="text-black text-15px margin-left">游戏推荐</text>
-								<view data-type="game" @tap="onNavToGameMore" class="flex text-center justify-center align-center margin-right">
-									<view class="text-gray text-11px " style=" line-height: 12px; ">查看更多</view>
-									<image style="margin-left: 6rpx; width: 24rpx;height: 22rpx; " src="/static/right-g.png"></image>
-								</view>
-							</view>
-							<view class="cu-item shadow">
-								<view class="cu-form-group margin-top">
-									<view class="grid col-3 homepage-grid-square flex-sub ">
-										<view v-for="(item, index) in gameList" :key="index" @tap="onNavDetail(item)">
-											<image class="item-img" :src="item.gamePicture" mode="aspectFill"></image>
-											<view class="border text-center">{{ item.gameName }}</view>
-										</view>
-									</view>
-								</view>
-							</view>
-
-							<!-- <view @tap="onNavToGameMore" class="flex  text-center justify-center align-center padding-lg make-text-bPurple solid-top margin text-15px text-bold">
-								查看更多
-								<image style="margin-left: 20rpx; width: 28rpx;height: 28rpx;" src="../../../static/right-d.png"></image>
-							</view> -->
-						</view>
-						<!-- <button class="margin" @click="onWriteBLEConnectionValue({value:'V'})">设备版本</button> -->
-						<!-- <button class="margin" @click="openAcc">开启手机加速计和方向传感器</button> -->
-						<!-- <button class="margin" @click="closeAcc">关闭手机加速计和方向传感器</button> -->
-						<!-- <button class="margin" @click="openGyro">开启手机加速计和方向传感器</button> -->
-						<!-- <button class="margin" @click="stopGyro">关闭手机加速计和方向传感器</button> -->
-						<!-- <keyboard-listener @keydown="onKeyDown"></keyboard-listener> -->
-						<!-- 视频推荐 -->
-						<view class="card-view" v-if="videoList.length !== 0">
-							<view class="text-left padding margin-xs flex justify-between">
-								<text class="text-black text-15px margin-left">视频推荐</text>
-								<view data-type="video" @tap="onNavToGameMore" class="flex text-center justify-center align-center margin-right">
-									<view class="text-gray text-11px " style=" line-height: 12px; ">查看更多</view>
-									<image style="margin-left: 6rpx; width: 24rpx;height: 22rpx; " src="/static/right-g.png"></image>
-								</view>
-							</view>
-							<view class="cu-item shadow">
-								<view class="cu-form-group margin-top">
-									<view class="grid col-3 homepage-grid-square flex-sub ">
-										<view v-for="(item, index) in videoList" :key="index" @tap="onNavDetail(item)">
-											<image class="item-img" :src="item.gamePicture" mode="aspectFill"></image>
-											<view class="border text-center">{{ item.gameName }}</view>
-										</view>
-									</view>
-								</view>
-							</view>
-
-						</view>
-					</view>
-				</view>
-			</view>
-		</scroll-view>
-
-		<!-- 右下角导航栏 -->
-		<round-menu @trigger="onRoundTrigger"></round-menu>
-
-		<!-- 侧边栏 -->
-		<sideBar ref="sideBar"></sideBar>
-
-		<!-- 训练卡 -->
-		<view class="cu-modal" :class="modalName == 'sportCompletion' ? 'show' : ''">
-
-			<view style="
-			position: relative; 
-			width: 586rpx;
-			height: 766rpx;
-			background-color: #FFFFFF; 
-			border-radius: 25px;
-			display: inline-block;
-			vertical-align: middle;
-			margin-left: auto;
-			margin-right: auto;
-			overflow: hidden;">
-				<view style="position: relative; width: 100%; height: 328rpx;">
-					<image style="position: absolute;top: 0;left: 0; width: 100%;height: 100%;" src="../../../static/sidebar_top_bg.png"></image>
-					<view class="flex flex-direction justify-around align-center" style="position: relative; height: 100%;">
-						<view class="text-white">已在哔嘣健身训练了</view>
-						<view class="text-white"><span style="font-size: 43px;">{{sportData.time}}</span> 分钟</view>
-						<view class="text-white">本次达标率{{sportData.percent}}%</view>
-					</view>
-				</view>
-				<view class="flex justify-around">
-					<view class="flex flex-direction justify-around align-center" style="position: relative; height: 162rpx;">
-						<view class="text-grey">消耗</view>
-						<view class="text-grey"><span style="font-size: 18px; color: #000000;">{{sportData.calorie}}</span> 卡</view>
-					</view>
-					<view class="flex flex-direction justify-around align-center" style="position: relative; height: 162rpx;">
-						<view class="text-grey">踩中</view>
-						<view class="text-grey"><span style="font-size: 18px; color: #000000;">{{sportData.hit}}</span> 次</view>
-					</view>
-					<view class="flex flex-direction justify-around align-center" style="position: relative; height: 162rpx;">
-						<view class="text-grey">失误</view>
-						<view class="text-grey"><span style="font-size: 18px; color: #000000;">{{sportData.miss}}</span> 次</view>
-					</view>
-				</view>
-				<view class="flex flex-direction justify-around align-center margin-top-sm">
-					<view style="position: relative; width: 500rpx; border:1rpx solid #EEEEEE ;"></view>
-				</view>
-				<view class="flex flex-direction justify-around align-center" style="height: 230rpx;">
-					<view class="text-black text-16px">非常优秀,继续加油!</view>
-					<view class="flex justify-center align-center text-white make-bg-bPurple round text-16px" style="width: 300rpx;height: 80rpx;"
-					 @tap="hideModal">确定</view>
-				</view>
-			</view>
-		</view>
-		<!-- :class="modalName == 'jumpAnimation' ? 'show' : ''" -->
-		<view class="cu-modal " :class="modalName == 'jumpAnimation' ? '' : ''">
-
-			<view style="
-			position: relative; 
-			width: 586rpx;
-			height: 400rpx;
-			background-color: #FFFFFF; 
-			border-radius: 4px;
-			display: inline-block;
-			vertical-align: middle;
-			margin-left: auto;
-			margin-right: auto;
-			overflow: hidden;">
-				<view style="height: 100%;display: flex;justify-content: center;align-items: center;">
-					<character></character>
-				</view>
-			</view>
-		</view>
-
-		<!-- 引导蒙层 bGuidePages guideCurrent-->
-		<code-elf-guide ref="codeElfGuide" v-if="bGuidePages" @hide="guideHide" @change="onGuideChange" :current="guideCurrent"></code-elf-guide>
-
-		<!-- <view v-if="bStartBoxingPost" class="CountDownMask">
-			{{BoxingPostCountDownText}}
-		</view> -->
-
-		<view class="cu-modal " :class="modalName=='showPlanTipModal'?'show':''" @touchmove.stop.prevent="moveBoxingHandle">
-			<view class="cu-bind-modal">
-				<view style="position: absolute; top: 0; left: 0; width: 100%; height:100%;">
-					<image style="position: absolute;top: 0;left: 0; width: 100%;height: 100%;" src="/static/modelBg.png"></image>
-				</view>
-				<view class="flex flex-direction justify-between " style="position: relative; height: 100%;">
-					<view class="flex justify-around justify-center align-center" style="margin: 170rpx 30rpx 0 30rpx;">
-						<view style="width: 80rpx;height: 2rpx;border-radius: 2px; background-color: #cbcdcf;"></view>
-						<view class="make-text-bPurple" style=" font-size: 20px;">提示</view>
-						<view style="width: 80rpx;height: 2rpx;border-radius: 2px;background-color: #cbcdcf;"></view>
-					</view>
-					<view class="text-16px" style="align-self: center; max-width: 200px; word-break: break-all;">{{planTip[planTipIndex]}}</view>
-
-					<view class="flex justify-around align-center" style=" border-top: 1rpx solid #EEEEEE; margin-bottom: 2px;">
-						<view class="flex justify-center align-center  text-16px" style="width: 100%;height: 123rpx;" @tap="hidePlanTipModal">取消</view>
-						<view style="height: 123rpx;width: 1px;background-color: #EEEEEE;"></view>
-						<view class="flex justify-center align-center  text-16px" style="width: 100%;height: 123rpx;" @tap="confirmPlanTipModal">确定</view>
-					</view>
-				</view>
-
-
-			</view>
-		</view>
-
-		<ModalTip ref='modalTipRef' :class="modalName=='showModalTip'?' show':''" @hide="onModalTipHide" @confirm="onModalTipConfirm"></ModalTip>
-
-	</view>
-</template>
-
-<script>
-	import uniNavBar from '@/components/uni-nav-bar/uni-nav-bar.vue';
-	import uCharts from '@/components/u-charts/u-charts.js';
-	import myPicker from '@/components/slambb-picker/slambb-picker.vue';
-	import pickerData from '@/components/slambb-picker/picker.js';
-	import date from '@/util/util-js/date.js';
-	import sideBar from '@/components/side-bar/side-bar.vue';
-
-	import reqUtil from '@/util/util-js/requstUtil.js';
-	import config from '@/common/config.js';
-
-	import uniCountDown from '@/components/uni-count-down/uni-count-down.vue'
-
-	import elect from "@/components/electAni/electAnimation.vue"
-	import character from "@/components/electAni/character.vue"
-	import fruit from "@/components/fruitMachine/fruitMachine.vue"
-
-	import promptBox from "@/components/prompt-box/prompt-box.vue"
-
-	import roundMenu from "@/components/round-menu/round-menu.vue"
-	import codeElfGuide from '@/components/code-elf-guide/code-elf-guide.vue'
-
-	import boxingPost from "@/components/modal/boxing-post/boxing-post.vue"
-
-	import boxingHit from "@/components/modal/boxing-hit/boxing-hit.vue"
-
-	import AccAndOri from "@/util/util-js/AccAndOri.js"
-
-	import AvatarConfig from "@/util/util-js/avatar.js"
-
-	import HitEffect from "@/components/effectHit/hitEffect.vue"
-	import HitFistEffect from "@/components/effectHit/hitFistEffect.vue"
-
-	import ModalTip from "@/components/modal-tip/modalTip.vue"
-
-	import keyboardListener from '@/components/keyboard-listener/keyboard-listener.vue'
-
-
-	import {
-		mapState,
-		mapMutations
-	} from 'vuex';
-
-	var _self;
-	var canvaArcbar1;
-	var canvaLineA = null;
-	var sportSpeedInterval = null;
-	var personalAcc = null;
-
-	export default {
-		computed: mapState(['bCanvasShow', 'forcedLogin', 'hasLogin', 'userName', 'avatarUrl', 'days', 'remainingDays',
-			'signature', 'weight', 'height', 'planData', 'BLEDeviceShowList', 'BLEConnectDevice', 'bPlanExpired',
-			'bPlanFinish',
-			'bGuidePages',
-			'globalAcc', 'globalOri', 'DeviceBindingList', 'ConnectBindingDevice', 'cIndex', 'bNewGuide', 'localSportTime',
-			'currentModeIndex', 'oldArcbarProCalorie', 'oldArcbarAllCalorie', 'bOpenBluetooth', 'bOpenSuccess',
-			'bListenAdapterStateChange', 'bConnection', 'bVerifiedConnection', 'currentInstruction', 'instructionState',
-			'LocationGameUrl',
-			'bPhoneMatched'
-		]),
-		components: {
-			uniNavBar,
-			myPicker,
-			sideBar,
-			uniCountDown,
-			elect,
-			character,
-			fruit,
-			roundMenu,
-			codeElfGuide,
-			boxingPost,
-			boxingHit,
-			promptBox,
-			HitEffect,
-			HitFistEffect,
-			ModalTip,
-			keyboardListener
-		},
-
-		data() {
-			return {
-				title: 'pk模式', //pk模式 健身模式
-				modalName: null,
-				originalDate: '', //记录new date
-				currentDate: '', //当前日期
-				cWidthArcbar: '', //圆弧进度图
-				cHeightArcbar: '', //圆弧进度图
-				arcbarWidth: '', //圆弧进度图,进度条宽度,此设置可使各端宽度一致
-				pixelRatio: 1,
-				textarea: '',
-				arcbarImagePath: '/static/logo.png',
-				cWidth: '',
-				cHeight: '',
-				scrollviewHight: '',
-				// 顶部区域部分
-				topScrollHight: '',
-
-				// 选择器
-				pickerObj: {},
-				lineAImagePath: '/static/logo.png',
-
-				// value: [9999, month - 1, day - 1],
-				visible: true,
-				indicatorStyle: `height: ${Math.round(uni.getSystemInfoSync().screenWidth / (750 / 100))}px;`,
-
-				//设备列表
-				deviceList: [{
-					name: '蹦床',
-					icon: '/static/trampoline.png'
-				}],
-
-				//体重列表
-				weightLigt: [],
-
-				// cIndex: -1,
-				cState: 1,
-
-				//游戏列表
-				gameList: [],
-
-				//视频列表,现在视频是和游戏一起管理
-				videoList: [],
-
-				//运动模式
-				planModeList: [{
-						id: 0,
-						image: '/static/plan-ranzhi.png',
-						name: '燃脂模式'
-					},
-					{
-						id: 1,
-						image: '/static/plan-qixing.png',
-						name: '骑行模式'
-					},
-					{
-						id: 2,
-						image: '/static/plan-jianfei.png',
-						name: '减肥塑身'
-					},
-					{
-						id: 3,
-						image: '/static/plan-youyang.png',
-						name: '有氧恢复'
-					},
-					{
-						id: 4,
-						image: '/static/plan-saidao.png',
-						name: '赛道模式'
-					},
-					{
-						id: 5,
-						image: '/static/plan-shandi.png',
-						name: '山地模式'
-					},
-					{
-						id: 6,
-						image: '/static/plan-dianbo.png',
-						name: '颠簸模式'
-					},
-					{
-						id: 7,
-						image: '/static/plan-yueye.png',
-						name: '越野模式'
-					},
-					{
-						id: 8,
-						image: '/static/plan-jianxie.png',
-						name: '间歇模式'
-					}
-				],
-				planModeSelectId: 7,
-				planModeSelectName: '越野模式',
-				planModeSelectIcon: '/static/plan-yueye.png',
-
-				showPlanMode: true,
-
-				showRunMode: true,
-				showPlayMode: true,
-
-				// 模式名称
-				modelList: [{
-						id: 0,
-						name: '拳击模式'
-					},
-					{
-						id: 1,
-						name: '心电图模式'
-					}
-				],
-
-				//新增心电图部分
-				//步骤点
-				basicsList: [{
-					cuIcon: 'radioboxfill',
-					name: '1'
-				}, {
-					cuIcon: 'radioboxfill',
-					name: '2'
-				}, {
-					cuIcon: 'radioboxfill',
-					name: '3'
-				}, {
-					cuIcon: 'radioboxfill',
-					name: '4'
-				}, {
-					cuIcon: 'radioboxfill',
-					name: '5'
-				}, {
-					cuIcon: 'radioboxfill',
-					name: '6'
-				}, {
-					cuIcon: 'radioboxfill',
-					name: '7'
-				}],
-				basics: 0,
-				// 默认不运行
-				bElectRun: false,
-				// 是否是第一运行
-				bFirstRun: true,
-				//心电图定义,数据
-				electro: {
-					oldData: [], //心电图旧的数据
-					oldLine: {},
-					bCanDelete: false,
-					mValue: 60, //绘制时候中间值的数据
-					curCount: 6,
-					dataLenght: 6,
-					curElectData: null,
-					duration: 2000, //整个心电图运行的时间
-					speed: 100, //心电图运行的速度,执行setInterval的间隔
-					frequencyTime: 20, //_self.electro.frequencyTime*_self.electro.speed 心电图生成的频率间隔
-
-					type: [{
-						data: [10, -20, 80, -70, 10, -10],
-						name: "心电图形状1",
-					}, {
-						data: [-30, 80, -70, 10, -5, 5],
-						name: "心电图形状2"
-					}]
-				},
-				bCanDelete: false,
-
-				sportData: {
-					calorie: 0,
-					hit: 0,
-					miss: 0,
-					percent: 0,
-					time: 0,
-					allData: 0
-				},
-
-				//里程
-				currMileage: 0,
-				// 计算速度的临时里程
-				tempMileage: 0,
-				// 速度
-				currSpeed: 0,
-
-				// 心电图 的图片地址
-				electUrl: '',
-
-				// 心电图部分图片切换
-				bRoundJump: true,
-				bVolume: true,
-
-
-
-				//设置滚动栏高度
-				scrollTop: 0,
-				//scroll view 跳转到对应的组件上
-				toView: '',
-				guideCurrent: 0,
-
-				bHide: false,
-
-				//屏幕抖动
-				bEFHitShake: false,
-				bStartBoxingPost: false,
-				BoxingPostCountDownText: 3,
-				b_countDown: null,
-
-				countDownUrl: [
-					"/static/personal/audio/GO.mp3",
-					"/static/personal/audio/1.mp3",
-					"/static/personal/audio/2.mp3",
-					"/static/personal/audio/3.mp3"
-				],
-				threeUrl: "/static/personal/audio/3.mp3",
-				twoUrl: "/static/personal/audio/2.mp3",
-				oneUrl: "/static/personal/audio/1.mp3",
-				goUrl: "/static/personal/audio/GO.mp3",
-
-				dangdang: "/static/personal/audio/dangdang.mp3",
-				personalAudioContext: null,
-
-				planTip: [
-					'您今天的目标已经达成,是否进行自由训练.',
-					'您今天的目标还没完成,是否结束训练.'
-				],
-				planTipIndex: 0,
-				//蓝牙对象
-				BLERSSIInterval: null,
-
-				//匹配的ai信息
-				aiObj: {
-					name: '匿名',
-					avatar: '/static/defaultAvatar.png'
-				},
-				aiOldObj: {
-					name: '匿名',
-					avatar: '/static/defaultAvatar.png'
-				},
-				currentMode: 'pkMode', //calorieMode
-
-				bHitShake: false,
-
-				bAiHitShake: false,
-				//限制重连,比如去了对应硬件连接页面,限制这个页面的重连操作
-				bLimitReconnection: false,
-				
-				/**
-				 * 首页这里连接了蓝牙,然后选择框回来后show会触发,触发时候检测一下是否有对应的
-				 * 匹配蓝牙
-				 */
-				bGetBondTesting:false,
-
-			};
-		},
-		onLoad() {
-			//设置self
-			_self = this;
-			// 圆形进度条样式
-			this.cWidthArcbar = uni.upx2px(480); //这里要与样式的宽高对应
-			this.cHeightArcbar = uni.upx2px(580); //这里要与样式的宽高对应
-			this.arcbarWidth = uni.upx2px(24);
-			// 体重数据样式
-			this.cWidth = uni.upx2px(750);
-			this.cHeight = uni.upx2px(300);
-			// 心电图数据样式
-			this.eWidth = uni.upx2px(464);
-			this.eHeight = uni.upx2px(140);
-			// #ifdef APP-PLUS || H5
-			//监听
-			uni.$on('personalShowLineA', this.personalShowLineA);
-			uni.$on('updateArcbarData', this.updateArcbarData);
-			// #endif
-			// #ifdef MP
-			this.personalShowLineA();
-			// #endif
-
-			//监听
-			uni.$on('callbackCloseBLE', this.callbackCloseBLE);
-			// uni.$on('callbackBLEState', this.callbackBLEState);
-
-			//获得游戏列表
-			reqUtil
-				.requestData(config.URL.GAMERECOMMEND, {
-					recommendType: 2,
-					endTime: config.endTime
-				})
-				.then(
-					res => {
-						console.log('GAMERECOMMEND =====', res);
-						if (res.code == 0) {
-							if (res.data.gameList.length > 3) {
-								this.gameList = this.gameList.concat(res.data.gameList.slice(0, 3));
-							} else {
-								this.gameList = this.gameList.concat(res.data.gameList);
-							}
-						}
-					},
-					e => {
-						console.log(e);
-					}
-				);
-			//获得视频列表
-			reqUtil
-				.requestData(config.URL.GAMERECOMMEND, {
-					recommendType: 1,
-					endTime: config.endTime
-				})
-				.then(
-					res => {
-						// console.warn('GAMERECOMMEND =====', res);
-						if (res.code == 0) {
-							if (res.data.gameList.length > 3) {
-								this.videoList = this.videoList.concat(res.data.gameList.slice(0, 3));
-							} else {
-								this.videoList = this.videoList.concat(res.data.gameList);
-							}
-						}
-					},
-					e => {
-						console.log(e);
-					}
-				);
-
-			this.personalShowLineA();
-
-			//初始化后设置一下pickerObj
-			this.pickerObj = {
-				pickerLeftList: pickerData.getWeightList().leftList,
-				pickerRightList: pickerData.getWeightList().rightList,
-				pickerType: 'doubleItem',
-				pickerUnit: '公斤',
-				pickerTitle: '记体重',
-				defaultValue: this.weight,
-				showInput: true,
-			};
-
-
-			this.getPlanData(function() {
-				// 如果个人页面直接获取数据
-				_self.showArcbar();
-
-			});
-
-			this.testList = [{
-				cname: "拳击柱",
-				ename: "boxingPost",
-				icon: "/static/modal/boxing-post/left-hook-h@2x.png",
-				mIcon: "/static/modal/boxing-post/left-hook-m@2x.png",
-			}];
-
-			this.personalAudioContext = uni.createInnerAudioContext();
-			this.personalAudioContext.autoplay = false;
-			this.personalAudioContext.src = this.dangdang;
-			this.personalAudioContext.volume = 1;
-
-			//获取本地记录的运动时间
-			uni.getStorage({
-				key: 'localSportTime',
-				success: function(res) {
-					// console.log("本地的时间:",res.data);
-					_self.$store.state.localSportTime = res.data;
-				}
-			});
-
-			//获取设备信息,上报服务器
-			this.gOnAddClientInfo();
-
-		},
-		onShow() {
-			_self.bHide = false;
-
-			if (canvaArcbar1)
-				_self.updateArcbarData();
-
-			// console.warn('this.BLEConnectDevice:',this.BLEConnectDevice);
-			//this.bConnection && 
-			if (this.bVerifiedConnection && this.BLEConnectDevice) {
-				// console.log('this.BLEConnectDevice:',this.BLEConnectDevice);
-				this.updateBLECIndex();
-				
-				setTimeout(()=>{
-					/**
-					 * 如果是首页连接,则检测
-					 */
-					if(this.bGetBondTesting){
-						this.onGetBondDevice();
-						this.bGetBondTesting = false;
-					}
-				},2000)
-				
-			}
-
-			console.log('personal show');
-
-			this.bLimitReconnection = false;
-		
-		},
-		onReady() {
-			// 计算屏幕剩余高度  填补剩余高度
-			uni.getSystemInfo({
-				success(res) {
-					_self.phoneHeight = res.windowHeight;
-					// 计算组件的高度
-					let view = uni.createSelectorQuery().select('#nav-bar');
-					view.boundingClientRect(data => {
-						// console.log('data===:', data);
-						if (data != null) {
-							_self.navHeight = data.height;
-							_self.scrollviewHight = _self.phoneHeight - _self.navHeight;
-							_self.topScrollHight = _self.phoneHeight - _self.navHeight - 30;
-						}
-					}).exec();
-				}
-			});
-
-		},
-		onUnload() {
-			console.log("personal ********* onUnload *********");
-			// #ifndef APP-PLUS||H5
-			//监听
-			console.log('移除监听');
-			uni.$off('personalShowLineA', this.personalShowLineA);
-			uni.$off('updateArcbarData', this.updateArcbarData);
-			// #endif
-			//*****注释蓝牙操作******
-			uni.$off('callbackCloseBLE', this.callbackCloseBLE);
-			// uni.$off('callbackBLEState', this.callbackBLEState);
-			uni.$off('updateBLEDeviceData', this.callbackUpdateBLEData);
-
-			// // 停掉对应的interval
-
-			if (sportSpeedInterval) {
-				clearInterval(sportSpeedInterval);
-				sportSpeedInterval = null;
-			}
-			//unload 时候清除timeout
-			this.onUnloadCreateBLEConnectionTimeout();
-
-		},
-		onHide() {
-			_self.bHide = true;
-			console.log("personal ******* onHide *******");
-			_self.bElectRun = false;
-			//时间暂停 ,隐藏了 需要判断是否为空
-			if (_self.$refs.countDownObj)
-				_self.$refs.countDownObj.timePause('pause');
-			//心电图暂停
-			if (_self.$refs.electRef)
-				_self.$refs.electRef.pausedElect(true);
-
-		},
-		methods: {
-			...mapMutations(['accountLogin', 'getPlanData', 'addlocalCalorie', 'setLocalCalorie', 'setShowCalorie',
-				'syncLocalDataToServer', 'syncRequestEvent', 'setLocalSportTime',
-				'initAdapter', 'onCreateBLEConnection', 'onUnloadCreateBLEConnectionTimeout', 'onCloseBLEConnection',
-				'gOnAddClientInfo', 'onWriteBLEConnectionValue',
-				'gCreateFilterObj', 'gUpdateFilter', 'B_GetBondedDevices','B_OpenBLESetting'
-			]),
-			onKeyDown(e) {
-				console.log(e);
-			},
-			//登录的回调初始化
-			personalShowLineA() {
-
-				//获得体重列表
-				reqUtil.requestData(config.URL.USERGETWEIGHT).then(
-					res => {
-						// console.log('USERGETWEIGHT =====', res);
-						// this.$store.state.weight = res.data;
-						if (res.code == 0 && res.data) {
-							let list = [];
-							for (let i = 0; i < res.data.timestamp.length; i++) {
-								//String.fromCharCode(65 + i)
-								list.push(date.getWeightDate(res.data.timestamp[i]));
-							}
-
-							let lineData = {
-								// ["2012", "2013", "2014", "2015", "2016", "2017"]
-								categories: list,
-								series: [{
-									color: '#9797FF',
-									//["100", "10", "20", "50", "60", "70"]
-									data: res.data.weightList,
-									index: 0,
-									legendShape: 'curve',
-									name: '体重变化',
-									pointShape: 'circle',
-									show: true,
-									type: 'area'
-								}]
-							};
-							_self.showLineA('canvasLineA', lineData);
-						}
-					},
-					e => {
-						console.log(e);
-					}
-				);
-			},
-
-			showClickEvent() {
-				this.$refs.sideBar.showModal();
-				this.$store.state.bCanvasShow = false;
-			},
-			showModal(e) {
-				this.modalName = e.currentTarget.dataset.target;
-				this.$store.state.bCanvasShow = false;
-			},
-			hideModal(e) {
-				if (this.modalName == "sportCompletion") {
-					console.log("关闭卡片");
-					this.sportData = {
-						calorie: 0,
-						hit: 0,
-						miss: 0,
-						percent: 0,
-						time: 0,
-						allData: 0,
-					}
-				}
-				this.modalName = null;
-				this.$store.state.bCanvasShow = true;
-			},
-
-			//获取体重数据
-			onConfirm(e) {
-				// detail.__args__[0]
-				console.log('当前输出的体重:', e);
-				//把体重传上服务器
-				reqUtil
-					.requestData(
-						config.URL.USERADDWEIGHT, {
-							weight: e.value
-						},
-						'POST'
-					)
-					.then(
-						res => {
-							// console.log('USERADDWEIGHT =====', res);
-							_self.$store.state.weight = res.data.currentWeight;
-							let listData = res.data.weightList;
-							let list = [];
-							for (let i = 0; i < listData.timestamp.length; i++) {
-								//String.fromCharCode(65 + i)
-								list.push(date.getWeightDate(listData.timestamp[i]));
-							}
-
-							let lineData = {
-								// ["2012", "2013", "2014", "2015", "2016", "2017"]
-								categories: list,
-								series: [{
-									color: '#9797FF',
-									data: listData.weightList,
-									index: 0,
-									legendShape: 'curve',
-									name: '体重变化',
-									pointShape: 'circle',
-									show: true,
-									type: 'area'
-								}]
-							};
-
-							canvaLineA.updateData(lineData);
-						},
-						e => {
-							console.log(e);
-						}
-					);
-				this.hideModal();
-			},
-			onTestAddLocalCalorie() {
-				let _add = (10 * 1.875) / (4 * 30);
-				console.log(_add);
-				this.onUpdateCaloriePlane(10);
-				// this.onDeleteOnce();
-			},
-			// 进度条数据
-			arcbarData(_planData) {
-				let showCal = _planData.calorie,
-					showLCal = _planData.allCalorie,
-					LCalTip = '大卡',
-					showTip = '(未达标)';
-
-				// 如果运动的卡路里大于目标卡路里,设置为目标卡路里值,即为Max
-				if (showLCal >= showCal) {
-					showTip = '(达标)';
-				}
-
-				let series = [{
-					name: showTip,
-					data: _planData.allCalorie == 0 ? 0 : _planData.allCalorie / showCal,
-					color: '#2fc25b'
-				}];
-				return {
-					showCal,
-					showLCal,
-					LCalTip,
-					showTip,
-					series
-				}
-			},
-			// 圆形进度条
-			showArcbar() {
-				let {
-					showCal,
-					showLCal,
-					LCalTip,
-					series
-				} = this.arcbarData(_self.planData);
-				// console.log("series==", series[0]);
-				canvaArcbar1 = new uCharts({
-					$this: _self,
-					canvasId: 'canvasArcbar',
-					type: 'myArcbar',
-					fontSize: 11,
-					legend: {
-						show: false
-					},
-					background: '#FFFFFF',
-					pixelRatio: 1,
-					series: series,
-					animation: true,
-					width: _self.cWidthArcbar,
-					height: _self.cHeightArcbar,
-					dataLabel: true,
-					//  Math.round(chartData.series[0].data * 100) + '%'
-					title: {
-						// arcbarDate: date.formatDate(_self.originalDate),
-						name: showLCal,
-						molecularUnit: LCalTip, //单位的分子部分
-						denominatorUnit: showCal, //单位的分母部分
-						unitFontSize: 11, //单位字符大小
-						color: 'rgba(255, 255, 255, 1)',
-						fontSize: 28,
-						offsetX: -30,
-						offsetY: 10
-					},
-					subtitle: {
-						name: series[0].name,
-						color: 'rgba(255, 255, 255, 1)',
-						fontSize: 13,
-						offsetY: -75
-					},
-					extra: {
-						arcbar: {
-							type: 'default',
-							backgroundColor: 'rgba(234, 234, 255, 1)',
-							backgroundEndColor: 'rgba(234, 234, 255, 1)',
-							backgroundMiddle: 'rgba(158, 158, 255, 1)',
-							width: _self.arcbarWidth, //圆弧的宽度
-							lineColor: 'rgba(255, 255, 255, 1)',
-							lineEndColor: 'rgba(233, 233, 255, 1)'
-						}
-					}
-				});
-
-				// 更新位置同步
-				this.syncLocalDataToServer((res) => {
-					this.originalDate = res.newDate;
-					this.currentDate = date.formatTime(res.newDate);
-					this.updateArcbarData();
-				});
-			},
-			updateArcbarData(data) {
-				// if (data == "plan") {
-				// 	// 加入设置的卡路里小于本地,则更新本地最小值
-				// 	_self.addlocalCalorie(0);
-				// 	console.log("**************updateArcbarData");
-				// 	// 如果是计划设置好后
-				// 	// this.$store.state.bPlanFinish = true;
-				// 	// setTimeout(() => {
-				// 	// 	this.$store.state.bPlanFinish = false;
-				// 	// }, 10000)
-				// }
-				// console.log("updateArcbarData:",this.planData);
-				let {
-					showCal,
-					showLCal,
-					LCalTip,
-					series
-				} = _self.arcbarData(_self.planData);
-
-				if (showCal == _self.oldArcbarProCalorie && showLCal == _self.oldArcbarAllCalorie) {
-					console.log("没有改变值,不刷新表盘:", showCal, _self.oldArcbarProCalorie, showLCal, _self.oldArcbarAllCalorie);
-					return;
-				}
-				//这个是显示当前的总卡路里
-				_self.$store.state.oldArcbarAllCalorie = showLCal;
-				//这个是计划的卡路里
-				_self.$store.state.oldArcbarProCalorie = showCal;
-
-				canvaArcbar1.updateData({
-					series: series,
-					title: {
-						//这里的文案是自定义的,不写是不变的
-						name: showLCal,
-						molecularUnit: LCalTip, //单位的分子部分
-						denominatorUnit: showCal, //单位的分母部分
-					},
-					subtitle: {
-						//这里的文案是自定义的,不写是不变的
-						name: series[0].name
-					}
-				});
-			},
-			//没有限制下的更新表盘
-			updateNoLimit() {
-				let {
-					showCal,
-					showLCal,
-					LCalTip,
-					series
-				} = _self.arcbarData(_self.planData);
-
-				//这个是显示当前的总卡路里
-				_self.$store.state.oldArcbarAllCalorie = showLCal;
-				//这个是计划的卡路里
-				_self.$store.state.oldArcbarProCalorie = showCal;
-
-				canvaArcbar1.updateData({
-					series: series,
-					title: {
-						//这里的文案是自定义的,不写是不变的
-						name: showLCal,
-						molecularUnit: LCalTip, //单位的分子部分
-						denominatorUnit: showCal, //单位的分母部分
-					},
-					subtitle: {
-						//这里的文案是自定义的,不写是不变的
-						name: series[0].name
-					}
-				});
-			},
-			// 数据列表
-			showLineA(canvasId, chartData) {
-				canvaLineA = new uCharts({
-					$this: _self,
-					canvasId: canvasId,
-					type: 'area',
-					fontSize: 11,
-					padding: [15, 40, 0, 15],
-					legend: {
-						show: false,
-						padding: 0,
-						lineHeight: 10,
-						margin: 0
-					},
-					dataLabel: true,
-					dataPointShape: true,
-					dataPointShapeType: 'solid',
-					background: '#FFFFFF',
-					pixelRatio: 1,
-					categories: chartData.categories,
-					series: chartData.series,
-					animation: true,
-					enableScroll: true, //开启图表拖拽功能
-					enableBottomSolid: false,
-					xAxis: {
-						disableGrid: true,
-						type: 'grid',
-						gridType: 'dash',
-						itemCount: 7,
-						calibration: true,
-						scrollShow: false,
-						scrollAlign: 'left',
-						gridColor: 'rgba(175, 175, 175, 1)',
-						dashLength: 8
-						// boundaryGap: 'justify' //两端不留白配置
-					},
-					yAxis: {
-						// disabled: false,
-						disableGrid: true,
-						disableLine: true,
-						splitNumber: 10,
-						min: 0,
-						// max: 50,
-						format: val => {
-							// console.log("=======",val)
-							// return val.toFixed(0) + '斤'
-							return '';
-						}
-					},
-					width: _self.cWidth,
-					height: _self.cHeight,
-					extra: {
-						area: {
-							type: 'straight', //curve
-							opacity: 1,
-							addLine: true,
-							gradient: true,
-							width: 2
-						}
-					}
-				});
-
-			},
-			touchLineA(e) {
-				// console.log("touchLineA:", e);
-				if (canvaLineA) canvaLineA.scrollStart(e);
-			},
-			moveLineA(e) {
-				if (canvaLineA) {
-					canvaLineA.scroll(e);
-				}
-			},
-			touchEndLineA(e) {
-				if (canvaLineA) {
-					canvaLineA.scrollEnd(e);
-				}
-			},
-			// 跳转计划页面
-			openPlan(e) {
-				// console.log(e);
-				uni.navigateTo({
-					url: '../plan/plan?newsid=' + 11,
-					success: res => {},
-					fail: () => {},
-					complete: () => {}
-				});
-			},
-
-			// 跳转转换页面
-			onNavConver() {
-				uni.reLaunch({
-					url: '../../conversion-page/conversion/conversion',
-					success: res => {},
-					fail: () => {},
-					complete: () => {}
-				});
-			},
-			// 跳转我的页面
-			onNavMyPage() {
-				uni.navigateTo({
-					url: '../../my-page/homepage/homepage',
-					success: res => {},
-					fail: () => {},
-					complete: () => {}
-				});
-			},
-
-			updateBLECIndex() {
-				for (let i = 0; i < this.BLEDeviceShowList.length; i++) {
-					let eq = this.BLEDeviceShowList[i];
-					if ((eq.ename.indexOf("mobilePhoneBandage") > -1 && this.BLEConnectDevice.id == 0) ||
-						(eq.ename.indexOf("hotman") > -1 && this.BLEConnectDevice.id == 1) ||
-						(eq.ename.indexOf("BLEHandle") > -1 && this.BLEConnectDevice.id == 2)) {
-
-						eq.bRatio = true;
-						this.$store.state.cIndex = i;
-
-					}
-				}
-			},
-
-			//蓝牙断开连接时候
-			callbackCloseBLE() {
-				this.$store.state.cIndex = -1;
-				//蓝牙断开连接后,直接关闭
-				this.$refs.boxingPostRef.onCloseDevices();
-
-				if (!this.BLEConnectDevice) {
-					console.log('连接蓝牙对象为空,不进行重连!');
-					return;
-				}
-				//如果限制不走重连
-				if (this.bLimitReconnection) return;
-				//连接蓝牙
-				this.onCreateBLEConnection({
-					item: this.BLEConnectDevice,
-					initItem: false,
-					getSuccess: () => {
-						this.updateBLECIndex();
-						
-						if(this.bHide){
-							//弹出框时候,是隐藏状态
-							this.bGetBondTesting = true;
-						}else{
-							//没有弹出框时候,直接检测
-							this.onGetBondDevice();
-						}
-					},
-					getinitAdapter: () => {
-						// this.onDevice(item, e);
-						// console.log("未开启蓝牙模块?");
-					}
-				});
-			},
-			//蓝牙状态回调
-			callbackBLEState(res) {
-				console.log("callbackBLEState==", res);
-				if (this.cState != res.state) this.cState = res.state;
-			},
-			//设备回调事件
-			callbackUpdateBLEData(data) {
-				//如果在监听状态时候隐藏页面,返回
-				if (_self.bHide) return;
-				// console.log("callbackDeviceState==", data);
-				//连接了手柄模式
-				//没有开启指令不刷新
-				if (!this.instructionState.bOpen) return;
-
-				if (this.BLEConnectDevice.usageMode == "hotman") {
-					this.gUpdateFilter({
-						data: data,
-						callback: (res) => {
-							if (res.type == 'hit') {
-								this.$refs.boxingPostRef.onBLEHotmanUpdate(res);
-							}
-						}
-					});
-				} else if (this.BLEConnectDevice.usageMode == "general") {
-					//这个是普通打击模式
-					this.$refs.boxingPostRef.onBLEHandleUpdate(data);
-				}
-
-
-			},
-			//绑定设备函数
-			onBindingDevice(item, index) {
-				// console.log(item,index);
-				// e.currentTarget.dataset.index $event
-				if (index == this.cIndex) {
-					this.$store.state.cIndex = -1;
-					this.$store.state.ConnectBindingDevice = null;
-
-					setTimeout(() => {
-						uni.showToast({
-							icon: "none",
-							title: "断开连接",
-							duration: 1000
-						})
-					}, 300)
-
-				} else {
-					this.$store.state.cIndex = index;
-					this.$store.state.ConnectBindingDevice = item;
-					setTimeout(() => {
-						uni.showToast({
-							icon: "none",
-							title: "已连接",
-							duration: 1000
-						})
-					}, 300)
-					//连接后保存最近连接的设备
-				}
-
-			},
-			//关闭设备函数
-			onCloseBindingDevice(item, e) {
-				if (e.currentTarget.dataset.index == this.cIndex) {
-					uni.showModal({
-						title: '设备状态',
-						content: '是否断开连接',
-						ConfirmColor: '#A488DC',
-						success: res => {
-							if (res.confirm) {
-								this.$store.state.cIndex = -1;
-								this.$store.state.ConnectBindingDevice = null;
-							}
-						}
-					});
-				}
-			},
-			onNavBindingDevice() {
-				this.toView = "addDeviceView";
-			},
-			onDevice(item, e) {
-				if (this.cIndex !== -1) {
-					uni.showToast({
-						title: '当前已连接设备。',
-						icon: 'none'
-					})
-					return;
-				}
-				uni.showToast({
-					title: '连接设备中...',
-					icon: 'loading',
-					duration: 5000,
-					mask: true
-				})
-				//连接蓝牙
-				this.onCreateBLEConnection({
-					item: item,
-					index: e.currentTarget.dataset.index,
-					initItem: true,
-					getinitAdapter: () => {
-						this.onDevice(item, e);
-					},
-					getSuccess: () => {
-						if(this.bHide){
-							//弹出框时候,是隐藏状态
-							this.bGetBondTesting = true;
-						}else{
-							//没有弹出框时候,直接检测
-							this.onGetBondDevice();
-						}
-					}
-				});
-			},
-			/**
-			 * 检测获取匹配的设备
-			 */
-			onGetBondDevice() {
-				/**
-				 * 假如手机没有匹配,断开连接
-				 */
-				this.B_GetBondedDevices({
-					success:(bondedDevice)=>{
-						console.error("===========",bondedDevice);
-						if (bondedDevice == null) {
-							//此问题 华为手机容易出现
-							//android手机已配对的设备 不存在,但是app 又直接连接成功了。提示,并且断开app连接
-							//1.关闭当前连接
-							this.onCloseBLEConnection({
-								getSuccess: () => {}
-							});
-							uni.hideToast();
-							//2.跳转蓝牙设置
-							uni.showModal({
-								title: '蓝牙配对失败',
-								content: '1.请在蓝牙匹配框点击配对蓝牙。\r\n2.如果没有蓝牙配对提示框,去蓝牙页面重新刷新手机蓝牙。是否跳转手机蓝牙页面?',
-								success: (res) => {
-									if (res.confirm) {
-										this.B_OpenBLESetting();
-									}
-								}
-							})
-						}
-					}
-				});
-				
-			},
-
-			openDeviceList(e) {
-				//先判断蓝牙是否初始化
-				/**
-				 * 蓝牙部分操作,转全局变量操作
-				 * */
-				console.log("openDeviceList bOpenBluetooth", this.bOpenBluetooth);
-				// #ifdef APP-PLUS
-				if (!this.bOpenBluetooth) {
-
-					this.initAdapter(() => {
-						uni.navigateTo({
-							// url: '../devices-category/devices-category',
-							url: '../devices-hardware/devices-hardware',
-							success: res => {
-								this.bLimitReconnection = true;
-							},
-							fail: () => {},
-							complete: () => {}
-						});
-					});
-
-					return;
-				}
-				// #endif
-				uni.navigateTo({
-					url: '../devices-hardware/devices-hardware',
-					success: res => {
-						this.bLimitReconnection = true;
-					},
-					fail: () => {},
-					complete: () => {}
-				});
-			},
-			onNavToMore() {
-				uni.navigateTo({
-					url: '../more/more?index=' + this.cIndex,
-					success: res => {},
-					fail: () => {},
-					complete: () => {}
-				});
-			},
-			onAddDevice() {
-				let deviceItem = {
-					name: '蹦床',
-					icon: '/static/trampoline.png'
-				};
-				if (this.deviceList.length != 0) {
-					this.deviceList = this.deviceList.concat(deviceItem);
-				} else {
-					this.deviceList = deviceItem;
-				}
-			},
-			onCloseDevice(item, e) {
-				//如果不是连接状态,则删除
-				if (e.currentTarget.dataset.index != this.cIndex) {
-					uni.showModal({
-						title: '设备状态',
-						content: '是否删除设备?',
-						ConfirmColor: '#A488DC',
-						success: res => {
-							if (res.confirm) {
-								this.$store.commit('deleteBLEDevice', e.currentTarget.dataset.index);
-							}
-						}
-					});
-					return;
-				}
-				uni.showModal({
-					title: '设备状态',
-					content: '是否断开连接?',
-					/**
-					 * 如果需要强制,不显示取消按钮
-					 */
-					showCancel: true,
-					ConfirmColor: '#A488DC',
-					success: res => {
-						if (res.confirm) {
-							this.onCloseBLEConnection({
-								getSuccess: () => {}
-							});
-
-						}
-					}
-				});
-			},
-
-			onNavDetail(item) {
-				console.log(item);
-				let temItem = encodeURIComponent(JSON.stringify(item));
-				// return;
-				uni.navigateTo({
-					url: '../../game-page/game-detail/game-detail?item=' + temItem
-				});
-			},
-			onNavToGameMore(e) {
-
-				uni.reLaunch({
-					url: '../../game-page/game/game?type=' + e.currentTarget.dataset.type
-				});
-			},
-			onChooseMode(item) {
-				console.log(item);
-				this.planModeSelectId = item.id;
-				this.planModeSelectName = item.name;
-				this.planModeSelectIcon = item.image;
-			},
-			changeRunMode() {
-				this.showRunMode = !this.showRunMode;
-			},
-			changePlayMode() {
-				this.showPlayMode = !this.showPlayMode;
-			},
-			//操作心电图
-			onSetBasics(index) {
-				// if (!this.bElectRun) return;
-				this.basics = index;
-
-				this.electro.duration = 2000 - (this.basics + 1) * 150;
-				this.$refs.electRef.changeDuration(this.electro.duration);
-
-			},
-			onElect(direRight) {
-				// if (!this.bElectRun) return;
-				if (direRight) {
-					this.basics = this.basics == this.basicsList.length - 1 ? 0 : this.basics + 1;
-				} else {
-					this.basics = this.basics == 0 ? 6 : this.basics - 1;
-				}
-				this.electro.duration = 2000 - (this.basics + 1) * 150;
-				this.$refs.electRef.changeDuration(this.electro.duration);
-
-			},
-
-			//判断是否有其他限制
-			onStartCheck() {
-				//#ifdef H5
-				// 直接走测试,如果是h5
-				this.onBoxingGuideFinish();
-				return;
-				//#endif
-				//分类型判断
-				if (0 === this.currentModeIndex) {
-					//拳击运动类型
-					// 1.检测是否有对应设备,
-					// if (0 === this.DeviceBindingList.length) {
-					// 	//如果没有绑定二维码设备,需要扫码绑定
-					// 	this.$store.state.bGuidePages = true;
-					// 	this.guideCurrent = 3;
-					// 	this.toView = "QRDeviceView";
-					// 	return;
-					// }
-					// // 2.检测是否连接设备
-					// if (this.cIndex == -1) {
-					// 	//没有连接设备,提示去连接设备
-					// 	this.$store.state.bGuidePages = true;
-					// 	this.guideCurrent = 4;
-					// 	this.toView = "bing-boxingPost";
-					// 	console.log("bing-boxingPost");
-					// 	return;
-					// }
-					//2.检测是否有设备
-					if (this.BLEDeviceShowList.length == 0) {
-						// this.$store.state.bGuidePages = true;
-						// this.guideCurrent = 1;
-						uni.showToast({
-							title: '请添加蓝牙设备',
-							icon: 'none'
-						})
-						this.toView = "addDeviceView";
-						return;
-					}
-					//2.检测是否连接设备 || this.BLEConnectDevice.ename !== 'BT04'
-					if (this.cIndex == -1) {
-						//没有连接设备,提示去连接设备
-						uni.showToast({
-							title: '请连接蓝牙设备',
-							icon: 'none'
-						})
-						this.toView = "addDeviceView";
-						return;
-					}
-				}
-
-
-				//3.检测一下计划日期
-				console.log(this.remainingDays);
-				if (this.planData.startTime > this.planData.endTime || this.remainingDays == 0) {
-					if (!this.$store.state.bPlanExpired) {
-						this.$store.state.bPlanExpired = true;
-						setTimeout(() => {
-							this.$store.state.bPlanExpired = false;
-						}, 3000)
-						uni.showToast({
-							title: "计划到期,请制定计划。",
-							icon: 'none'
-						})
-					}
-
-					this.$store.state.bGuidePages = true;
-					setTimeout(() => {
-						this.$refs.codeElfGuide.setCurrent(0);
-					}, 0)
-					this.toView = "projectButtonView";
-					return;
-				}
-
-				if (0 === this.currentModeIndex) {
-
-					//如果新手,调用新手教程
-					console.log("this.bNewGuide:", this.bNewGuide);
-					// this.$store.state.bNewGuide = true;
-					if (this.bNewGuide) {
-						// this.$refs.boxingPostRef.onGuideBoxingPostPlay();
-						// 拳击的新手提示
-						this.$store.state.bGuidePages = true;
-						this.guideCurrent = 5;
-						this.toView = "boxingHitID";
-						this.$store.state.bNewGuide = false;
-					} else {
-
-						//初始化filter快速打击对象
-						if (this.BLEConnectDevice.usageMode == "hotman") {
-							this.gCreateFilterObj();
-						}
-						//打开加速计
-						this.onWriteBLEConnectionValue({
-							value: "3"
-						});
-						
-						setTimeout(()=>{
-							//设置加速计20ms
-							this.onWriteBLEConnectionValue({
-								value: "b"
-							});
-							
-						},1000)
-						
-					
-						//监听蓝牙回调
-						uni.$on('updateBLEDeviceData', this.callbackUpdateBLEData);
-
-
-						this.onBoxingGuideFinish();
-					}
-
-				}
-			},
-			onShowBoxingHitTip() {
-				this.$store.state.bGuidePages = true;
-				this.guideCurrent = 5;
-				this.toView = "boxingHitID";
-				this.$store.state.bNewGuide = false;
-			},
-			//检测是否符合要求,没有的话进行新手提示
-			onPersonalCheck() {
-				// //判断一下,是否达标,给moadal 提示 
-				// if (this.planData.allCalorie >= this.planData.calorie) {
-				// 	this.modalName = 'showPlanTipModal';
-				// 	this.planTipIndex = 0;
-				// } else {
-				// 	//如果是一开始,还没达标,就不给modal 提示
-				// 	this.onStartCheck();
-				// }
-				this.onStartCheck();
-			},
-			//
-			onBoxingGuideFinish() {
-
-				if (this.b_countDown) {
-					clearInterval(this.b_countDown);
-					this.b_countDown = null;
-				}
-
-
-				if (this.currentMode == 'calorieMode') {
-					this.personalAudioContext.stop();
-					this.personalAudioContext.play();
-
-					setTimeout(() => {
-						this.$refs.boxingPostRef.onBoxingPostPlay(true);
-					}, 600);
-				} else {
-					this.BoxingPostCountDownText = 3;
-					this.$refs.boxingPostRef.onSetRingAnimation(true);
-					uni.showToast({
-						title: '匹配中...',
-						mask: true,
-						icon: 'loading',
-						duration: 2000
-					})
-
-					setTimeout(() => {
-						//ai信息
-						this.onGetAiRandom();
-
-						// this.b_countDown = setInterval(() => {
-
-						// 	if (this.BoxingPostCountDownText <= 1) {
-						// 		if (this.b_countDown) {
-						// 			clearInterval(this.b_countDown);
-						// 			this.b_countDown = null;
-						// 		}
-						// 		setTimeout(() => {
-						// 			this.personalAudioContext.stop();
-						// 			this.personalAudioContext.play();
-						// 			this.$refs.boxingPostRef.onBoxingPostPlay(true);
-						// 			this.$refs.boxingPostRef.onSetRingAnimation(false);
-						// 			uni.hideToast();
-						// 		}, 800)
-						// 	}
-						// 	this.BoxingPostCountDownText--;
-						// }, 1000)
-						setTimeout(() => {
-							this.personalAudioContext.stop();
-							this.personalAudioContext.play();
-							this.$refs.boxingPostRef.onBoxingPostPlay(true);
-							this.$refs.boxingPostRef.onSetRingAnimation(false);
-							uni.hideToast();
-						}, 800)
-					}, 2000);
-
-				}
-
-
-			},
-			//运动时间
-			onUpdateSportTime(res) {
-				// console.log("同步的运动时间",res);
-				this.setLocalSportTime(res);
-			},
-
-			//运行心电图
-			onPauseElect() {
-				//1.检测一下计划日期
-				console.log(this.remainingDays);
-				if (this.planData.startTime > this.planData.endTime || this.remainingDays == 0) {
-					if (!this.$store.state.bPlanExpired) {
-						this.$store.state.bPlanExpired = true;
-						setTimeout(() => {
-							this.$store.state.bPlanExpired = false;
-						}, 3000)
-						uni.showToast({
-							title: "计划到期,请制定计划。",
-							icon: 'none'
-						})
-					}
-
-					this.$store.state.bGuidePages = true;
-					setTimeout(() => {
-						this.$refs.codeElfGuide.setCurrent(0);
-					}, 0)
-					this.toView = "projectButtonView";
-					return;
-				}
-				//2.检测是否有设备
-				// if (this.BLEDeviceShowList.length == 0) {
-				// 	this.$store.state.bGuidePages = true;
-				// 	this.guideCurrent = 1;
-				// 	this.toView = "addDeviceView";
-				// 	return;
-				// }
-				//2.检测是否连接设备
-				//隐藏功能
-				// if (this.cIndex == -1) {
-				// 	//没有连接设备,提示去连接设备
-
-				// 	uni.showModal({
-				// 		title: '提示',
-				// 		content: '还没有连接设备,是否跳转到设备处?',
-				// 		success: (res) => {
-				// 			if (res.confirm) {
-				// 				this.toView = "addDeviceView";
-				// 			}
-				// 		}
-				// 	})
-				// 	return;
-				// }
-
-
-				// 如果是第一次运行,设置最低速度
-				if (this.bFirstRun) {
-					this.bFirstRun = false;
-					this.onSetBasics(0);
-				}
-
-				if (this.bElectRun) {
-					if (sportSpeedInterval) {
-						clearInterval(sportSpeedInterval);
-						sportSpeedInterval = null;
-					}
-
-					this.bElectRun = false;
-					//时间暂停
-					this.$refs.countDownObj.timePause('pause');
-					this.$refs.electRef.pausedElect();
-				} else {
-					this.bElectRun = true;
-
-					sportSpeedInterval = setInterval(() => {
-						// 每秒检测,相当于m/s
-						this.currSpeed = this.tempMileage;
-						// 累计跑了多远
-						this.currMileage += this.tempMileage;
-						this.tempMileage = 0;
-					}, 1000);
-
-					//时间暂停
-					this.$refs.countDownObj.timePlay('play');
-					this.$refs.electRef.playElect(true);
-
-
-					//播放跳的动画
-					this.modalName = "jumpAnimation";
-					setTimeout(() => {
-						this.modalName = null;
-					}, 4000)
-
-				}
-			},
-
-			BasicsSteps() {
-				this.basics = this.basics == this.basicsList.length - 1 ? 0 : this.basics + 1;
-
-			},
-			//计划时间到, 心电图运行处理这里流程
-			onEndElect() {
-
-				clearInterval(sportSpeedInterval);
-				this.$refs.electRef.pausedElect(true);
-				this.bElectRun = false;
-				this.bFirstRun = true;
-				this.modalName = "sportCompletion";
-				this.sportData.time = this.planData.sportTime;
-				// 1. 计算miss 的个数
-				// this.sportData.miss = this.sportData.allData - this.sportData.hit;
-
-				// 1.计算 总量
-				this.sportData.allData = this.sportData.miss + this.sportData.hit;
-				// 2. 计算击中 的个数
-				if (this.sportData.hit != 0) {
-					let num = this.sportData.hit / this.sportData.allData;
-					this.sportData.percent = num.toFixed(2) * 100;
-				}
-				//TODO 运动的卡路里暂时是*10 57公斤(125磅) 300大卡 30分钟
-				//大概 跳的次数 /2
-				let hitCalorie = this.sportData.hit / 2;
-				this.sportData.calorie = hitCalorie.toFixed(0);
-
-				this.onUpdateCaloriePlane(this.sportData.calorie);
-
-			},
-			//更新运动数据
-			onUpdateCaloriePlane(data) {
-
-				// 记录卡路里到本地
-				this.addlocalCalorie(data);
-
-				this.updateArcbarData();
-			},
-
-			//跳中心电图部分
-			onDeleteOnce() {
-				if (this.bElectRun) {
-					this.$refs.electRef.jumpElect();
-					this.tempMileage++;
-				}
-
-			},
-
-			onSetVolume() {
-				if (this.bVolume) {
-					this.bVolume = false;
-					this.$refs.electRef.setVolume(0);
-				} else {
-					this.bVolume = true;
-					this.$refs.electRef.setVolume(1);
-				}
-			},
-
-			onMiss() {
-				this.sportData.miss++;
-			},
-			onAdd() {
-				this.sportData.hit++;
-			},
-
-			onRoundTrigger(data) {
-				// console.log("onRoundTrigger==", data);
-				// return;
-				let url = '';
-				switch (data.item.type) {
-					case "personal":
-						//个人中心页面
-						url = '../../personal-page/personal/personal';
-						break;
-					case "game":
-						url = '../../game-page/game/game';
-						break;
-					default:
-						url = '../../personal-page/personal/personal';
-						break;
-				}
-				uni.reLaunch({
-					url: url,
-					success: res => {},
-					fail: () => {},
-					complete: () => {}
-				});
-			},
-
-			/**
-			 * 同步本地数据到服务器
-			 */
-			onSyncData() {
-				this.syncRequestEvent({
-					success: () => {
-						this.updateArcbarData();
-					}
-				});
-				// 更新显示日期
-				this.originalDate = new Date();
-				this.currentDate = date.formatTime(this.originalDate);
-			},
-			hidePlanTipModal() {
-				this.modalName = null;
-				if (this.planTipIndex === 1) {
-					// 您今天的目标还没完成  是否结束训练
-					this.onBoxingPause(false);
-				}
-			},
-			confirmPlanTipModal() {
-				this.modalName = null;
-				if (this.planTipIndex === 0) {
-					this.onStartCheck()
-				} else if (this.planTipIndex === 1) {
-					// 您今天的目标还没完成  是否结束训练
-					this.onBoxingPause(true);
-				}
-			},
-			//断开连接时候,关闭
-			onCloseBoxingHit() {
-				console.log('关闭训练');
-				if (this.currentMode == 'pkMode') {
-					this.$refs.hitEffectRef.onStop();
-				}
-				this.onBoxingPause(true);
-			},
-			//点击暂停时候,判断一下是否完成目标
-			onBoxingPostControlPlay(bPlay) {
-				if (!bPlay) {
-
-					if (this.planData.allCalorie < this.planData.calorie) {
-						this.modalName = 'showPlanTipModal';
-						this.planTipIndex = 1;
-					} else {
-						//假如完成了目标,更新卡路里
-						this.onBoxingPause(true);
-					}
-				}
-			},
-			//点击切换模式
-			onModeEvent(data) {
-				console.log("当前模式:", data);
-				this.currentMode = data.mode;
-				this.title = data.name;
-
-				if (this.currentMode == 'calorieMode') {
-					setTimeout(() => {
-						this.updateNoLimit();
-					}, 0)
-
-				}
-			},
-			onAiHitEvent(bloodPoint) {
-
-				// this.onPlay({
-				// 	bloodPoint: num,
-				// 	createType: 'red',
-				// 	callback: (res) => {
-				// 		console.log("红色拳头击中对方:", res);
-				// 	}
-				// });
-				this.$refs.hitFistRef.onPlay({
-					bloodPoint: bloodPoint,
-					createType: 'red',
-					callback: () => {
-						if (this.bAiHitShake) return;
-						this.bAiHitShake = true;
-						this.$refs.aiHitEffectRef.onPlay();
-						this.$refs.aiHitEffectRef.onAIHit();
-						setTimeout(() => {
-							this.bAiHitShake = false;
-						}, 500)
-					}
-				});
-
-
-			},
-			//打击时候头像修改
-			onHitEvent(bloodPoint) {
-				// console.log("this.bHitShake:",this.bHitShake);
-
-				this.$refs.hitFistRef.onPlay({
-						bloodPoint: bloodPoint,
-						createType: 'blue',
-						callback: () => {
-							if (this.bHitShake) return;
-							this.bHitShake = true;
-							this.$refs.hitEffectRef.onPlay();
-							this.$refs.hitEffectRef.onMyHit();
-							setTimeout(() => {
-								this.bHitShake = false;
-							}, 500)
-						}
-					}
-
-				);
-			},
-
-			//弹出目标提示后,进行下一步
-			onBoxingPause(bFinish) {
-				if (bFinish) {
-					//停止蓝牙加速计
-					this.onWriteBLEConnectionValue({
-						value: "4"
-					});
-
-					uni.$off('updateBLEDeviceData', this.callbackUpdateBLEData);
-
-					console.log("停止时候,上传卡路里");
-					this.$refs.boxingPostRef.onBoxingPostStop();
-
-					this.syncRequestEvent({
-						success: () => {
-							this.updateArcbarData();
-						}
-					});
-
-					//停止时候,重置ai信息
-					this.aiObj.name = this.aiOldObj.name;
-					this.aiObj.avatar = this.aiOldObj.avatar;
-
-				} else {
-					//如果不是,继续调用播放
-					this.$refs.boxingPostRef.onBoxingPostPlay(true);
-				}
-
-			},
-
-			/**
-			 * 新手任务引导
-			 */
-			onGuideChange(e) {
-				let tempCurrent = e.detail.current;
-				if (tempCurrent == 1) {
-					_self.toView = "addDeviceView";
-				} else if (tempCurrent == 0) {
-					_self.toView = "projectButtonView";
-				}
-
-			},
-
-			guideHide(e) {
-				this.$store.state.bGuidePages = false;
-				if (e.current == 0 && !e.onlyHide) {
-					//跳转计划页面
-					this.openPlan();
-				} else if (e.current == 1 && !e.onlyHide) {
-					//跳转搜索设备页面
-					this.openDeviceList();
-				} else if (e.current == 3 && !e.onlyHide) {
-					//新手引导跳转扫码页面,直接走绑定 再check
-					this.openQRCode((res) => {
-						setTimeout(() => {
-							this.onPersonalCheck();
-						}, 200);
-					});
-				} else if (e.current == 4 && !e.onlyHide) {
-					//连接绑定设备
-					// this.openQRCode();
-					console.log(e);
-					// this.testList[e.dataset.index] DeviceBindingList
-					let _index = Number(e.device.dataset.index);
-					this.onBindingDevice(this.DeviceBindingList[_index], _index);
-
-					//连接设备后,再
-					setTimeout(() => {
-						this.onPersonalCheck();
-					}, 200);
-				} else if (e.current == 5 && !e.onlyHide) {
-					console.log("==:", e);
-					this.onBoxingGuideFinish();
-				}
-			},
-
-			mainScroll(e) {
-				if (_self.toView == "addDeviceView") {
-					_self.toView = "";
-					if (!_self.bGuidePages) return;
-					let view = uni.createSelectorQuery().select('#addDeviceView');
-					view.boundingClientRect(data => {
-						_self.$refs.codeElfGuide.setDeviceObj(data);
-					}).exec();
-				} else if (_self.toView == "projectButtonView") {
-					_self.toView = "";
-					if (!_self.bGuidePages) return;
-					_self.onGetProjectView();
-				} else if (_self.toView == "QRDeviceView") {
-					_self.toView = "";
-					if (!_self.bGuidePages) return;
-					let view = uni.createSelectorQuery().select('#QRDeviceView');
-					view.boundingClientRect(data => {
-						_self.$refs.codeElfGuide.setDeviceObj(data);
-					}).exec();
-				} else if (_self.toView == "bing-boxingPost") {
-					_self.toView = "";
-					if (!_self.bGuidePages) return;
-					let view = uni.createSelectorQuery().select('#bing-boxingPost');
-					view.boundingClientRect(data => {
-						_self.$refs.codeElfGuide.setDeviceObj(data);
-
-						console.log(data);
-					}).exec();
-				} else if (_self.toView == "boxingHitID") {
-					_self.toView = "";
-
-					// let view = uni.createSelectorQuery().select('#boxingHitID');
-					// view.boundingClientRect(data => {
-					// 	_self.$refs.codeElfGuide.setModalObj(data);
-
-					// 	console.log(data);
-					// }).exec();
-				}
-			},
-
-			onGetProjectView() {
-				let view = uni.createSelectorQuery().select('#projectButtonView');
-				view.boundingClientRect(data => {
-					_self.$refs.codeElfGuide.setProjectObj(data);
-				}).exec();
-			},
-
-			//拳击模块的回调
-			boxingUpdateCalorie(calorie) {
-				if (this.currentMode != 'pkMode') {
-					//这里调用一下设置可以播放音效
-					this.$refs.personalFruitRef.onCanPlay();
-				}
-
-				this.onUpdateCaloriePlane(calorie);
-
-
-			},
-			//扫码添加设备
-			openQRCode(callback) {
-				let that = this;
-				// 允许从相机和相册扫码
-				uni.scanCode({
-					success: function(res) {
-						// console.log('条码类型:' + res.scanType);
-						// console.log('条码内容:' + res.result);
-						let obj = JSON.parse(res.result)
-						let data = {
-							type: obj.type,
-							uuid: obj.uuid,
-						}
-					}
-				});
-			},
-
-			//屏幕抖动
-			onScreenShake() {
-				this.bEFHitShake = true;
-				setTimeout(() => {
-					this.bEFHitShake = false;
-				}, 500)
-			},
-
-			onGetAiRandom() {
-				let _self = this;
-
-				let avatarlist = AvatarConfig.getAvatarList().avatarList;
-				let _length = avatarlist.length;
-				let _index = Math.floor(Math.random() * _length);
-
-				console.log(avatarlist);
-
-				_self.aiObj.name = avatarlist[_index].name;
-				_self.aiObj.avatar = avatarlist[_index].url;
-			},
-			onBoxingGameOver(res) {
-				this.$refs.hitEffectRef.onStop();
-
-				this.onBoxingPause(true);
-
-				let _title = res.myWin ? "胜利" : "失败";
-				let _context = res.myWin ? "你已经赢得PK胜利!" : "你在PK中被打败了!";
-				this.modalName = "showModalTip"
-
-				this.$refs.modalTipRef.setShowData({
-					title: _title,
-					context: _context
-				});
-			},
-			onModalTipHide() {
-				this.modalName = null;
-
-			},
-			onModalTipConfirm() {
-				this.modalName = null;
-				//再来一局
-			},
-			onTestShare() {
-				uni.share({
-					provider: "weixin",
-					scene: "WXSenceTimeline",
-					type: 2,
-					imageUrl: "https://img-cdn-qiniu.dcloud.net.cn/uniapp/images/uni@2x.png",
-					success: function(res) {
-						console.log("success:" + JSON.stringify(res));
-					},
-					fail: function(err) {
-						console.log("fail:" + JSON.stringify(err));
-					}
-				});
-			},
-			openAcc() {
-				if (!this.globalAcc) {
-					AccAndOri.bindAcc((accId) => {
-						this.$store.state.globalAcc = accId;
-						console.log("初始化:globalAcc=", this.globalAcc);
-					});
-				}
-
-				if (!this.globalOri) {
-					AccAndOri.bindOri((oriId) => {
-						this.$store.state.globalOri = oriId;
-						console.log("初始化:globalOri=", this.globalOri);
-					});
-				}
-			},
-			closeAcc() {
-				AccAndOri.unBindAcc(this.globalAcc);
-				this.$store.state.globalAcc = null;
-
-				AccAndOri.unBindOri(this.globalOri);
-				this.$store.state.globalOri = null;
-			},
-			outGyro(o) {
-				console.log("Orientation\nAlpha:" + o.alpha + "\nBeta:" + o.beta + "\nGamma:" + o.gamma);
-			},
-			openGyro() {
-				if (!this.globalOri) {
-					AccAndOri.bindOri((oriId) => {
-						this.$store.state.globalOri = oriId;
-						console.log("初始化:globalOri=", this.globalOri);
-					});
-				}
-				uni.$on('watchOrientation', this.outGyro);
-			},
-			stopGyro() {
-				uni.$off('watchOrientation', this.outGyro);
-				AccAndOri.unBindOri(this.globalOri);
-				this.$store.state.globalOri = null;
-			},
-
-			onKeyInput: function(event) {
-				this.$store.state.LocationGameUrl = event.target.value
-			},
-
-			onNavFcGame() {
-				// console.log(0);
-				uni.navigateTo({
-					url: "../../fc-page/fc/fc"
-				})
-			},
-
-			onNavAppInfo() {
-				uni.navigateTo({
-					url: '../../info-page/app-info/app-info'
-				})
-			}
-
-
-
-		}
-	};
-</script>
-
-<style>
-	.bg-person {
-		background-color: #9797ff;
-	}
-
-	.plan-view {
-		overflow: hidden;
-		background-color: #9797ff;
-	}
-
-	.plan-l-tip-view {
-		border-radius: 80upx 0 0 80upx;
-		background-color: rgba(255, 255, 255, 0.05);
-	}
-
-	.plan-r-tip-view {
-		border-radius: 0 80upx 80upx 0;
-		background-color: rgba(255, 255, 255, 0.05);
-	}
-
-	.bottom-view {
-		background-color: rgba(246, 243, 249, 255);
-		padding-bottom: 20rpx;
-		border-radius: 80rpx 80rpx 0 0;
-		width: 100%;
-		overflow: hidden;
-	}
-
-	.time-view {
-		width: 100%;
-		margin-top: 53rpx;
-		/* border: 1rpx solid #DD514C; */
-	}
-
-	/*样式的width和height一定要与定义的cWidth和cHeight相对应*/
-	.qiun-charts-arcbar {
-		/* padding: 20rpx 15rpx; */
-		height: 556rpx;
-		position: relative;
-		/* border: 1rpx solid #000000; */
-	}
-
-	.charts-arcbar {
-		position: absolute;
-		/* margin-left: 81upx;
-		 */
-		left: 0;
-		right: 0;
-		top: 0;
-		/* bottom: 0; */
-		margin: auto;
-		width: 556upx;
-		height: 556upx;
-		/* border: 1rpx solid #FFFFFF; */
-	}
-
-	.charts-arcbar-img {
-		position: absolute;
-		left: 135upx;
-		width: 480upx;
-		height: 480upx;
-	}
-
-	.charts-pring-bottom {
-		position: relative;
-		width: 100%;
-		display: flex;
-		flex-direction: column;
-		justify-content: center;
-		align-items: center;
-
-	}
-
-	.charts-pring-button {
-		width: 178rpx;
-		height: 64rpx;
-		display: flex;
-		flex-direction: row;
-		justify-content: start;
-		align-items: center;
-		border-radius: 0 25px 25px 0;
-	}
-
-	/* 心电图 */
-	/* .qiun-charts-elect {
-		width: 500rpx;
-		height: 136rpx;
-	} */
-
-	.charts-elect {
-		width: 464rpx;
-		height: 96rpx;
-		border: 1rpx solid #000000;
-	}
-
-	.e-button {
-		background-color: rgba(255, 255, 255, 0.25);
-		border-radius: 45px;
-		margin: 5px 12px;
-		box-shadow: 1px 1px 3px #888888;
-		display: flex;
-		justify-content: center;
-	}
-
-	/* 曲线图 */
-	.qiun-charts-area {
-		width: calc(750rpx - 40rpx);
-		height: 300upx;
-		/* background-color: #007AFF; */
-		position: relative;
-	}
-
-	.charts-area {
-		position: absolute;
-		width: 750upx;
-		height: 300upx;
-	}
-
-	.qiun-charts-bottom-container {
-		height: 63px;
-		position: relative;
-		width: 100%;
-		justify-content: center;
-		align-items: center;
-		display: flex;
-		flex-direction: row;
-	}
-
-
-	.qiun-charts-bottom-right {
-		position: absolute;
-		left: calc(50% + 50rpx);
-		top: 15px;
-		margin-left: 20rpx;
-	}
-
-	/* picker */
-	.mpvue-picker-view {
-		width: calc(50% - 5px);
-		height: 300px;
-		/* background-color: rgba(255, 255, 255, 1); */
-		border-radius: 20px;
-	}
-
-	.item {
-		text-align: center;
-		width: calc(100% - 0px);
-		background-color: rgba(255, 255, 255, 1);
-		height: 88upx;
-		line-height: 88upx;
-		text-overflow: ellipsis;
-		white-space: nowrap;
-		font-size: 40upx;
-	}
-
-	.picker-unit {
-		position: absolute;
-		right: 70px;
-		top: 43%;
-	}
-
-	.left-button,
-	.right-button {
-		margin: 20px 0;
-		padding: 10px 30px;
-		background-color: #ffffff;
-	}
-
-	.left-button {
-		border-top-left-radius: 20px;
-		border-bottom-left-radius: 20px;
-		border-right: 1px solid #e6e6e6;
-	}
-
-	.right-button {
-		border-top-right-radius: 20px;
-		border-bottom-right-radius: 20px;
-	}
-
-	.png-size-28 {
-		width: 24px;
-		height: 24px;
-		margin-bottom: 4px;
-	}
-
-	.png-size-32 {
-		width: 32px;
-		height: 32px;
-	}
-
-	.png-size-34 {
-		width: 34px;
-		height: 34px;
-	}
-
-	/* 图标大小 */
-	.data-play {
-		width: 16px;
-		height: 16px;
-		margin-top: 10rpx;
-	}
-
-	.p-data-png {
-		width: 16px;
-		height: 16px;
-		margin: 5rpx 20rpx;
-	}
-
-	.data-png {
-		width: 16px;
-		height: 16px;
-		margin: 5rpx;
-	}
-
-	.data-png-20 {
-		width: 20px;
-		height: 20px;
-		margin: 0 14rpx;
-	}
-
-	.data-png-54 {
-		width: 54px;
-		height: 54px;
-		margin: 0 14rpx;
-	}
-
-	.data-png-add {
-		position: absolute;
-		left: 0;
-		top: 0;
-		right: 0;
-		bottom: 0;
-		margin: auto;
-		width: 34px;
-		height: 37px;
-	}
-
-	.time-container {
-		margin-top: 13px;
-		width: 100%;
-		height: 218rpx;
-		position: relative;
-		/* border: 1rpx solid #007AFF; */
-	}
-
-	.time-png {
-		width: 503rpx;
-		height: 222rpx;
-		position: absolute;
-		left: 0;
-		right: 0;
-		top: 0;
-		bottom: 0;
-		margin: auto;
-		z-index: 1;
-	}
-
-	.time-text {
-		font-size: 9px;
-		z-index: 10;
-		position: relative;
-		height: 100%;
-		display: flex;
-		justify-content: center;
-		align-items: center;
-		color: #FFFFFF;
-	}
-
-	.padding {
-		padding: 10rpx;
-	}
-
-	.logo {
-		height: 200rpx;
-		width: 200rpx;
-		margin-top: 200rpx;
-		margin-left: auto;
-		margin-right: auto;
-		margin-bottom: 50rpx;
-	}
-
-	.float-png {
-		position: absolute;
-		right: 15px;
-		bottom: 200px;
-		width: 56px;
-		height: 56px;
-	}
-
-	.moveCanvas {
-		position: fixed;
-		top: 9999rpx;
-		left: 0;
-		width: 188rpx;
-		height: 188rpx;
-	}
-
-	.scroll-class {
-		width: 100%;
-		overflow-x: hidden;
-		box-sizing: border-box;
-		/* border: 1rpx solid #000000; */
-	}
-
-	.homepage-grid-square {
-		width: 250rpx;
-		/* height: 250rpx; */
-		align-items: start;
-	}
-
-	.homepage-grid-square image {
-		width: 176rpx;
-		height: 176rpx;
-	}
-
-	.border {
-		/* width: 176rpx; */
-		font-size: 30rpx;
-		color: rgba(175, 175, 175, 1);
-		font-weight: 400;
-		text-align: center;
-		margin-top: 22rpx;
-		margin-bottom: 40rpx;
-	}
-
-	.item-img {
-		border-radius: 20rpx;
-		/* border: 1rpx solid #EEEEEE; */
-		box-shadow: 0px 1px 2px 0px rgba(113, 113, 219, 0.23);
-	}
-
-	.plan-Tip-child {
-		height: 120rpx;
-	}
-
-	.plan-mode-tip {
-		height: 90rpx;
-	}
-
-	.plan-grid-square {
-		width: 250rpx;
-		/* height: 250rpx; */
-		align-items: start;
-	}
-
-	.plan-grid-square image {
-		width: 168rpx;
-		height: 58rpx;
-	}
-
-	.plan-mode {
-		/* height: 54px; */
-		border-radius: 10px;
-		padding: 3px;
-		margin: 0 5px 10px 5px;
-		border: 1rpx solid #eeeeee;
-		/* box-shadow: 0px 1px 2px 0px rgba(113, 113, 219, 0.23); */
-		position: relative;
-	}
-
-	.plan-mode-selected {
-		/* height: 54px; */
-		padding: 3px;
-		margin: 0 5px 10px 5px;
-		background-size: contain;
-		background-clip: border-box;
-		background-repeat: no-repeat;
-		background-image: url(../../../static/plan-select-bg.png);
-		/* box-shadow: 0px 1px 2px 0px rgba(113, 113, 219, 0.23); */
-		position: relative;
-	}
-
-	.plan-mode-border {
-		/* width: 176rpx; */
-		font-size: 26rpx;
-		color: rgba(151, 151, 255, 1);
-		font-weight: 400;
-		text-align: center;
-	}
-
-	.button-fav {
-		background-color: rgba(153, 150, 252, 255);
-		color: #ffffff;
-		/* border-radius: 10px; */
-		/* width: 184rpx; */
-		height: 122rpx;
-		display: flex;
-		justify-content: center;
-		text-align: center;
-		align-items: center;
-		font-size: 14px;
-	}
-
-	.card-view-small {
-		/* border: 1rpx solid #000000; */
-		width: 80%;
-		border-radius: 20px;
-		margin-left: 50rpx;
-		overflow: hidden;
-		background-color: #ffffff;
-		box-shadow: 0px 2px 4px 0px rgba(113, 113, 219, 0.23);
-	}
-
-	.right-bg {
-		/* border: 1rpx solid #000000; */
-		border-radius: 8px;
-		background-color: #9797ff;
-		padding: 15rpx;
-		position: absolute;
-		right: 5%;
-		margin-top: 4%;
-	}
-
-	.plan-small-child {
-		background-color: #f5f5ff;
-		border-radius: 20px;
-		width: 480rpx;
-		height: 90rpx;
-		margin: 0 0 30rpx 30rpx;
-		/* margin-top: 60rpx; */
-	}
-
-	.cu-btn-plan {
-		position: relative;
-		border: 0upx;
-		display: inline-flex;
-		align-items: center;
-		justify-content: center;
-		box-sizing: border-box;
-		padding: 4upx 25upx 4upx 4upx;
-		margin-left: 5px;
-		font-size: 22upx;
-		height: 64upx;
-		line-height: 1;
-		text-align: center;
-		text-decoration: none;
-		overflow: visible;
-		margin-left: initial;
-		transform: translate(0upx, 0upx);
-		margin-right: initial;
-	}
-
-	.cu-btn-plan-child {
-		position: relative;
-		border: 0upx;
-		display: inline-flex;
-		align-items: center;
-		justify-content: center;
-		box-sizing: border-box;
-		padding: 0 4upx;
-		font-size: 22upx;
-		height: 56upx;
-		line-height: 1;
-		text-align: center;
-		text-decoration: none;
-		overflow: visible;
-		margin-left: initial;
-		transform: translate(0upx, 0upx);
-		margin-right: initial;
-	}
-
-	.cu-btn-plan-right {
-		position: relative;
-		border: 0upx;
-		display: inline-flex;
-		align-items: center;
-		justify-content: center;
-		box-sizing: border-box;
-		padding: 4upx 4upx 4upx 19upx;
-		margin-left: 5px;
-		font-size: 22upx;
-		height: 64upx;
-		line-height: 1;
-		text-align: center;
-		text-decoration: none;
-		overflow: visible;
-		margin-left: initial;
-		transform: translate(0upx, 0upx);
-		margin-right: initial;
-	}
-
-	/* 粗线条 */
-	.line-make {
-		margin-top: 11px;
-		margin-left: 8px;
-		border: 4rpx solid #FFFFFF;
-		width: 152rpx;
-		border-radius: 3px;
-	}
-
-
-	/* 头像背景处理 */
-	.avatar-bg-personal {
-		width: 34px;
-		height: 34px;
-		border-radius: 45px;
-		border: 2px solid #9997fc;
-		background-color: #9997fc;
-		box-sizing: border-box;
-	}
-
-
-	.avatar-bg-arrow {
-		position: absolute;
-		top: 12px;
-		left: calc(50% - 10px);
-		border-left: 10px solid transparent;
-		border-right: 10px solid transparent;
-		border-bottom: 10px solid #9997fc;
-	}
-
-	.elect-round-image {
-		width: 48px;
-		height: 48px;
-		z-index: 10;
-		box-shadow: 1px 1px 3px #888888;
-		border-radius: 45px;
-	}
-
-	.elect-personal {
-		/* width: 100%; */
-		height: 120rpx;
-		/* margin: 50rpx 0; */
-		margin-bottom: 50rpx;
-		border-radius: 45px;
-		padding: 10rpx;
-		border: 1rpx solid rgba(255, 255, 255, 0.11);
-		display: flex;
-		justify-content: center;
-		align-items: center;
-		position: relative;
-	}
-
-	/* 呼吸灯 */
-	.breathing-lamp {
-		animation-duration: 1s;
-		animation-timing-function: ease-out;
-		animation-fill-mode: inherit;
-		animation-iteration-count: infinite;
-		animation-name: run-lamp;
-		animation-play-state: running;
-	}
-
-	@keyframes run-lamp {
-
-		0%,
-		100% {
-			opacity: 1;
-			transform: scale(1);
-		}
-
-		50% {
-			opacity: 0.6;
-			transform: scale(0.9);
-		}
-
-	}
-
-	.personal-fruit-container {
-		position: absolute;
-		left: 0;
-		top: 0;
-		bottom: 0;
-		right: 0;
-		margin: auto;
-		display: flex;
-		align-items: center;
-		justify-content: center;
-		/* border: 1rpx solid #F0F0F0; */
-	}
-
-
-	.screen-jitter {
-		animation-duration: 1s;
-		animation-timing-function: ease-out;
-		animation-fill-mode: inherit;
-		animation-iteration-count: infinite;
-		animation-name: personal-shake;
-		animation-play-state: running;
-	}
-
-	.screen-red {
-		border: 1rpx solid #ff0000;
-	}
-
-	@keyframes personal-shake {
-
-		0%,
-		100% {
-			transform: translateX(0)
-		}
-
-		10% {
-			transform: translateX(-9px)
-		}
-
-		20% {
-			transform: translateX(8px)
-		}
-
-		30% {
-			transform: translateX(-7px)
-		}
-
-		40% {
-			transform: translateX(6px)
-		}
-
-		50% {
-			transform: translateX(-5px)
-		}
-
-		60% {
-			transform: translateX(4px)
-		}
-
-		70% {
-			transform: translateX(-3px)
-		}
-
-		80% {
-			transform: translateX(2px)
-		}
-
-		90% {
-			transform: translateX(-1px)
-		}
-	}
-
-	.CountDownMask {
-		position: absolute;
-		top: 0;
-		bottom: 0;
-		right: 0;
-		left: 0;
-		background-color: rgba(0, 0, 0, 0.5);
-		z-index: 1000;
-		display: flex;
-		justify-content: center;
-		align-items: center;
-		font-size: 100px;
-		font-weight: bold;
-		color: #FFFFFF;
-	}
+<template>
+	<view class="content bg-person " :class="bEFHitShake?' screen-jitter ':''">
+		<!-- 自定义导航栏 backgroundColor="rgba(164, 136, 220, 1)"  @clickRight="onSyncData" @clickRight="onTestShare"-->
+		<uni-nav-bar id="nav-bar" status-bar="true" backgroundColor="rgba(153, 150, 252, 255)" @clickLeft="showClickEvent()"
+		 @clickRight="onNavAppInfo()" :title="title" color="#FFFFFF" fixed="true" :border="false">
+			<view slot="left">
+				<view class=" flex align-center margin-left">
+					<image class="png-more" src="/static/more.png"></image>
+				</view>
+			</view>
+			<!-- @clickRight="onNavFcGame()" -->
+			<!-- <view slot="right">
+				<view class=" flex align-center " style="margin-right: 10rpx;">
+					<view class="text-22px-before cuIcon-game"></view>
+				</view>
+			</view> -->
+			<view slot="right">
+				<view class=" flex align-center " style="margin-right: 10rpx;">
+					<view class="text-22px-before cuIcon-info"></view>
+				</view>
+			</view>
+		</uni-nav-bar>
+		<!-- 导航栏下面滚动区域 -->
+		<scroll-view class="scroll-class" @scroll="mainScroll" :scroll-top="scrollTop" :scroll-into-view="toView" scroll-y="true"
+		 :style="{ height: scrollviewHight + 'px' }">
+			<view class="flex align-center">
+				<view class="text-center">
+					<!-- 计划显示 区域 topScrollHight :style="{ height: + '100%' }"-->
+					<scroll-view scroll-y="true" style="height: 100%; width: 100%;">
+						<view class="plan-view">
+							<!-- 拳击模块 -->
+							<view v-if="currentMode == 'pkMode'" style="display: flex; flex-direction: row; height: 200rpx; margin-top: 120rpx; justify-content: space-around;align-items: center;">
+								<view>
+									<view class="cu-avatar-group" style="position: relative;">
+										<view class="cu-avatar round xl" :class="bAiHitShake?' screen-jitter':''" :style="[{ backgroundImage:'url('+avatarUrl+')' }]"></view>
+										<HitEffect ref="aiHitEffectRef"></HitEffect>
+									</view>
+									<view style="margin-top: 20rpx; width: 165rpx;" class="text-cut text-white">{{userName}}</view>
+								</view>
+
+								<view>
+									<image style="width: 104rpx; height: 42rpx ;margin-bottom: 60rpx;" src="/static/personal/pk@2x.png"></image>
+								</view>
+								<view>
+									<view class="cu-avatar-group" style="position: relative;">
+										<view class="cu-avatar round xl" :class="bHitShake?' screen-jitter':''" :style="[{ backgroundImage:'url('+aiObj.avatar+')' }]"></view>
+										<HitEffect ref="hitEffectRef"></HitEffect>
+									</view>
+									<view style="margin-top: 20rpx; width: 165rpx;" class="text-cut text-white">{{aiObj.name}}</view>
+								</view>
+
+								<view style="position: absolute;left: 0;right: 0;top: 0;bottom: 0; height: 200rpx; margin-top: 120rpx;">
+									<HitFistEffect ref="hitFistRef"></HitFistEffect>
+								</view>
+
+							</view>
+
+
+							<!-- 圆形进度条 -->
+							<view v-else class="qiun-charts-arcbar">
+								<!-- 进度条 -->
+								<canvas canvas-id="canvasArcbar" id="canvasArcbar" class="charts-arcbar "></canvas>
+								<!-- 水果卡路里-->
+								<view class="personal-fruit-container">
+									<fruit ref="personalFruitRef" :calorie="planData.allCalorie"></fruit>
+								</view>
+								<!-- 卡路里提示 -->
+								<view class="personal-fruit-container">
+									<prompt-box :calorie="planData.allCalorie"></prompt-box>
+								</view>
+								<!-- 计划运动时间提示 -->
+								<view class="personal-fruit-container">
+									<view style="margin-top: 130px;font-size:12px;color: #FFFFFF;">计划时间{{planData.sportTime}}分钟</view>
+								</view>
+								<!-- 计划按钮 -->
+								<!-- <view id="projectButtonView" style="position: absolute;left: 0;top: 18px;">
+									<view class="flex justify-center" style="width: 100%;">
+										<view class="charts-pring-button  make-line-bPurple " :class="bPlanExpired?'breathing-lamp':''" style="background-color: #FFFFFF;"
+										 @tap="openPlan">
+											<image src="/static/reform.png" class="p-data-png" mode="aspectFit"></image>
+											<view class="text-11px">改计划</view>
+										</view>
+									</view>
+								</view> -->
+							</view>
+
+							<!-- 计划按钮 -->
+							<view id="projectButtonView" style="position: absolute;left: 0;top: 18px;">
+								<view class="flex justify-center" style="width: 100%;">
+									<view class="charts-pring-button  make-line-bPurple " :class="bPlanExpired?'breathing-lamp':''" style="background-color: #FFFFFF;"
+									 @tap="openPlan">
+										<image src="/static/reform.png" class="p-data-png" mode="aspectFit"></image>
+										<view class="text-11px">改计划</view>
+									</view>
+								</view>
+							</view>
+
+							<!-- 用于定位 -->
+							<!-- <view id="boxingHitID" style="position: absolute;top: 180rpx; pointer-events: none;" ></view> -->
+							<view id="boxingHitID" v-if="currentModeIndex == 0" class="charts-pring-bottom">
+								<boxing-hit ref="boxingPostRef" :bUpdate="!bHide && cIndex!=-1 && BLEConnectDevice!=null &&
+								 (BLEConnectDevice.deviceType == 'mySelf'||BLEConnectDevice.deviceType == 'BLEHandle')"
+								 :showTime="localSportTime" :bRebound="BLEConnectDevice&&BLEConnectDevice.limitType == 'rebound'"
+								 @updateCalorie="boxingUpdateCalorie" @boxingPostCheck="onPersonalCheck" @shake="onScreenShake"
+								 @updateSportTime="onUpdateSportTime" @boxingGuideFinish="onBoxingGuideFinish" @boxingPostControlPlay="onBoxingPostControlPlay"
+								 @modeEvent="onModeEvent" @hitEvent="onHitEvent" @aiHitEvent="onAiHitEvent" @gameOver="onBoxingGameOver"
+								 @closeBoxingControl="onCloseBoxingHit"></boxing-hit>
+
+							</view>
+							<!-- <button @tap="onTestAddLocalCalorie">11</button> -->
+						</view>
+
+					</scroll-view>
+					<!-- <view class="margin flex flex-direction">
+						<view class="title">当前游戏链接:{{LocationGameUrl}}</view>
+						<input style="border: 1rpx solid #000000;margin: 10rpx;" @input="onKeyInput" placeholder="输入同步到view中" />
+					</view> -->
+					<!-- <button  @tap="onShowBoxingHitTip">11</button> -->
+					<!--数据展示部分 -->
+					<view class="bottom-view" style="position: relative;">
+						<view style="position: absolute; z-index: 1; background-color: #FFFFFF; width: 100%; height: 217px; " class="flex justify-center">
+							<view style="border: 3px solid #9797ff; width: 35px; height: 3px; border-radius: 5px; margin-top: 9px;"></view>
+						</view>
+						<view style="height: 26px ;"></view>
+
+						<view class="card-view">
+							<view class="flex justify-between margin-top margin-left">
+								<view class="flex justify-start">
+									<image src="/static/sync.png" class=" data-png" mode="aspectFit" @tap="onSyncData"></image>
+									<view class="text-gray" style="margin-left: 10rpx;">{{ currentDate }}同步</view>
+								</view>
+								<!-- <view class="flex justify-start margin-right">
+									<view class="text-gray">标准体重:</view>
+									<view class="make-text-bPurple" style="margin-left: 10rpx;">120斤</view>
+								</view> -->
+							</view>
+							<view class="text-xl padding">
+								<view class="make-text-bPurple">
+									{{ weight }}公斤
+									<!-- <span class="text-11px text-gray "> (过重)</span> -->
+								</view>
+							</view>
+							<!-- 曲线图绘制部分 -->
+							<view class="qiun-charts-area">
+								<canvas canvas-id="canvasLineA" id="canvasLineA" class="charts-area" @touchstart.prevent="touchLineA"
+								 @touchmove.prevent="moveLineA" @touchend.prevent="touchEndLineA"></canvas>
+							</view>
+							<view class="bg-white qiun-charts-bottom-container">
+								<view class="avatar-bg-arrow"></view>
+								<view class="avatar-bg-personal">
+									<image mode="aspectFit" :src="avatarUrl" style="width: 100%;height: 100%; border-radius: 45px;background-color: #000000;"></image>
+								</view>
+								<view class="qiun-charts-bottom-right" @tap.prevent="showModal" data-target="bottomModal">
+									<image src="/static/weightEdit.png" class="png-size-34" mode="aspectFit"></image>
+								</view>
+							</view>
+						</view>
+
+						<view class="cu-modal bottom-modal" :class="modalName == 'bottomModal' ? 'show' : ''">
+							<view class="cu-dialog" style=" border-top-right-radius: 20rpx; border-top-left-radius: 20rpx;">
+								<myPicker :pickerObj="pickerObj" @confirmEvent="onConfirm" @cancelEvent="hideModal"></myPicker>
+							</view>
+						</view>
+
+						<view class="card-view">
+							<!-- 累计消耗和计划 -->
+							<view class="flex margin-top-sm margin-bottom-sm justify-center">
+								<view class=" padding-sm margin-right plan-l-tip-view flex align-center">
+									<image src="/static/middlePlant.png" class="data-png-26 margin-sm" mode="aspectFit"></image>
+									<view class="flex justify-start flex-direction">
+										<text style="text-align: start; line-height: 24px; font-weight: 400;">累计消耗</text>
+										<view class="text-11px " style="text-align: start;font-weight: 400; line-height: 28px;">{{ planData.cumulativeCalorie }}/ka</view>
+										<view class="text-gray" style="font-size: 10px;">始于{{ planData.startTime }}</view>
+									</view>
+
+								</view>
+								<view style="height: 56px; width: 1rpx;margin-top: 16px; background-color: #EEEEEE;"></view>
+								<view class="padding-sm margin-left-xs margin-right-xl plan-r-tip-view  flex align-center">
+
+									<image src="/static/middleDay.png" class="data-png-26 margin-sm" mode="aspectFit"></image>
+									<view class="flex justify-start flex-direction">
+										<text style="text-align: start; line-height: 24px;font-weight: 400;">剩余天数</text>
+										<view class="text-11px " style="text-align: start;font-weight: 400;line-height: 28px;">{{ remainingDays }}/day</view>
+										<view class="text-gray" style="font-size: 10px;">计划天数{{ days }}</view>
+									</view>
+								</view>
+							</view>
+						</view>
+
+						<!-- 添加设备部分 -->
+						<view class="card-view">
+							<view class="text-left padding margin-xs flex justify-between">
+								<text class="text-black text-15px  margin-left">我的设备</text>
+								<!-- <view @tap="onNavToMore" class="flex  text-center justify-center align-center  margin-right">
+									<text class="text-gray text-11px">查看更多</text>
+									<image style="margin-left: 6rpx; width: 24rpx;height: 22rpx;" src="/static/right-g.png"></image>
+								</view> -->
+
+							</view>
+							<!-- 绑定的设备列表 拳击柱-->
+							<!-- <view class="container-device">
+								<view class="width-device flex align-center" v-for="(item, index) in DeviceBindingList" :key="index" @tap="onBindingDevice(item, index)"
+								 :data-index="index" :id="'bing-'+item.ename">
+
+									<view style="position: relative; height: 100%;">
+										<image :src="index == cIndex ? '/static/deviceBg.png' : '/static/deviceBg_off.png'" class="data-png-64" mode="aspectFit"></image>
+										<image :src="index == cIndex ?item.icon:item.mIcon" class="data-png-add" mode="aspectFit"></image>
+									</view>
+
+									<view class="flex-sub text-center">
+										<image :src="index == cIndex ? '/static/wifi_on.png' : '/static/wifi_off.png'" class="data-png-32" mode="aspectFit"></image>
+										<view class="text-gray">{{ item.cname }}</view>
+									</view>
+								</view>
+								<view id="QRDeviceView" class="width-device flex align-center" @tap="openQRCode">
+									<view style="position: relative;height: 100%;">
+										<image src="/static/deviceBg.png" class="data-png-64" mode="aspectFit"></image>
+										<image src="/static/deviceAdd.png" class="data-png-add" mode="aspectFit"></image>
+									</view>
+
+									<view class="flex-sub text-center">
+										<view class="text-gray">扫码添加设备</view>
+									</view>
+								</view>
+							</view> -->
+							<!-- 隐藏设备处 -->
+							<view class="container-device">
+								<view class="width-device flex align-center" v-for="(item, index) in BLEDeviceShowList" :key="index" @tap="onDevice(item, $event)"
+								 :data-index="index">
+									<!-- "/static/trampolineS.png" -->
+									<view style="position: relative; height: 100%;">
+										<image :src="index == cIndex ? '/static/deviceBg.png' : '/static/deviceBg_off.png'" class="data-png-64" mode="aspectFit"></image>
+										<image :src="item.mIcon" class="data-png-add" mode="aspectFit"></image>
+									</view>
+
+									<view class="flex-sub text-center">
+										<image :src="index == cIndex ? '/static/wifi_on.png' : '/static/wifi_off.png'" class="data-png-32" mode="aspectFit"></image>
+										<view class="text-gray">{{ item.cname }}</view>
+									</view>
+
+									<view style="position: absolute;right: 0;top: 0;" @tap.stop="onCloseDevice(item, $event)" :data-index="index">
+										<image :src="index == cIndex ? '/static/d_on.png' : '/static/d_off.png'" class="data-png-26" mode="aspectFit"></image>
+									</view>
+								</view>
+								<view id="addDeviceView" class="width-device flex align-center" @tap="openDeviceList">
+									<view style="position: relative;height: 100%;">
+										<image src="/static/deviceBg.png" class="data-png-64" mode="aspectFit"></image>
+										<image src="/static/deviceAdd.png" class="data-png-add" mode="aspectFit"></image>
+									</view>
+
+									<view class="flex-sub text-center">
+										<view class="text-gray">添加设备</view>
+									</view>
+								</view>
+							</view>
+
+
+						</view>
+
+						<!-- 游戏推荐 -->
+						<view class="card-view" v-if="gameList.length !== 0">
+							<view class="text-left padding margin-xs flex justify-between">
+								<text class="text-black text-15px margin-left">游戏推荐</text>
+								<view data-type="game" @tap="onNavToGameMore" class="flex text-center justify-center align-center margin-right">
+									<view class="text-gray text-11px " style=" line-height: 12px; ">查看更多</view>
+									<image style="margin-left: 6rpx; width: 24rpx;height: 22rpx; " src="/static/right-g.png"></image>
+								</view>
+							</view>
+							<view class="cu-item shadow">
+								<view class="cu-form-group margin-top">
+									<view class="grid col-3 homepage-grid-square flex-sub ">
+										<view v-for="(item, index) in gameList" :key="index" @tap="onNavDetail(item)">
+											<image class="item-img" :src="item.gamePicture" mode="aspectFill"></image>
+											<view class="border text-center">{{ item.gameName }}</view>
+										</view>
+									</view>
+								</view>
+							</view>
+
+							<!-- <view @tap="onNavToGameMore" class="flex  text-center justify-center align-center padding-lg make-text-bPurple solid-top margin text-15px text-bold">
+								查看更多
+								<image style="margin-left: 20rpx; width: 28rpx;height: 28rpx;" src="../../../static/right-d.png"></image>
+							</view> -->
+						</view>
+						<!-- <button class="margin" @click="onWriteBLEConnectionValue({value:'V'})">设备版本</button> -->
+						<!-- <button class="margin" @click="openAcc">开启手机加速计和方向传感器</button> -->
+						<!-- <button class="margin" @click="closeAcc">关闭手机加速计和方向传感器</button> -->
+						<!-- <button class="margin" @click="openGyro">开启手机加速计和方向传感器</button> -->
+						<!-- <button class="margin" @click="stopGyro">关闭手机加速计和方向传感器</button> -->
+						<!-- <keyboard-listener @keydown="onKeyDown"></keyboard-listener> -->
+						<!-- 视频推荐 -->
+						<view class="card-view" v-if="videoList.length !== 0">
+							<view class="text-left padding margin-xs flex justify-between">
+								<text class="text-black text-15px margin-left">视频推荐</text>
+								<view data-type="video" @tap="onNavToGameMore" class="flex text-center justify-center align-center margin-right">
+									<view class="text-gray text-11px " style=" line-height: 12px; ">查看更多</view>
+									<image style="margin-left: 6rpx; width: 24rpx;height: 22rpx; " src="/static/right-g.png"></image>
+								</view>
+							</view>
+							<view class="cu-item shadow">
+								<view class="cu-form-group margin-top">
+									<view class="grid col-3 homepage-grid-square flex-sub ">
+										<view v-for="(item, index) in videoList" :key="index" @tap="onNavDetail(item)">
+											<image class="item-img" :src="item.gamePicture" mode="aspectFill"></image>
+											<view class="border text-center">{{ item.gameName }}</view>
+										</view>
+									</view>
+								</view>
+							</view>
+
+						</view>
+					</view>
+				</view>
+			</view>
+		</scroll-view>
+
+		<!-- 右下角导航栏 -->
+		<round-menu @trigger="onRoundTrigger"></round-menu>
+
+		<!-- 侧边栏 -->
+		<sideBar ref="sideBar"></sideBar>
+
+		<!-- 训练卡 -->
+		<view class="cu-modal" :class="modalName == 'sportCompletion' ? 'show' : ''">
+
+			<view style="
+			position: relative; 
+			width: 586rpx;
+			height: 766rpx;
+			background-color: #FFFFFF; 
+			border-radius: 25px;
+			display: inline-block;
+			vertical-align: middle;
+			margin-left: auto;
+			margin-right: auto;
+			overflow: hidden;">
+				<view style="position: relative; width: 100%; height: 328rpx;">
+					<image style="position: absolute;top: 0;left: 0; width: 100%;height: 100%;" src="../../../static/sidebar_top_bg.png"></image>
+					<view class="flex flex-direction justify-around align-center" style="position: relative; height: 100%;">
+						<view class="text-white">已在哔嘣健身训练了</view>
+						<view class="text-white"><span style="font-size: 43px;">{{sportData.time}}</span> 分钟</view>
+						<view class="text-white">本次达标率{{sportData.percent}}%</view>
+					</view>
+				</view>
+				<view class="flex justify-around">
+					<view class="flex flex-direction justify-around align-center" style="position: relative; height: 162rpx;">
+						<view class="text-grey">消耗</view>
+						<view class="text-grey"><span style="font-size: 18px; color: #000000;">{{sportData.calorie}}</span> 卡</view>
+					</view>
+					<view class="flex flex-direction justify-around align-center" style="position: relative; height: 162rpx;">
+						<view class="text-grey">踩中</view>
+						<view class="text-grey"><span style="font-size: 18px; color: #000000;">{{sportData.hit}}</span> 次</view>
+					</view>
+					<view class="flex flex-direction justify-around align-center" style="position: relative; height: 162rpx;">
+						<view class="text-grey">失误</view>
+						<view class="text-grey"><span style="font-size: 18px; color: #000000;">{{sportData.miss}}</span> 次</view>
+					</view>
+				</view>
+				<view class="flex flex-direction justify-around align-center margin-top-sm">
+					<view style="position: relative; width: 500rpx; border:1rpx solid #EEEEEE ;"></view>
+				</view>
+				<view class="flex flex-direction justify-around align-center" style="height: 230rpx;">
+					<view class="text-black text-16px">非常优秀,继续加油!</view>
+					<view class="flex justify-center align-center text-white make-bg-bPurple round text-16px" style="width: 300rpx;height: 80rpx;"
+					 @tap="hideModal">确定</view>
+				</view>
+			</view>
+		</view>
+		<!-- :class="modalName == 'jumpAnimation' ? 'show' : ''" -->
+		<view class="cu-modal " :class="modalName == 'jumpAnimation' ? '' : ''">
+
+			<view style="
+			position: relative; 
+			width: 586rpx;
+			height: 400rpx;
+			background-color: #FFFFFF; 
+			border-radius: 4px;
+			display: inline-block;
+			vertical-align: middle;
+			margin-left: auto;
+			margin-right: auto;
+			overflow: hidden;">
+				<view style="height: 100%;display: flex;justify-content: center;align-items: center;">
+					<character></character>
+				</view>
+			</view>
+		</view>
+
+		<!-- 引导蒙层 bGuidePages guideCurrent-->
+		<code-elf-guide ref="codeElfGuide" v-if="bGuidePages" @hide="guideHide" @change="onGuideChange" :current="guideCurrent"></code-elf-guide>
+
+		<!-- <view v-if="bStartBoxingPost" class="CountDownMask">
+			{{BoxingPostCountDownText}}
+		</view> -->
+
+		<view class="cu-modal " :class="modalName=='showPlanTipModal'?'show':''" @touchmove.stop.prevent="moveBoxingHandle">
+			<view class="cu-bind-modal">
+				<view style="position: absolute; top: 0; left: 0; width: 100%; height:100%;">
+					<image style="position: absolute;top: 0;left: 0; width: 100%;height: 100%;" src="/static/modelBg.png"></image>
+				</view>
+				<view class="flex flex-direction justify-between " style="position: relative; height: 100%;">
+					<view class="flex justify-around justify-center align-center" style="margin: 170rpx 30rpx 0 30rpx;">
+						<view style="width: 80rpx;height: 2rpx;border-radius: 2px; background-color: #cbcdcf;"></view>
+						<view class="make-text-bPurple" style=" font-size: 20px;">提示</view>
+						<view style="width: 80rpx;height: 2rpx;border-radius: 2px;background-color: #cbcdcf;"></view>
+					</view>
+					<view class="text-16px" style="align-self: center; max-width: 200px; word-break: break-all;">{{planTip[planTipIndex]}}</view>
+
+					<view class="flex justify-around align-center" style=" border-top: 1rpx solid #EEEEEE; margin-bottom: 2px;">
+						<view class="flex justify-center align-center  text-16px" style="width: 100%;height: 123rpx;" @tap="hidePlanTipModal">取消</view>
+						<view style="height: 123rpx;width: 1px;background-color: #EEEEEE;"></view>
+						<view class="flex justify-center align-center  text-16px" style="width: 100%;height: 123rpx;" @tap="confirmPlanTipModal">确定</view>
+					</view>
+				</view>
+
+
+			</view>
+		</view>
+
+		<ModalTip ref='modalTipRef' :class="modalName=='showModalTip'?' show':''" @hide="onModalTipHide" @confirm="onModalTipConfirm"></ModalTip>
+
+	</view>
+</template>
+
+<script>
+	import uniNavBar from '@/components/uni-nav-bar/uni-nav-bar.vue';
+	import uCharts from '@/components/u-charts/u-charts.js';
+	import myPicker from '@/components/slambb-picker/slambb-picker.vue';
+	import pickerData from '@/components/slambb-picker/picker.js';
+	import date from '@/util/util-js/date.js';
+	import sideBar from '@/components/side-bar/side-bar.vue';
+
+	import reqUtil from '@/util/util-js/requstUtil.js';
+	import config from '@/common/config.js';
+
+	import uniCountDown from '@/components/uni-count-down/uni-count-down.vue'
+
+	import elect from "@/components/electAni/electAnimation.vue"
+	import character from "@/components/electAni/character.vue"
+	import fruit from "@/components/fruitMachine/fruitMachine.vue"
+
+	import promptBox from "@/components/prompt-box/prompt-box.vue"
+
+	import roundMenu from "@/components/round-menu/round-menu.vue"
+	import codeElfGuide from '@/components/code-elf-guide/code-elf-guide.vue'
+
+	import boxingPost from "@/components/modal/boxing-post/boxing-post.vue"
+
+	import boxingHit from "@/components/modal/boxing-hit/boxing-hit.vue"
+
+	import AccAndOri from "@/util/util-js/AccAndOri.js"
+
+	import AvatarConfig from "@/util/util-js/avatar.js"
+
+	import HitEffect from "@/components/effectHit/hitEffect.vue"
+	import HitFistEffect from "@/components/effectHit/hitFistEffect.vue"
+
+	import ModalTip from "@/components/modal-tip/modalTip.vue"
+
+	import keyboardListener from '@/components/keyboard-listener/keyboard-listener.vue'
+
+
+	import {
+		mapState,
+		mapMutations
+	} from 'vuex';
+
+	var _self;
+	var canvaArcbar1;
+	var canvaLineA = null;
+	var sportSpeedInterval = null;
+	var personalAcc = null;
+
+	export default {
+		computed: mapState(['bCanvasShow', 'forcedLogin', 'hasLogin', 'userName', 'avatarUrl', 'days', 'remainingDays',
+			'signature', 'weight', 'height', 'planData', 'BLEDeviceShowList', 'BLEConnectDevice', 'bPlanExpired',
+			'bPlanFinish',
+			'bGuidePages',
+			'globalAcc', 'globalOri', 'DeviceBindingList', 'ConnectBindingDevice', 'cIndex', 'bNewGuide', 'localSportTime',
+			'currentModeIndex', 'oldArcbarProCalorie', 'oldArcbarAllCalorie', 'bOpenBluetooth', 'bOpenSuccess',
+			'bListenAdapterStateChange', 'bConnection', 'bVerifiedConnection', 'currentInstruction', 'instructionState',
+			'LocationGameUrl',
+			'bPhoneMatched'
+		]),
+		components: {
+			uniNavBar,
+			myPicker,
+			sideBar,
+			uniCountDown,
+			elect,
+			character,
+			fruit,
+			roundMenu,
+			codeElfGuide,
+			boxingPost,
+			boxingHit,
+			promptBox,
+			HitEffect,
+			HitFistEffect,
+			ModalTip,
+			keyboardListener
+		},
+
+		data() {
+			return {
+				title: 'pk模式', //pk模式 健身模式
+				modalName: null,
+				originalDate: '', //记录new date
+				currentDate: '', //当前日期
+				cWidthArcbar: '', //圆弧进度图
+				cHeightArcbar: '', //圆弧进度图
+				arcbarWidth: '', //圆弧进度图,进度条宽度,此设置可使各端宽度一致
+				pixelRatio: 1,
+				textarea: '',
+				arcbarImagePath: '/static/logo.png',
+				cWidth: '',
+				cHeight: '',
+				scrollviewHight: '',
+				// 顶部区域部分
+				topScrollHight: '',
+
+				// 选择器
+				pickerObj: {},
+				lineAImagePath: '/static/logo.png',
+
+				// value: [9999, month - 1, day - 1],
+				visible: true,
+				indicatorStyle: `height: ${Math.round(uni.getSystemInfoSync().screenWidth / (750 / 100))}px;`,
+
+				//设备列表
+				deviceList: [{
+					name: '蹦床',
+					icon: '/static/trampoline.png'
+				}],
+
+				//体重列表
+				weightLigt: [],
+
+				// cIndex: -1,
+				cState: 1,
+
+				//游戏列表
+				gameList: [],
+
+				//视频列表,现在视频是和游戏一起管理
+				videoList: [],
+
+				//运动模式
+				planModeList: [{
+						id: 0,
+						image: '/static/plan-ranzhi.png',
+						name: '燃脂模式'
+					},
+					{
+						id: 1,
+						image: '/static/plan-qixing.png',
+						name: '骑行模式'
+					},
+					{
+						id: 2,
+						image: '/static/plan-jianfei.png',
+						name: '减肥塑身'
+					},
+					{
+						id: 3,
+						image: '/static/plan-youyang.png',
+						name: '有氧恢复'
+					},
+					{
+						id: 4,
+						image: '/static/plan-saidao.png',
+						name: '赛道模式'
+					},
+					{
+						id: 5,
+						image: '/static/plan-shandi.png',
+						name: '山地模式'
+					},
+					{
+						id: 6,
+						image: '/static/plan-dianbo.png',
+						name: '颠簸模式'
+					},
+					{
+						id: 7,
+						image: '/static/plan-yueye.png',
+						name: '越野模式'
+					},
+					{
+						id: 8,
+						image: '/static/plan-jianxie.png',
+						name: '间歇模式'
+					}
+				],
+				planModeSelectId: 7,
+				planModeSelectName: '越野模式',
+				planModeSelectIcon: '/static/plan-yueye.png',
+
+				showPlanMode: true,
+
+				showRunMode: true,
+				showPlayMode: true,
+
+				// 模式名称
+				modelList: [{
+						id: 0,
+						name: '拳击模式'
+					},
+					{
+						id: 1,
+						name: '心电图模式'
+					}
+				],
+
+				//新增心电图部分
+				//步骤点
+				basicsList: [{
+					cuIcon: 'radioboxfill',
+					name: '1'
+				}, {
+					cuIcon: 'radioboxfill',
+					name: '2'
+				}, {
+					cuIcon: 'radioboxfill',
+					name: '3'
+				}, {
+					cuIcon: 'radioboxfill',
+					name: '4'
+				}, {
+					cuIcon: 'radioboxfill',
+					name: '5'
+				}, {
+					cuIcon: 'radioboxfill',
+					name: '6'
+				}, {
+					cuIcon: 'radioboxfill',
+					name: '7'
+				}],
+				basics: 0,
+				// 默认不运行
+				bElectRun: false,
+				// 是否是第一运行
+				bFirstRun: true,
+				//心电图定义,数据
+				electro: {
+					oldData: [], //心电图旧的数据
+					oldLine: {},
+					bCanDelete: false,
+					mValue: 60, //绘制时候中间值的数据
+					curCount: 6,
+					dataLenght: 6,
+					curElectData: null,
+					duration: 2000, //整个心电图运行的时间
+					speed: 100, //心电图运行的速度,执行setInterval的间隔
+					frequencyTime: 20, //_self.electro.frequencyTime*_self.electro.speed 心电图生成的频率间隔
+
+					type: [{
+						data: [10, -20, 80, -70, 10, -10],
+						name: "心电图形状1",
+					}, {
+						data: [-30, 80, -70, 10, -5, 5],
+						name: "心电图形状2"
+					}]
+				},
+				bCanDelete: false,
+
+				sportData: {
+					calorie: 0,
+					hit: 0,
+					miss: 0,
+					percent: 0,
+					time: 0,
+					allData: 0
+				},
+
+				//里程
+				currMileage: 0,
+				// 计算速度的临时里程
+				tempMileage: 0,
+				// 速度
+				currSpeed: 0,
+
+				// 心电图 的图片地址
+				electUrl: '',
+
+				// 心电图部分图片切换
+				bRoundJump: true,
+				bVolume: true,
+
+
+
+				//设置滚动栏高度
+				scrollTop: 0,
+				//scroll view 跳转到对应的组件上
+				toView: '',
+				guideCurrent: 0,
+
+				bHide: false,
+
+				//屏幕抖动
+				bEFHitShake: false,
+				bStartBoxingPost: false,
+				BoxingPostCountDownText: 3,
+				b_countDown: null,
+
+				countDownUrl: [
+					"/static/personal/audio/GO.mp3",
+					"/static/personal/audio/1.mp3",
+					"/static/personal/audio/2.mp3",
+					"/static/personal/audio/3.mp3"
+				],
+				threeUrl: "/static/personal/audio/3.mp3",
+				twoUrl: "/static/personal/audio/2.mp3",
+				oneUrl: "/static/personal/audio/1.mp3",
+				goUrl: "/static/personal/audio/GO.mp3",
+
+				dangdang: "/static/personal/audio/dangdang.mp3",
+				personalAudioContext: null,
+
+				planTip: [
+					'您今天的目标已经达成,是否进行自由训练.',
+					'您今天的目标还没完成,是否结束训练.'
+				],
+				planTipIndex: 0,
+				//蓝牙对象
+				BLERSSIInterval: null,
+
+				//匹配的ai信息
+				aiObj: {
+					name: '匿名',
+					avatar: '/static/defaultAvatar.png'
+				},
+				aiOldObj: {
+					name: '匿名',
+					avatar: '/static/defaultAvatar.png'
+				},
+				currentMode: 'pkMode', //calorieMode
+
+				bHitShake: false,
+
+				bAiHitShake: false,
+				//限制重连,比如去了对应硬件连接页面,限制这个页面的重连操作
+				bLimitReconnection: false,
+
+				/**
+				 * 首页这里连接了蓝牙,然后选择框回来后show会触发,触发时候检测一下是否有对应的
+				 * 匹配蓝牙
+				 */
+				bGetBondTesting: false,
+
+			};
+		},
+		onLoad() {
+			//设置self
+			_self = this;
+			// 圆形进度条样式
+			this.cWidthArcbar = uni.upx2px(480); //这里要与样式的宽高对应
+			this.cHeightArcbar = uni.upx2px(580); //这里要与样式的宽高对应
+			this.arcbarWidth = uni.upx2px(24);
+			// 体重数据样式
+			this.cWidth = uni.upx2px(750);
+			this.cHeight = uni.upx2px(300);
+			// 心电图数据样式
+			this.eWidth = uni.upx2px(464);
+			this.eHeight = uni.upx2px(140);
+			// #ifdef APP-PLUS || H5
+			//监听
+			uni.$on('personalShowLineA', this.personalShowLineA);
+			uni.$on('updateArcbarData', this.updateArcbarData);
+			// #endif
+			// #ifdef MP
+			this.personalShowLineA();
+			// #endif
+
+			//监听
+			uni.$on('callbackCloseBLE', this.callbackCloseBLE);
+			// uni.$on('callbackBLEState', this.callbackBLEState);
+
+			//获得游戏列表
+			reqUtil
+				.requestData(config.URL.GAMERECOMMEND, {
+					recommendType: 2,
+					endTime: config.endTime
+				})
+				.then(
+					res => {
+						console.log('GAMERECOMMEND =====', res);
+						if (res.code == 0) {
+							if (res.data.gameList.length > 3) {
+								this.gameList = this.gameList.concat(res.data.gameList.slice(0, 3));
+							} else {
+								this.gameList = this.gameList.concat(res.data.gameList);
+							}
+						}
+					},
+					e => {
+						console.log(e);
+					}
+				);
+			//获得视频列表
+			reqUtil
+				.requestData(config.URL.GAMERECOMMEND, {
+					recommendType: 1,
+					endTime: config.endTime
+				})
+				.then(
+					res => {
+						// console.warn('GAMERECOMMEND =====', res);
+						if (res.code == 0) {
+							if (res.data.gameList.length > 3) {
+								this.videoList = this.videoList.concat(res.data.gameList.slice(0, 3));
+							} else {
+								this.videoList = this.videoList.concat(res.data.gameList);
+							}
+						}
+					},
+					e => {
+						console.log(e);
+					}
+				);
+
+			this.personalShowLineA();
+
+			//初始化后设置一下pickerObj
+			this.pickerObj = {
+				pickerLeftList: pickerData.getWeightList().leftList,
+				pickerRightList: pickerData.getWeightList().rightList,
+				pickerType: 'doubleItem',
+				pickerUnit: '公斤',
+				pickerTitle: '记体重',
+				defaultValue: this.weight,
+				showInput: true,
+			};
+
+
+			this.getPlanData(function() {
+				// 如果个人页面直接获取数据
+				_self.showArcbar();
+
+			});
+
+			this.testList = [{
+				cname: "拳击柱",
+				ename: "boxingPost",
+				icon: "/static/modal/boxing-post/left-hook-h@2x.png",
+				mIcon: "/static/modal/boxing-post/left-hook-m@2x.png",
+			}];
+
+			this.personalAudioContext = uni.createInnerAudioContext();
+			this.personalAudioContext.autoplay = false;
+			this.personalAudioContext.src = this.dangdang;
+			this.personalAudioContext.volume = 1;
+
+			//获取本地记录的运动时间
+			uni.getStorage({
+				key: 'localSportTime',
+				success: function(res) {
+					// console.log("本地的时间:",res.data);
+					_self.$store.state.localSportTime = res.data;
+				}
+			});
+
+			//获取设备信息,上报服务器
+			this.gOnAddClientInfo();
+
+		},
+		onShow() {
+			_self.bHide = false;
+
+			if (canvaArcbar1)
+				_self.updateArcbarData();
+
+			// console.warn('this.BLEConnectDevice:',this.BLEConnectDevice);
+			//this.bConnection && 
+			if (this.bVerifiedConnection && this.BLEConnectDevice) {
+				// console.log('this.BLEConnectDevice:',this.BLEConnectDevice);
+				this.updateBLECIndex();
+
+				setTimeout(() => {
+					/**
+					 * 如果是首页连接,则检测
+					 */
+					if (this.bGetBondTesting) {
+						this.onGetBondDevice();
+						this.bGetBondTesting = false;
+					}
+				}, 2000)
+
+			}
+
+			console.log('personal show');
+
+			this.bLimitReconnection = false;
+
+		},
+		onReady() {
+			// 计算屏幕剩余高度  填补剩余高度
+			uni.getSystemInfo({
+				success(res) {
+					_self.phoneHeight = res.windowHeight;
+					// 计算组件的高度
+					let view = uni.createSelectorQuery().select('#nav-bar');
+					view.boundingClientRect(data => {
+						// console.log('data===:', data);
+						if (data != null) {
+							_self.navHeight = data.height;
+							_self.scrollviewHight = _self.phoneHeight - _self.navHeight;
+							_self.topScrollHight = _self.phoneHeight - _self.navHeight - 30;
+						}
+					}).exec();
+				}
+			});
+
+		},
+		onUnload() {
+			console.log("personal ********* onUnload *********");
+			// #ifndef APP-PLUS||H5
+			//监听
+			console.log('移除监听');
+			uni.$off('personalShowLineA', this.personalShowLineA);
+			uni.$off('updateArcbarData', this.updateArcbarData);
+			// #endif
+			//*****注释蓝牙操作******
+			uni.$off('callbackCloseBLE', this.callbackCloseBLE);
+			// uni.$off('callbackBLEState', this.callbackBLEState);
+			uni.$off('updateBLEDeviceData', this.callbackUpdateBLEData);
+
+			// // 停掉对应的interval
+
+			if (sportSpeedInterval) {
+				clearInterval(sportSpeedInterval);
+				sportSpeedInterval = null;
+			}
+			//unload 时候清除timeout
+			this.onUnloadCreateBLEConnectionTimeout();
+
+		},
+		onHide() {
+			_self.bHide = true;
+			console.log("personal ******* onHide *******");
+			_self.bElectRun = false;
+			//时间暂停 ,隐藏了 需要判断是否为空
+			if (_self.$refs.countDownObj)
+				_self.$refs.countDownObj.timePause('pause');
+			//心电图暂停
+			if (_self.$refs.electRef)
+				_self.$refs.electRef.pausedElect(true);
+
+		},
+		methods: {
+			...mapMutations(['accountLogin', 'getPlanData', 'addlocalCalorie', 'setLocalCalorie', 'setShowCalorie',
+				'syncLocalDataToServer', 'syncRequestEvent', 'setLocalSportTime',
+				'initAdapter', 'onCreateBLEConnection', 'onUnloadCreateBLEConnectionTimeout', 'onCloseBLEConnection',
+				'gOnAddClientInfo', 'onWriteBLEConnectionValue',
+				'gCreateFilterObj', 'gUpdateFilter', 'B_GetBondedDevices', 'B_OpenBLESetting'
+			]),
+			onKeyDown(e) {
+				console.log(e);
+			},
+			//登录的回调初始化
+			personalShowLineA() {
+
+				//获得体重列表
+				reqUtil.requestData(config.URL.USERGETWEIGHT).then(
+					res => {
+						// console.log('USERGETWEIGHT =====', res);
+						// this.$store.state.weight = res.data;
+						if (res.code == 0 && res.data) {
+							let list = [];
+							for (let i = 0; i < res.data.timestamp.length; i++) {
+								//String.fromCharCode(65 + i)
+								list.push(date.getWeightDate(res.data.timestamp[i]));
+							}
+
+							let lineData = {
+								// ["2012", "2013", "2014", "2015", "2016", "2017"]
+								categories: list,
+								series: [{
+									color: '#9797FF',
+									//["100", "10", "20", "50", "60", "70"]
+									data: res.data.weightList,
+									index: 0,
+									legendShape: 'curve',
+									name: '体重变化',
+									pointShape: 'circle',
+									show: true,
+									type: 'area'
+								}]
+							};
+							_self.showLineA('canvasLineA', lineData);
+						}
+					},
+					e => {
+						console.log(e);
+					}
+				);
+			},
+
+			showClickEvent() {
+				this.$refs.sideBar.showModal();
+				this.$store.state.bCanvasShow = false;
+			},
+			showModal(e) {
+				this.modalName = e.currentTarget.dataset.target;
+				this.$store.state.bCanvasShow = false;
+			},
+			hideModal(e) {
+				if (this.modalName == "sportCompletion") {
+					console.log("关闭卡片");
+					this.sportData = {
+						calorie: 0,
+						hit: 0,
+						miss: 0,
+						percent: 0,
+						time: 0,
+						allData: 0,
+					}
+				}
+				this.modalName = null;
+				this.$store.state.bCanvasShow = true;
+			},
+
+			//获取体重数据
+			onConfirm(e) {
+				// detail.__args__[0]
+				console.log('当前输出的体重:', e);
+				//把体重传上服务器
+				reqUtil
+					.requestData(
+						config.URL.USERADDWEIGHT, {
+							weight: e.value
+						},
+						'POST'
+					)
+					.then(
+						res => {
+							// console.log('USERADDWEIGHT =====', res);
+							_self.$store.state.weight = res.data.currentWeight;
+							let listData = res.data.weightList;
+							let list = [];
+							for (let i = 0; i < listData.timestamp.length; i++) {
+								//String.fromCharCode(65 + i)
+								list.push(date.getWeightDate(listData.timestamp[i]));
+							}
+
+							let lineData = {
+								// ["2012", "2013", "2014", "2015", "2016", "2017"]
+								categories: list,
+								series: [{
+									color: '#9797FF',
+									data: listData.weightList,
+									index: 0,
+									legendShape: 'curve',
+									name: '体重变化',
+									pointShape: 'circle',
+									show: true,
+									type: 'area'
+								}]
+							};
+
+							canvaLineA.updateData(lineData);
+						},
+						e => {
+							console.log(e);
+						}
+					);
+				this.hideModal();
+			},
+			onTestAddLocalCalorie() {
+				let _add = (10 * 1.875) / (4 * 30);
+				console.log(_add);
+				this.onUpdateCaloriePlane(10);
+				// this.onDeleteOnce();
+			},
+			// 进度条数据
+			arcbarData(_planData) {
+				let showCal = _planData.calorie,
+					showLCal = _planData.allCalorie,
+					LCalTip = '大卡',
+					showTip = '(未达标)';
+
+				// 如果运动的卡路里大于目标卡路里,设置为目标卡路里值,即为Max
+				if (showLCal >= showCal) {
+					showTip = '(达标)';
+				}
+
+				let series = [{
+					name: showTip,
+					data: _planData.allCalorie == 0 ? 0 : _planData.allCalorie / showCal,
+					color: '#2fc25b'
+				}];
+				return {
+					showCal,
+					showLCal,
+					LCalTip,
+					showTip,
+					series
+				}
+			},
+			// 圆形进度条
+			showArcbar() {
+				let {
+					showCal,
+					showLCal,
+					LCalTip,
+					series
+				} = this.arcbarData(_self.planData);
+				// console.log("series==", series[0]);
+				canvaArcbar1 = new uCharts({
+					$this: _self,
+					canvasId: 'canvasArcbar',
+					type: 'myArcbar',
+					fontSize: 11,
+					legend: {
+						show: false
+					},
+					background: '#FFFFFF',
+					pixelRatio: 1,
+					series: series,
+					animation: true,
+					width: _self.cWidthArcbar,
+					height: _self.cHeightArcbar,
+					dataLabel: true,
+					//  Math.round(chartData.series[0].data * 100) + '%'
+					title: {
+						// arcbarDate: date.formatDate(_self.originalDate),
+						name: showLCal,
+						molecularUnit: LCalTip, //单位的分子部分
+						denominatorUnit: showCal, //单位的分母部分
+						unitFontSize: 11, //单位字符大小
+						color: 'rgba(255, 255, 255, 1)',
+						fontSize: 28,
+						offsetX: -30,
+						offsetY: 10
+					},
+					subtitle: {
+						name: series[0].name,
+						color: 'rgba(255, 255, 255, 1)',
+						fontSize: 13,
+						offsetY: -75
+					},
+					extra: {
+						arcbar: {
+							type: 'default',
+							backgroundColor: 'rgba(234, 234, 255, 1)',
+							backgroundEndColor: 'rgba(234, 234, 255, 1)',
+							backgroundMiddle: 'rgba(158, 158, 255, 1)',
+							width: _self.arcbarWidth, //圆弧的宽度
+							lineColor: 'rgba(255, 255, 255, 1)',
+							lineEndColor: 'rgba(233, 233, 255, 1)'
+						}
+					}
+				});
+
+				// 更新位置同步
+				this.syncLocalDataToServer((res) => {
+					this.originalDate = res.newDate;
+					this.currentDate = date.formatTime(res.newDate);
+					this.updateArcbarData();
+				});
+			},
+			updateArcbarData(data) {
+				// if (data == "plan") {
+				// 	// 加入设置的卡路里小于本地,则更新本地最小值
+				// 	_self.addlocalCalorie(0);
+				// 	console.log("**************updateArcbarData");
+				// 	// 如果是计划设置好后
+				// 	// this.$store.state.bPlanFinish = true;
+				// 	// setTimeout(() => {
+				// 	// 	this.$store.state.bPlanFinish = false;
+				// 	// }, 10000)
+				// }
+				// console.log("updateArcbarData:",this.planData);
+				let {
+					showCal,
+					showLCal,
+					LCalTip,
+					series
+				} = _self.arcbarData(_self.planData);
+
+				if (showCal == _self.oldArcbarProCalorie && showLCal == _self.oldArcbarAllCalorie) {
+					console.log("没有改变值,不刷新表盘:", showCal, _self.oldArcbarProCalorie, showLCal, _self.oldArcbarAllCalorie);
+					return;
+				}
+				//这个是显示当前的总卡路里
+				_self.$store.state.oldArcbarAllCalorie = showLCal;
+				//这个是计划的卡路里
+				_self.$store.state.oldArcbarProCalorie = showCal;
+
+				canvaArcbar1.updateData({
+					series: series,
+					title: {
+						//这里的文案是自定义的,不写是不变的
+						name: showLCal,
+						molecularUnit: LCalTip, //单位的分子部分
+						denominatorUnit: showCal, //单位的分母部分
+					},
+					subtitle: {
+						//这里的文案是自定义的,不写是不变的
+						name: series[0].name
+					}
+				});
+			},
+			//没有限制下的更新表盘
+			updateNoLimit() {
+				let {
+					showCal,
+					showLCal,
+					LCalTip,
+					series
+				} = _self.arcbarData(_self.planData);
+
+				//这个是显示当前的总卡路里
+				_self.$store.state.oldArcbarAllCalorie = showLCal;
+				//这个是计划的卡路里
+				_self.$store.state.oldArcbarProCalorie = showCal;
+
+				canvaArcbar1.updateData({
+					series: series,
+					title: {
+						//这里的文案是自定义的,不写是不变的
+						name: showLCal,
+						molecularUnit: LCalTip, //单位的分子部分
+						denominatorUnit: showCal, //单位的分母部分
+					},
+					subtitle: {
+						//这里的文案是自定义的,不写是不变的
+						name: series[0].name
+					}
+				});
+			},
+			// 数据列表
+			showLineA(canvasId, chartData) {
+				canvaLineA = new uCharts({
+					$this: _self,
+					canvasId: canvasId,
+					type: 'area',
+					fontSize: 11,
+					padding: [15, 40, 0, 15],
+					legend: {
+						show: false,
+						padding: 0,
+						lineHeight: 10,
+						margin: 0
+					},
+					dataLabel: true,
+					dataPointShape: true,
+					dataPointShapeType: 'solid',
+					background: '#FFFFFF',
+					pixelRatio: 1,
+					categories: chartData.categories,
+					series: chartData.series,
+					animation: true,
+					enableScroll: true, //开启图表拖拽功能
+					enableBottomSolid: false,
+					xAxis: {
+						disableGrid: true,
+						type: 'grid',
+						gridType: 'dash',
+						itemCount: 7,
+						calibration: true,
+						scrollShow: false,
+						scrollAlign: 'left',
+						gridColor: 'rgba(175, 175, 175, 1)',
+						dashLength: 8
+						// boundaryGap: 'justify' //两端不留白配置
+					},
+					yAxis: {
+						// disabled: false,
+						disableGrid: true,
+						disableLine: true,
+						splitNumber: 10,
+						min: 0,
+						// max: 50,
+						format: val => {
+							// console.log("=======",val)
+							// return val.toFixed(0) + '斤'
+							return '';
+						}
+					},
+					width: _self.cWidth,
+					height: _self.cHeight,
+					extra: {
+						area: {
+							type: 'straight', //curve
+							opacity: 1,
+							addLine: true,
+							gradient: true,
+							width: 2
+						}
+					}
+				});
+
+			},
+			touchLineA(e) {
+				// console.log("touchLineA:", e);
+				if (canvaLineA) canvaLineA.scrollStart(e);
+			},
+			moveLineA(e) {
+				if (canvaLineA) {
+					canvaLineA.scroll(e);
+				}
+			},
+			touchEndLineA(e) {
+				if (canvaLineA) {
+					canvaLineA.scrollEnd(e);
+				}
+			},
+			// 跳转计划页面
+			openPlan(e) {
+				// console.log(e);
+				uni.navigateTo({
+					url: '../plan/plan?newsid=' + 11,
+					success: res => {},
+					fail: () => {},
+					complete: () => {}
+				});
+			},
+
+			// 跳转转换页面
+			onNavConver() {
+				uni.reLaunch({
+					url: '../../conversion-page/conversion/conversion',
+					success: res => {},
+					fail: () => {},
+					complete: () => {}
+				});
+			},
+			// 跳转我的页面
+			onNavMyPage() {
+				uni.navigateTo({
+					url: '../../my-page/homepage/homepage',
+					success: res => {},
+					fail: () => {},
+					complete: () => {}
+				});
+			},
+
+			updateBLECIndex() {
+				for (let i = 0; i < this.BLEDeviceShowList.length; i++) {
+					let eq = this.BLEDeviceShowList[i];
+					if ((eq.ename.indexOf("mobilePhoneBandage") > -1 && this.BLEConnectDevice.id == 0) ||
+						(eq.ename.indexOf("hotman") > -1 && this.BLEConnectDevice.id == 1) ||
+						(eq.ename.indexOf("BLEHandle") > -1 && this.BLEConnectDevice.id == 2)) {
+
+						eq.bRatio = true;
+						this.$store.state.cIndex = i;
+
+					}
+				}
+			},
+
+			//蓝牙断开连接时候
+			callbackCloseBLE() {
+				this.$store.state.cIndex = -1;
+				//蓝牙断开连接后,直接关闭
+				this.$refs.boxingPostRef.onCloseDevices();
+
+				if (!this.BLEConnectDevice) {
+					console.log('连接蓝牙对象为空,不进行重连!');
+					return;
+				}
+				//如果限制不走重连
+				if (this.bLimitReconnection) return;
+				//连接蓝牙
+				this.onCreateBLEConnection({
+					item: this.BLEConnectDevice,
+					initItem: false,
+					getSuccess: () => {
+						this.updateBLECIndex();
+
+						if (this.bHide) {
+							//弹出框时候,是隐藏状态
+							this.bGetBondTesting = true;
+						} else {
+							//没有弹出框时候,直接检测
+							this.onGetBondDevice();
+						}
+					},
+					getinitAdapter: () => {
+						// this.onDevice(item, e);
+						// console.log("未开启蓝牙模块?");
+					}
+				});
+			},
+			//蓝牙状态回调
+			callbackBLEState(res) {
+				console.log("callbackBLEState==", res);
+				if (this.cState != res.state) this.cState = res.state;
+			},
+			//设备回调事件
+			callbackUpdateBLEData(data) {
+				//如果在监听状态时候隐藏页面,返回
+				if (_self.bHide) return;
+				// console.log("callbackDeviceState==", data);
+				//连接了手柄模式
+				//没有开启指令不刷新
+				if (!this.instructionState.bOpen) return;
+
+				if (this.BLEConnectDevice.usageMode == "hotman") {
+					this.gUpdateFilter({
+						data: data,
+						callback: (res) => {
+							if (res.type == 'hit') {
+								this.$refs.boxingPostRef.onBLEHotmanUpdate(res);
+							}
+						}
+					});
+				} else if (this.BLEConnectDevice.usageMode == "general") {
+					//这个是普通打击模式
+					this.$refs.boxingPostRef.onBLEHandleUpdate(data);
+				}
+
+
+			},
+			//绑定设备函数
+			onBindingDevice(item, index) {
+				// console.log(item,index);
+				// e.currentTarget.dataset.index $event
+				if (index == this.cIndex) {
+					this.$store.state.cIndex = -1;
+					this.$store.state.ConnectBindingDevice = null;
+
+					setTimeout(() => {
+						uni.showToast({
+							icon: "none",
+							title: "断开连接",
+							duration: 1000
+						})
+					}, 300)
+
+				} else {
+					this.$store.state.cIndex = index;
+					this.$store.state.ConnectBindingDevice = item;
+					setTimeout(() => {
+						uni.showToast({
+							icon: "none",
+							title: "已连接",
+							duration: 1000
+						})
+					}, 300)
+					//连接后保存最近连接的设备
+				}
+
+			},
+			//关闭设备函数
+			onCloseBindingDevice(item, e) {
+				if (e.currentTarget.dataset.index == this.cIndex) {
+					uni.showModal({
+						title: '设备状态',
+						content: '是否断开连接',
+						ConfirmColor: '#A488DC',
+						success: res => {
+							if (res.confirm) {
+								this.$store.state.cIndex = -1;
+								this.$store.state.ConnectBindingDevice = null;
+							}
+						}
+					});
+				}
+			},
+			onNavBindingDevice() {
+				this.toView = "addDeviceView";
+			},
+			onDevice(item, e) {
+				if (this.cIndex !== -1) {
+					uni.showToast({
+						title: '当前已连接设备。',
+						icon: 'none'
+					})
+					return;
+				}
+				uni.showToast({
+					title: '连接设备中...',
+					icon: 'loading',
+					duration: 5000,
+					mask: true
+				})
+				//连接蓝牙
+				this.onCreateBLEConnection({
+					item: item,
+					index: e.currentTarget.dataset.index,
+					initItem: true,
+					getinitAdapter: () => {
+						this.onDevice(item, e);
+					},
+					getSuccess: () => {
+						if (this.bHide) {
+							//弹出框时候,是隐藏状态
+							this.bGetBondTesting = true;
+						} else {
+							//没有弹出框时候,直接检测
+							this.onGetBondDevice();
+						}
+					}
+				});
+			},
+			/**
+			 * 检测获取匹配的设备
+			 */
+			onGetBondDevice() {
+				/**
+				 * 假如手机没有匹配,断开连接
+				 */
+				this.B_GetBondedDevices({
+					success: (bondedDevice) => {
+						console.error("===========", bondedDevice);
+						if (bondedDevice == null) {
+							//这里只处理android 的情况,ios暂未实现相关功能,一定返回null
+							if (plus.os.name == 'Android') {
+								//此问题 华为手机容易出现
+								//android手机已配对的设备 不存在,但是app 又直接连接成功了。提示,并且断开app连接
+								//1.关闭当前连接
+								this.onCloseBLEConnection({
+									getSuccess: () => {}
+								});
+								uni.hideToast();
+								//2.跳转蓝牙设置
+								uni.showModal({
+									title: '蓝牙配对失败',
+									content: '1.请在蓝牙匹配框点击配对蓝牙。\r\n2.如果没有蓝牙配对提示框,去蓝牙页面重新刷新手机蓝牙。是否跳转手机蓝牙页面?',
+									success: (res) => {
+										if (res.confirm) {
+											this.B_OpenBLESetting();
+										}
+									}
+								})
+							}
+						}
+					}
+				});
+
+			},
+
+			openDeviceList(e) {
+				//先判断蓝牙是否初始化
+				/**
+				 * 蓝牙部分操作,转全局变量操作
+				 * */
+				console.log("openDeviceList bOpenBluetooth", this.bOpenBluetooth);
+				// #ifdef APP-PLUS
+				if (!this.bOpenBluetooth) {
+
+					this.initAdapter(() => {
+						uni.navigateTo({
+							// url: '../devices-category/devices-category',
+							url: '../devices-hardware/devices-hardware',
+							success: res => {
+								this.bLimitReconnection = true;
+							},
+							fail: () => {},
+							complete: () => {}
+						});
+					});
+
+					return;
+				}
+				// #endif
+				uni.navigateTo({
+					url: '../devices-hardware/devices-hardware',
+					success: res => {
+						this.bLimitReconnection = true;
+					},
+					fail: () => {},
+					complete: () => {}
+				});
+			},
+			onNavToMore() {
+				uni.navigateTo({
+					url: '../more/more?index=' + this.cIndex,
+					success: res => {},
+					fail: () => {},
+					complete: () => {}
+				});
+			},
+			onAddDevice() {
+				let deviceItem = {
+					name: '蹦床',
+					icon: '/static/trampoline.png'
+				};
+				if (this.deviceList.length != 0) {
+					this.deviceList = this.deviceList.concat(deviceItem);
+				} else {
+					this.deviceList = deviceItem;
+				}
+			},
+			onCloseDevice(item, e) {
+				//如果不是连接状态,则删除
+				if (e.currentTarget.dataset.index != this.cIndex) {
+					uni.showModal({
+						title: '设备状态',
+						content: '是否删除设备?',
+						ConfirmColor: '#A488DC',
+						success: res => {
+							if (res.confirm) {
+								this.$store.commit('deleteBLEDevice', e.currentTarget.dataset.index);
+							}
+						}
+					});
+					return;
+				}
+				uni.showModal({
+					title: '设备状态',
+					content: '是否断开连接?',
+					/**
+					 * 如果需要强制,不显示取消按钮
+					 */
+					showCancel: true,
+					ConfirmColor: '#A488DC',
+					success: res => {
+						if (res.confirm) {
+							this.onCloseBLEConnection({
+								getSuccess: () => {}
+							});
+
+						}
+					}
+				});
+			},
+
+			onNavDetail(item) {
+				console.log(item);
+				let temItem = encodeURIComponent(JSON.stringify(item));
+				// return;
+				uni.navigateTo({
+					url: '../../game-page/game-detail/game-detail?item=' + temItem
+				});
+			},
+			onNavToGameMore(e) {
+
+				uni.reLaunch({
+					url: '../../game-page/game/game?type=' + e.currentTarget.dataset.type
+				});
+			},
+			onChooseMode(item) {
+				console.log(item);
+				this.planModeSelectId = item.id;
+				this.planModeSelectName = item.name;
+				this.planModeSelectIcon = item.image;
+			},
+			changeRunMode() {
+				this.showRunMode = !this.showRunMode;
+			},
+			changePlayMode() {
+				this.showPlayMode = !this.showPlayMode;
+			},
+			//操作心电图
+			onSetBasics(index) {
+				// if (!this.bElectRun) return;
+				this.basics = index;
+
+				this.electro.duration = 2000 - (this.basics + 1) * 150;
+				this.$refs.electRef.changeDuration(this.electro.duration);
+
+			},
+			onElect(direRight) {
+				// if (!this.bElectRun) return;
+				if (direRight) {
+					this.basics = this.basics == this.basicsList.length - 1 ? 0 : this.basics + 1;
+				} else {
+					this.basics = this.basics == 0 ? 6 : this.basics - 1;
+				}
+				this.electro.duration = 2000 - (this.basics + 1) * 150;
+				this.$refs.electRef.changeDuration(this.electro.duration);
+
+			},
+
+			//判断是否有其他限制
+			onStartCheck() {
+				//#ifdef H5
+				// 直接走测试,如果是h5
+				this.onBoxingGuideFinish();
+				return;
+				//#endif
+				//分类型判断
+				if (0 === this.currentModeIndex) {
+					//拳击运动类型
+					// 1.检测是否有对应设备,
+					// if (0 === this.DeviceBindingList.length) {
+					// 	//如果没有绑定二维码设备,需要扫码绑定
+					// 	this.$store.state.bGuidePages = true;
+					// 	this.guideCurrent = 3;
+					// 	this.toView = "QRDeviceView";
+					// 	return;
+					// }
+					// // 2.检测是否连接设备
+					// if (this.cIndex == -1) {
+					// 	//没有连接设备,提示去连接设备
+					// 	this.$store.state.bGuidePages = true;
+					// 	this.guideCurrent = 4;
+					// 	this.toView = "bing-boxingPost";
+					// 	console.log("bing-boxingPost");
+					// 	return;
+					// }
+					//2.检测是否有设备
+					if (this.BLEDeviceShowList.length == 0) {
+						// this.$store.state.bGuidePages = true;
+						// this.guideCurrent = 1;
+						uni.showToast({
+							title: '请添加蓝牙设备',
+							icon: 'none'
+						})
+						this.toView = "addDeviceView";
+						return;
+					}
+					//2.检测是否连接设备 || this.BLEConnectDevice.ename !== 'BT04'
+					if (this.cIndex == -1) {
+						//没有连接设备,提示去连接设备
+						uni.showToast({
+							title: '请连接蓝牙设备',
+							icon: 'none'
+						})
+						this.toView = "addDeviceView";
+						return;
+					}
+				}
+
+
+				//3.检测一下计划日期
+				console.log(this.remainingDays);
+				if (this.planData.startTime > this.planData.endTime || this.remainingDays == 0) {
+					if (!this.$store.state.bPlanExpired) {
+						this.$store.state.bPlanExpired = true;
+						setTimeout(() => {
+							this.$store.state.bPlanExpired = false;
+						}, 3000)
+						uni.showToast({
+							title: "计划到期,请制定计划。",
+							icon: 'none'
+						})
+					}
+
+					this.$store.state.bGuidePages = true;
+					setTimeout(() => {
+						this.$refs.codeElfGuide.setCurrent(0);
+					}, 0)
+					this.toView = "projectButtonView";
+					return;
+				}
+
+				if (0 === this.currentModeIndex) {
+
+					//如果新手,调用新手教程
+					console.log("this.bNewGuide:", this.bNewGuide);
+					// this.$store.state.bNewGuide = true;
+					if (this.bNewGuide) {
+						// this.$refs.boxingPostRef.onGuideBoxingPostPlay();
+						// 拳击的新手提示
+						this.$store.state.bGuidePages = true;
+						this.guideCurrent = 5;
+						this.toView = "boxingHitID";
+						this.$store.state.bNewGuide = false;
+					} else {
+
+						//初始化filter快速打击对象
+						if (this.BLEConnectDevice.usageMode == "hotman") {
+							this.gCreateFilterObj();
+						}
+						//打开加速计
+						this.onWriteBLEConnectionValue({
+							value: "3"
+						});
+
+						setTimeout(() => {
+							//设置加速计20ms
+							this.onWriteBLEConnectionValue({
+								value: "b"
+							});
+
+						}, 1000)
+
+
+						//监听蓝牙回调
+						uni.$on('updateBLEDeviceData', this.callbackUpdateBLEData);
+
+
+						this.onBoxingGuideFinish();
+					}
+
+				}
+			},
+			onShowBoxingHitTip() {
+				this.$store.state.bGuidePages = true;
+				this.guideCurrent = 5;
+				this.toView = "boxingHitID";
+				this.$store.state.bNewGuide = false;
+			},
+			//检测是否符合要求,没有的话进行新手提示
+			onPersonalCheck() {
+				// //判断一下,是否达标,给moadal 提示 
+				// if (this.planData.allCalorie >= this.planData.calorie) {
+				// 	this.modalName = 'showPlanTipModal';
+				// 	this.planTipIndex = 0;
+				// } else {
+				// 	//如果是一开始,还没达标,就不给modal 提示
+				// 	this.onStartCheck();
+				// }
+				this.onStartCheck();
+			},
+			//
+			onBoxingGuideFinish() {
+
+				if (this.b_countDown) {
+					clearInterval(this.b_countDown);
+					this.b_countDown = null;
+				}
+
+
+				if (this.currentMode == 'calorieMode') {
+					this.personalAudioContext.stop();
+					this.personalAudioContext.play();
+
+					setTimeout(() => {
+						this.$refs.boxingPostRef.onBoxingPostPlay(true);
+					}, 600);
+				} else {
+					this.BoxingPostCountDownText = 3;
+					this.$refs.boxingPostRef.onSetRingAnimation(true);
+					uni.showToast({
+						title: '匹配中...',
+						mask: true,
+						icon: 'loading',
+						duration: 2000
+					})
+
+					setTimeout(() => {
+						//ai信息
+						this.onGetAiRandom();
+
+						// this.b_countDown = setInterval(() => {
+
+						// 	if (this.BoxingPostCountDownText <= 1) {
+						// 		if (this.b_countDown) {
+						// 			clearInterval(this.b_countDown);
+						// 			this.b_countDown = null;
+						// 		}
+						// 		setTimeout(() => {
+						// 			this.personalAudioContext.stop();
+						// 			this.personalAudioContext.play();
+						// 			this.$refs.boxingPostRef.onBoxingPostPlay(true);
+						// 			this.$refs.boxingPostRef.onSetRingAnimation(false);
+						// 			uni.hideToast();
+						// 		}, 800)
+						// 	}
+						// 	this.BoxingPostCountDownText--;
+						// }, 1000)
+						setTimeout(() => {
+							this.personalAudioContext.stop();
+							this.personalAudioContext.play();
+							this.$refs.boxingPostRef.onBoxingPostPlay(true);
+							this.$refs.boxingPostRef.onSetRingAnimation(false);
+							uni.hideToast();
+						}, 800)
+					}, 2000);
+
+				}
+
+
+			},
+			//运动时间
+			onUpdateSportTime(res) {
+				// console.log("同步的运动时间",res);
+				this.setLocalSportTime(res);
+			},
+
+			//运行心电图
+			onPauseElect() {
+				//1.检测一下计划日期
+				console.log(this.remainingDays);
+				if (this.planData.startTime > this.planData.endTime || this.remainingDays == 0) {
+					if (!this.$store.state.bPlanExpired) {
+						this.$store.state.bPlanExpired = true;
+						setTimeout(() => {
+							this.$store.state.bPlanExpired = false;
+						}, 3000)
+						uni.showToast({
+							title: "计划到期,请制定计划。",
+							icon: 'none'
+						})
+					}
+
+					this.$store.state.bGuidePages = true;
+					setTimeout(() => {
+						this.$refs.codeElfGuide.setCurrent(0);
+					}, 0)
+					this.toView = "projectButtonView";
+					return;
+				}
+				//2.检测是否有设备
+				// if (this.BLEDeviceShowList.length == 0) {
+				// 	this.$store.state.bGuidePages = true;
+				// 	this.guideCurrent = 1;
+				// 	this.toView = "addDeviceView";
+				// 	return;
+				// }
+				//2.检测是否连接设备
+				//隐藏功能
+				// if (this.cIndex == -1) {
+				// 	//没有连接设备,提示去连接设备
+
+				// 	uni.showModal({
+				// 		title: '提示',
+				// 		content: '还没有连接设备,是否跳转到设备处?',
+				// 		success: (res) => {
+				// 			if (res.confirm) {
+				// 				this.toView = "addDeviceView";
+				// 			}
+				// 		}
+				// 	})
+				// 	return;
+				// }
+
+
+				// 如果是第一次运行,设置最低速度
+				if (this.bFirstRun) {
+					this.bFirstRun = false;
+					this.onSetBasics(0);
+				}
+
+				if (this.bElectRun) {
+					if (sportSpeedInterval) {
+						clearInterval(sportSpeedInterval);
+						sportSpeedInterval = null;
+					}
+
+					this.bElectRun = false;
+					//时间暂停
+					this.$refs.countDownObj.timePause('pause');
+					this.$refs.electRef.pausedElect();
+				} else {
+					this.bElectRun = true;
+
+					sportSpeedInterval = setInterval(() => {
+						// 每秒检测,相当于m/s
+						this.currSpeed = this.tempMileage;
+						// 累计跑了多远
+						this.currMileage += this.tempMileage;
+						this.tempMileage = 0;
+					}, 1000);
+
+					//时间暂停
+					this.$refs.countDownObj.timePlay('play');
+					this.$refs.electRef.playElect(true);
+
+
+					//播放跳的动画
+					this.modalName = "jumpAnimation";
+					setTimeout(() => {
+						this.modalName = null;
+					}, 4000)
+
+				}
+			},
+
+			BasicsSteps() {
+				this.basics = this.basics == this.basicsList.length - 1 ? 0 : this.basics + 1;
+
+			},
+			//计划时间到, 心电图运行处理这里流程
+			onEndElect() {
+
+				clearInterval(sportSpeedInterval);
+				this.$refs.electRef.pausedElect(true);
+				this.bElectRun = false;
+				this.bFirstRun = true;
+				this.modalName = "sportCompletion";
+				this.sportData.time = this.planData.sportTime;
+				// 1. 计算miss 的个数
+				// this.sportData.miss = this.sportData.allData - this.sportData.hit;
+
+				// 1.计算 总量
+				this.sportData.allData = this.sportData.miss + this.sportData.hit;
+				// 2. 计算击中 的个数
+				if (this.sportData.hit != 0) {
+					let num = this.sportData.hit / this.sportData.allData;
+					this.sportData.percent = num.toFixed(2) * 100;
+				}
+				//TODO 运动的卡路里暂时是*10 57公斤(125磅) 300大卡 30分钟
+				//大概 跳的次数 /2
+				let hitCalorie = this.sportData.hit / 2;
+				this.sportData.calorie = hitCalorie.toFixed(0);
+
+				this.onUpdateCaloriePlane(this.sportData.calorie);
+
+			},
+			//更新运动数据
+			onUpdateCaloriePlane(data) {
+
+				// 记录卡路里到本地
+				this.addlocalCalorie(data);
+
+				this.updateArcbarData();
+			},
+
+			//跳中心电图部分
+			onDeleteOnce() {
+				if (this.bElectRun) {
+					this.$refs.electRef.jumpElect();
+					this.tempMileage++;
+				}
+
+			},
+
+			onSetVolume() {
+				if (this.bVolume) {
+					this.bVolume = false;
+					this.$refs.electRef.setVolume(0);
+				} else {
+					this.bVolume = true;
+					this.$refs.electRef.setVolume(1);
+				}
+			},
+
+			onMiss() {
+				this.sportData.miss++;
+			},
+			onAdd() {
+				this.sportData.hit++;
+			},
+
+			onRoundTrigger(data) {
+				// console.log("onRoundTrigger==", data);
+				// return;
+				let url = '';
+				switch (data.item.type) {
+					case "personal":
+						//个人中心页面
+						url = '../../personal-page/personal/personal';
+						break;
+					case "game":
+						url = '../../game-page/game/game';
+						break;
+					default:
+						url = '../../personal-page/personal/personal';
+						break;
+				}
+				uni.reLaunch({
+					url: url,
+					success: res => {},
+					fail: () => {},
+					complete: () => {}
+				});
+			},
+
+			/**
+			 * 同步本地数据到服务器
+			 */
+			onSyncData() {
+				this.syncRequestEvent({
+					success: () => {
+						this.updateArcbarData();
+					}
+				});
+				// 更新显示日期
+				this.originalDate = new Date();
+				this.currentDate = date.formatTime(this.originalDate);
+			},
+			hidePlanTipModal() {
+				this.modalName = null;
+				if (this.planTipIndex === 1) {
+					// 您今天的目标还没完成  是否结束训练
+					this.onBoxingPause(false);
+				}
+			},
+			confirmPlanTipModal() {
+				this.modalName = null;
+				if (this.planTipIndex === 0) {
+					this.onStartCheck()
+				} else if (this.planTipIndex === 1) {
+					// 您今天的目标还没完成  是否结束训练
+					this.onBoxingPause(true);
+				}
+			},
+			//断开连接时候,关闭
+			onCloseBoxingHit() {
+				console.log('关闭训练');
+				if (this.currentMode == 'pkMode') {
+					this.$refs.hitEffectRef.onStop();
+				}
+				this.onBoxingPause(true);
+			},
+			//点击暂停时候,判断一下是否完成目标
+			onBoxingPostControlPlay(bPlay) {
+				if (!bPlay) {
+
+					if (this.planData.allCalorie < this.planData.calorie) {
+						this.modalName = 'showPlanTipModal';
+						this.planTipIndex = 1;
+					} else {
+						//假如完成了目标,更新卡路里
+						this.onBoxingPause(true);
+					}
+				}
+			},
+			//点击切换模式
+			onModeEvent(data) {
+				console.log("当前模式:", data);
+				this.currentMode = data.mode;
+				this.title = data.name;
+
+				if (this.currentMode == 'calorieMode') {
+					setTimeout(() => {
+						this.updateNoLimit();
+					}, 0)
+
+				}
+			},
+			onAiHitEvent(bloodPoint) {
+
+				// this.onPlay({
+				// 	bloodPoint: num,
+				// 	createType: 'red',
+				// 	callback: (res) => {
+				// 		console.log("红色拳头击中对方:", res);
+				// 	}
+				// });
+				this.$refs.hitFistRef.onPlay({
+					bloodPoint: bloodPoint,
+					createType: 'red',
+					callback: () => {
+						if (this.bAiHitShake) return;
+						this.bAiHitShake = true;
+						this.$refs.aiHitEffectRef.onPlay();
+						this.$refs.aiHitEffectRef.onAIHit();
+						setTimeout(() => {
+							this.bAiHitShake = false;
+						}, 500)
+					}
+				});
+
+
+			},
+			//打击时候头像修改
+			onHitEvent(bloodPoint) {
+				// console.log("this.bHitShake:",this.bHitShake);
+
+				this.$refs.hitFistRef.onPlay({
+						bloodPoint: bloodPoint,
+						createType: 'blue',
+						callback: () => {
+							if (this.bHitShake) return;
+							this.bHitShake = true;
+							this.$refs.hitEffectRef.onPlay();
+							this.$refs.hitEffectRef.onMyHit();
+							setTimeout(() => {
+								this.bHitShake = false;
+							}, 500)
+						}
+					}
+
+				);
+			},
+
+			//弹出目标提示后,进行下一步
+			onBoxingPause(bFinish) {
+				if (bFinish) {
+					//停止蓝牙加速计
+					this.onWriteBLEConnectionValue({
+						value: "4"
+					});
+
+					uni.$off('updateBLEDeviceData', this.callbackUpdateBLEData);
+
+					console.log("停止时候,上传卡路里");
+					this.$refs.boxingPostRef.onBoxingPostStop();
+
+					this.syncRequestEvent({
+						success: () => {
+							this.updateArcbarData();
+						}
+					});
+
+					//停止时候,重置ai信息
+					this.aiObj.name = this.aiOldObj.name;
+					this.aiObj.avatar = this.aiOldObj.avatar;
+
+				} else {
+					//如果不是,继续调用播放
+					this.$refs.boxingPostRef.onBoxingPostPlay(true);
+				}
+
+			},
+
+			/**
+			 * 新手任务引导
+			 */
+			onGuideChange(e) {
+				let tempCurrent = e.detail.current;
+				if (tempCurrent == 1) {
+					_self.toView = "addDeviceView";
+				} else if (tempCurrent == 0) {
+					_self.toView = "projectButtonView";
+				}
+
+			},
+
+			guideHide(e) {
+				this.$store.state.bGuidePages = false;
+				if (e.current == 0 && !e.onlyHide) {
+					//跳转计划页面
+					this.openPlan();
+				} else if (e.current == 1 && !e.onlyHide) {
+					//跳转搜索设备页面
+					this.openDeviceList();
+				} else if (e.current == 3 && !e.onlyHide) {
+					//新手引导跳转扫码页面,直接走绑定 再check
+					this.openQRCode((res) => {
+						setTimeout(() => {
+							this.onPersonalCheck();
+						}, 200);
+					});
+				} else if (e.current == 4 && !e.onlyHide) {
+					//连接绑定设备
+					// this.openQRCode();
+					console.log(e);
+					// this.testList[e.dataset.index] DeviceBindingList
+					let _index = Number(e.device.dataset.index);
+					this.onBindingDevice(this.DeviceBindingList[_index], _index);
+
+					//连接设备后,再
+					setTimeout(() => {
+						this.onPersonalCheck();
+					}, 200);
+				} else if (e.current == 5 && !e.onlyHide) {
+					console.log("==:", e);
+					this.onBoxingGuideFinish();
+				}
+			},
+
+			mainScroll(e) {
+				if (_self.toView == "addDeviceView") {
+					_self.toView = "";
+					if (!_self.bGuidePages) return;
+					let view = uni.createSelectorQuery().select('#addDeviceView');
+					view.boundingClientRect(data => {
+						_self.$refs.codeElfGuide.setDeviceObj(data);
+					}).exec();
+				} else if (_self.toView == "projectButtonView") {
+					_self.toView = "";
+					if (!_self.bGuidePages) return;
+					_self.onGetProjectView();
+				} else if (_self.toView == "QRDeviceView") {
+					_self.toView = "";
+					if (!_self.bGuidePages) return;
+					let view = uni.createSelectorQuery().select('#QRDeviceView');
+					view.boundingClientRect(data => {
+						_self.$refs.codeElfGuide.setDeviceObj(data);
+					}).exec();
+				} else if (_self.toView == "bing-boxingPost") {
+					_self.toView = "";
+					if (!_self.bGuidePages) return;
+					let view = uni.createSelectorQuery().select('#bing-boxingPost');
+					view.boundingClientRect(data => {
+						_self.$refs.codeElfGuide.setDeviceObj(data);
+
+						console.log(data);
+					}).exec();
+				} else if (_self.toView == "boxingHitID") {
+					_self.toView = "";
+
+					// let view = uni.createSelectorQuery().select('#boxingHitID');
+					// view.boundingClientRect(data => {
+					// 	_self.$refs.codeElfGuide.setModalObj(data);
+
+					// 	console.log(data);
+					// }).exec();
+				}
+			},
+
+			onGetProjectView() {
+				let view = uni.createSelectorQuery().select('#projectButtonView');
+				view.boundingClientRect(data => {
+					_self.$refs.codeElfGuide.setProjectObj(data);
+				}).exec();
+			},
+
+			//拳击模块的回调
+			boxingUpdateCalorie(calorie) {
+				if (this.currentMode != 'pkMode') {
+					//这里调用一下设置可以播放音效
+					this.$refs.personalFruitRef.onCanPlay();
+				}
+
+				this.onUpdateCaloriePlane(calorie);
+
+
+			},
+			//扫码添加设备
+			openQRCode(callback) {
+				let that = this;
+				// 允许从相机和相册扫码
+				uni.scanCode({
+					success: function(res) {
+						// console.log('条码类型:' + res.scanType);
+						// console.log('条码内容:' + res.result);
+						let obj = JSON.parse(res.result)
+						let data = {
+							type: obj.type,
+							uuid: obj.uuid,
+						}
+					}
+				});
+			},
+
+			//屏幕抖动
+			onScreenShake() {
+				this.bEFHitShake = true;
+				setTimeout(() => {
+					this.bEFHitShake = false;
+				}, 500)
+			},
+
+			onGetAiRandom() {
+				let _self = this;
+
+				let avatarlist = AvatarConfig.getAvatarList().avatarList;
+				let _length = avatarlist.length;
+				let _index = Math.floor(Math.random() * _length);
+
+				console.log(avatarlist);
+
+				_self.aiObj.name = avatarlist[_index].name;
+				_self.aiObj.avatar = avatarlist[_index].url;
+			},
+			onBoxingGameOver(res) {
+				this.$refs.hitEffectRef.onStop();
+
+				this.onBoxingPause(true);
+
+				let _title = res.myWin ? "胜利" : "失败";
+				let _context = res.myWin ? "你已经赢得PK胜利!" : "你在PK中被打败了!";
+				this.modalName = "showModalTip"
+
+				this.$refs.modalTipRef.setShowData({
+					title: _title,
+					context: _context
+				});
+			},
+			onModalTipHide() {
+				this.modalName = null;
+
+			},
+			onModalTipConfirm() {
+				this.modalName = null;
+				//再来一局
+			},
+			onTestShare() {
+				uni.share({
+					provider: "weixin",
+					scene: "WXSenceTimeline",
+					type: 2,
+					imageUrl: "https://img-cdn-qiniu.dcloud.net.cn/uniapp/images/uni@2x.png",
+					success: function(res) {
+						console.log("success:" + JSON.stringify(res));
+					},
+					fail: function(err) {
+						console.log("fail:" + JSON.stringify(err));
+					}
+				});
+			},
+			openAcc() {
+				if (!this.globalAcc) {
+					AccAndOri.bindAcc((accId) => {
+						this.$store.state.globalAcc = accId;
+						console.log("初始化:globalAcc=", this.globalAcc);
+					});
+				}
+
+				if (!this.globalOri) {
+					AccAndOri.bindOri((oriId) => {
+						this.$store.state.globalOri = oriId;
+						console.log("初始化:globalOri=", this.globalOri);
+					});
+				}
+			},
+			closeAcc() {
+				AccAndOri.unBindAcc(this.globalAcc);
+				this.$store.state.globalAcc = null;
+
+				AccAndOri.unBindOri(this.globalOri);
+				this.$store.state.globalOri = null;
+			},
+			outGyro(o) {
+				console.log("Orientation\nAlpha:" + o.alpha + "\nBeta:" + o.beta + "\nGamma:" + o.gamma);
+			},
+			openGyro() {
+				if (!this.globalOri) {
+					AccAndOri.bindOri((oriId) => {
+						this.$store.state.globalOri = oriId;
+						console.log("初始化:globalOri=", this.globalOri);
+					});
+				}
+				uni.$on('watchOrientation', this.outGyro);
+			},
+			stopGyro() {
+				uni.$off('watchOrientation', this.outGyro);
+				AccAndOri.unBindOri(this.globalOri);
+				this.$store.state.globalOri = null;
+			},
+
+			onKeyInput: function(event) {
+				this.$store.state.LocationGameUrl = event.target.value
+			},
+
+			onNavFcGame() {
+				// console.log(0);
+				uni.navigateTo({
+					url: "../../fc-page/fc/fc"
+				})
+			},
+
+			onNavAppInfo() {
+				uni.navigateTo({
+					url: '../../info-page/app-info/app-info'
+				})
+			}
+
+
+
+		}
+	};
+</script>
+
+<style>
+	.bg-person {
+		background-color: #9797ff;
+	}
+
+	.plan-view {
+		overflow: hidden;
+		background-color: #9797ff;
+	}
+
+	.plan-l-tip-view {
+		border-radius: 80upx 0 0 80upx;
+		background-color: rgba(255, 255, 255, 0.05);
+	}
+
+	.plan-r-tip-view {
+		border-radius: 0 80upx 80upx 0;
+		background-color: rgba(255, 255, 255, 0.05);
+	}
+
+	.bottom-view {
+		background-color: rgba(246, 243, 249, 255);
+		padding-bottom: 20rpx;
+		border-radius: 80rpx 80rpx 0 0;
+		width: 100%;
+		overflow: hidden;
+	}
+
+	.time-view {
+		width: 100%;
+		margin-top: 53rpx;
+		/* border: 1rpx solid #DD514C; */
+	}
+
+	/*样式的width和height一定要与定义的cWidth和cHeight相对应*/
+	.qiun-charts-arcbar {
+		/* padding: 20rpx 15rpx; */
+		height: 556rpx;
+		position: relative;
+		/* border: 1rpx solid #000000; */
+	}
+
+	.charts-arcbar {
+		position: absolute;
+		/* margin-left: 81upx;
+		 */
+		left: 0;
+		right: 0;
+		top: 0;
+		/* bottom: 0; */
+		margin: auto;
+		width: 556upx;
+		height: 556upx;
+		/* border: 1rpx solid #FFFFFF; */
+	}
+
+	.charts-arcbar-img {
+		position: absolute;
+		left: 135upx;
+		width: 480upx;
+		height: 480upx;
+	}
+
+	.charts-pring-bottom {
+		position: relative;
+		width: 100%;
+		display: flex;
+		flex-direction: column;
+		justify-content: center;
+		align-items: center;
+
+	}
+
+	.charts-pring-button {
+		width: 178rpx;
+		height: 64rpx;
+		display: flex;
+		flex-direction: row;
+		justify-content: start;
+		align-items: center;
+		border-radius: 0 25px 25px 0;
+	}
+
+	/* 心电图 */
+	/* .qiun-charts-elect {
+		width: 500rpx;
+		height: 136rpx;
+	} */
+
+	.charts-elect {
+		width: 464rpx;
+		height: 96rpx;
+		border: 1rpx solid #000000;
+	}
+
+	.e-button {
+		background-color: rgba(255, 255, 255, 0.25);
+		border-radius: 45px;
+		margin: 5px 12px;
+		box-shadow: 1px 1px 3px #888888;
+		display: flex;
+		justify-content: center;
+	}
+
+	/* 曲线图 */
+	.qiun-charts-area {
+		width: calc(750rpx - 40rpx);
+		height: 300upx;
+		/* background-color: #007AFF; */
+		position: relative;
+	}
+
+	.charts-area {
+		position: absolute;
+		width: 750upx;
+		height: 300upx;
+	}
+
+	.qiun-charts-bottom-container {
+		height: 63px;
+		position: relative;
+		width: 100%;
+		justify-content: center;
+		align-items: center;
+		display: flex;
+		flex-direction: row;
+	}
+
+
+	.qiun-charts-bottom-right {
+		position: absolute;
+		left: calc(50% + 50rpx);
+		top: 15px;
+		margin-left: 20rpx;
+	}
+
+	/* picker */
+	.mpvue-picker-view {
+		width: calc(50% - 5px);
+		height: 300px;
+		/* background-color: rgba(255, 255, 255, 1); */
+		border-radius: 20px;
+	}
+
+	.item {
+		text-align: center;
+		width: calc(100% - 0px);
+		background-color: rgba(255, 255, 255, 1);
+		height: 88upx;
+		line-height: 88upx;
+		text-overflow: ellipsis;
+		white-space: nowrap;
+		font-size: 40upx;
+	}
+
+	.picker-unit {
+		position: absolute;
+		right: 70px;
+		top: 43%;
+	}
+
+	.left-button,
+	.right-button {
+		margin: 20px 0;
+		padding: 10px 30px;
+		background-color: #ffffff;
+	}
+
+	.left-button {
+		border-top-left-radius: 20px;
+		border-bottom-left-radius: 20px;
+		border-right: 1px solid #e6e6e6;
+	}
+
+	.right-button {
+		border-top-right-radius: 20px;
+		border-bottom-right-radius: 20px;
+	}
+
+	.png-size-28 {
+		width: 24px;
+		height: 24px;
+		margin-bottom: 4px;
+	}
+
+	.png-size-32 {
+		width: 32px;
+		height: 32px;
+	}
+
+	.png-size-34 {
+		width: 34px;
+		height: 34px;
+	}
+
+	/* 图标大小 */
+	.data-play {
+		width: 16px;
+		height: 16px;
+		margin-top: 10rpx;
+	}
+
+	.p-data-png {
+		width: 16px;
+		height: 16px;
+		margin: 5rpx 20rpx;
+	}
+
+	.data-png {
+		width: 16px;
+		height: 16px;
+		margin: 5rpx;
+	}
+
+	.data-png-20 {
+		width: 20px;
+		height: 20px;
+		margin: 0 14rpx;
+	}
+
+	.data-png-54 {
+		width: 54px;
+		height: 54px;
+		margin: 0 14rpx;
+	}
+
+	.data-png-add {
+		position: absolute;
+		left: 0;
+		top: 0;
+		right: 0;
+		bottom: 0;
+		margin: auto;
+		width: 34px;
+		height: 37px;
+	}
+
+	.time-container {
+		margin-top: 13px;
+		width: 100%;
+		height: 218rpx;
+		position: relative;
+		/* border: 1rpx solid #007AFF; */
+	}
+
+	.time-png {
+		width: 503rpx;
+		height: 222rpx;
+		position: absolute;
+		left: 0;
+		right: 0;
+		top: 0;
+		bottom: 0;
+		margin: auto;
+		z-index: 1;
+	}
+
+	.time-text {
+		font-size: 9px;
+		z-index: 10;
+		position: relative;
+		height: 100%;
+		display: flex;
+		justify-content: center;
+		align-items: center;
+		color: #FFFFFF;
+	}
+
+	.padding {
+		padding: 10rpx;
+	}
+
+	.logo {
+		height: 200rpx;
+		width: 200rpx;
+		margin-top: 200rpx;
+		margin-left: auto;
+		margin-right: auto;
+		margin-bottom: 50rpx;
+	}
+
+	.float-png {
+		position: absolute;
+		right: 15px;
+		bottom: 200px;
+		width: 56px;
+		height: 56px;
+	}
+
+	.moveCanvas {
+		position: fixed;
+		top: 9999rpx;
+		left: 0;
+		width: 188rpx;
+		height: 188rpx;
+	}
+
+	.scroll-class {
+		width: 100%;
+		overflow-x: hidden;
+		box-sizing: border-box;
+		/* border: 1rpx solid #000000; */
+	}
+
+	.homepage-grid-square {
+		width: 250rpx;
+		/* height: 250rpx; */
+		align-items: start;
+	}
+
+	.homepage-grid-square image {
+		width: 176rpx;
+		height: 176rpx;
+	}
+
+	.border {
+		/* width: 176rpx; */
+		font-size: 30rpx;
+		color: rgba(175, 175, 175, 1);
+		font-weight: 400;
+		text-align: center;
+		margin-top: 22rpx;
+		margin-bottom: 40rpx;
+	}
+
+	.item-img {
+		border-radius: 20rpx;
+		/* border: 1rpx solid #EEEEEE; */
+		box-shadow: 0px 1px 2px 0px rgba(113, 113, 219, 0.23);
+	}
+
+	.plan-Tip-child {
+		height: 120rpx;
+	}
+
+	.plan-mode-tip {
+		height: 90rpx;
+	}
+
+	.plan-grid-square {
+		width: 250rpx;
+		/* height: 250rpx; */
+		align-items: start;
+	}
+
+	.plan-grid-square image {
+		width: 168rpx;
+		height: 58rpx;
+	}
+
+	.plan-mode {
+		/* height: 54px; */
+		border-radius: 10px;
+		padding: 3px;
+		margin: 0 5px 10px 5px;
+		border: 1rpx solid #eeeeee;
+		/* box-shadow: 0px 1px 2px 0px rgba(113, 113, 219, 0.23); */
+		position: relative;
+	}
+
+	.plan-mode-selected {
+		/* height: 54px; */
+		padding: 3px;
+		margin: 0 5px 10px 5px;
+		background-size: contain;
+		background-clip: border-box;
+		background-repeat: no-repeat;
+		background-image: url(../../../static/plan-select-bg.png);
+		/* box-shadow: 0px 1px 2px 0px rgba(113, 113, 219, 0.23); */
+		position: relative;
+	}
+
+	.plan-mode-border {
+		/* width: 176rpx; */
+		font-size: 26rpx;
+		color: rgba(151, 151, 255, 1);
+		font-weight: 400;
+		text-align: center;
+	}
+
+	.button-fav {
+		background-color: rgba(153, 150, 252, 255);
+		color: #ffffff;
+		/* border-radius: 10px; */
+		/* width: 184rpx; */
+		height: 122rpx;
+		display: flex;
+		justify-content: center;
+		text-align: center;
+		align-items: center;
+		font-size: 14px;
+	}
+
+	.card-view-small {
+		/* border: 1rpx solid #000000; */
+		width: 80%;
+		border-radius: 20px;
+		margin-left: 50rpx;
+		overflow: hidden;
+		background-color: #ffffff;
+		box-shadow: 0px 2px 4px 0px rgba(113, 113, 219, 0.23);
+	}
+
+	.right-bg {
+		/* border: 1rpx solid #000000; */
+		border-radius: 8px;
+		background-color: #9797ff;
+		padding: 15rpx;
+		position: absolute;
+		right: 5%;
+		margin-top: 4%;
+	}
+
+	.plan-small-child {
+		background-color: #f5f5ff;
+		border-radius: 20px;
+		width: 480rpx;
+		height: 90rpx;
+		margin: 0 0 30rpx 30rpx;
+		/* margin-top: 60rpx; */
+	}
+
+	.cu-btn-plan {
+		position: relative;
+		border: 0upx;
+		display: inline-flex;
+		align-items: center;
+		justify-content: center;
+		box-sizing: border-box;
+		padding: 4upx 25upx 4upx 4upx;
+		margin-left: 5px;
+		font-size: 22upx;
+		height: 64upx;
+		line-height: 1;
+		text-align: center;
+		text-decoration: none;
+		overflow: visible;
+		margin-left: initial;
+		transform: translate(0upx, 0upx);
+		margin-right: initial;
+	}
+
+	.cu-btn-plan-child {
+		position: relative;
+		border: 0upx;
+		display: inline-flex;
+		align-items: center;
+		justify-content: center;
+		box-sizing: border-box;
+		padding: 0 4upx;
+		font-size: 22upx;
+		height: 56upx;
+		line-height: 1;
+		text-align: center;
+		text-decoration: none;
+		overflow: visible;
+		margin-left: initial;
+		transform: translate(0upx, 0upx);
+		margin-right: initial;
+	}
+
+	.cu-btn-plan-right {
+		position: relative;
+		border: 0upx;
+		display: inline-flex;
+		align-items: center;
+		justify-content: center;
+		box-sizing: border-box;
+		padding: 4upx 4upx 4upx 19upx;
+		margin-left: 5px;
+		font-size: 22upx;
+		height: 64upx;
+		line-height: 1;
+		text-align: center;
+		text-decoration: none;
+		overflow: visible;
+		margin-left: initial;
+		transform: translate(0upx, 0upx);
+		margin-right: initial;
+	}
+
+	/* 粗线条 */
+	.line-make {
+		margin-top: 11px;
+		margin-left: 8px;
+		border: 4rpx solid #FFFFFF;
+		width: 152rpx;
+		border-radius: 3px;
+	}
+
+
+	/* 头像背景处理 */
+	.avatar-bg-personal {
+		width: 34px;
+		height: 34px;
+		border-radius: 45px;
+		border: 2px solid #9997fc;
+		background-color: #9997fc;
+		box-sizing: border-box;
+	}
+
+
+	.avatar-bg-arrow {
+		position: absolute;
+		top: 12px;
+		left: calc(50% - 10px);
+		border-left: 10px solid transparent;
+		border-right: 10px solid transparent;
+		border-bottom: 10px solid #9997fc;
+	}
+
+	.elect-round-image {
+		width: 48px;
+		height: 48px;
+		z-index: 10;
+		box-shadow: 1px 1px 3px #888888;
+		border-radius: 45px;
+	}
+
+	.elect-personal {
+		/* width: 100%; */
+		height: 120rpx;
+		/* margin: 50rpx 0; */
+		margin-bottom: 50rpx;
+		border-radius: 45px;
+		padding: 10rpx;
+		border: 1rpx solid rgba(255, 255, 255, 0.11);
+		display: flex;
+		justify-content: center;
+		align-items: center;
+		position: relative;
+	}
+
+	/* 呼吸灯 */
+	.breathing-lamp {
+		animation-duration: 1s;
+		animation-timing-function: ease-out;
+		animation-fill-mode: inherit;
+		animation-iteration-count: infinite;
+		animation-name: run-lamp;
+		animation-play-state: running;
+	}
+
+	@keyframes run-lamp {
+
+		0%,
+		100% {
+			opacity: 1;
+			transform: scale(1);
+		}
+
+		50% {
+			opacity: 0.6;
+			transform: scale(0.9);
+		}
+
+	}
+
+	.personal-fruit-container {
+		position: absolute;
+		left: 0;
+		top: 0;
+		bottom: 0;
+		right: 0;
+		margin: auto;
+		display: flex;
+		align-items: center;
+		justify-content: center;
+		/* border: 1rpx solid #F0F0F0; */
+	}
+
+
+	.screen-jitter {
+		animation-duration: 1s;
+		animation-timing-function: ease-out;
+		animation-fill-mode: inherit;
+		animation-iteration-count: infinite;
+		animation-name: personal-shake;
+		animation-play-state: running;
+	}
+
+	.screen-red {
+		border: 1rpx solid #ff0000;
+	}
+
+	@keyframes personal-shake {
+
+		0%,
+		100% {
+			transform: translateX(0)
+		}
+
+		10% {
+			transform: translateX(-9px)
+		}
+
+		20% {
+			transform: translateX(8px)
+		}
+
+		30% {
+			transform: translateX(-7px)
+		}
+
+		40% {
+			transform: translateX(6px)
+		}
+
+		50% {
+			transform: translateX(-5px)
+		}
+
+		60% {
+			transform: translateX(4px)
+		}
+
+		70% {
+			transform: translateX(-3px)
+		}
+
+		80% {
+			transform: translateX(2px)
+		}
+
+		90% {
+			transform: translateX(-1px)
+		}
+	}
+
+	.CountDownMask {
+		position: absolute;
+		top: 0;
+		bottom: 0;
+		right: 0;
+		left: 0;
+		background-color: rgba(0, 0, 0, 0.5);
+		z-index: 1000;
+		display: flex;
+		justify-content: center;
+		align-items: center;
+		font-size: 100px;
+		font-weight: bold;
+		color: #FFFFFF;
+	}
 </style>

+ 2493 - 2469
util/util-js/store.js

@@ -1,2470 +1,2494 @@
-import Vue from 'vue'
-import Vuex from 'vuex'
-import config from 'common/config.js'
-import reqUtil from 'util/util-js/requstUtil.js'
-import date from 'util/util-js/date.js'
-import cNumber from 'util/util-js/makeNumber.js'
-import BLE from 'util/util-js/BLE.js';
-//快速打击部分
-import o0 from "@/util/util-js/o0.js"
-import o0Project from "@/util/util-js/o0Project.js"
-
-import deviceData from "@/util/util-js/devices.js"
-
-Vue.use(Vuex)
-
-const store = new Vuex.Store({
-	state: {
-		//引导层
-		bGuidePages: false,
-
-		//是否显示Canvas
-		bCanvasShow: true,
-		/**
-		 * 是否需要强制登录
-		 */
-		forcedLogin: false,
-
-		/**
-		 * 蓝牙实时发送数据的页面的名称
-		 */
-		currentPageName: '',
-
-		hasLogin: false,
-		userInfo: null,
-		userName: "匿名",
-		days: 0,
-		remainingDays: 0,
-		signature: '',
-		avatarUrl: "/static/defaultAvatar.png",
-		// 是否是新用户,
-		//TODO:登录接口返回的数据来判断
-		bNewUser: false,
-		//是否是第一次走新手
-		bNewGuide: false,
-		token: '',
-		gender: 0,
-
-		//省市区数据
-		city: {
-			label: '北京市-北京市-东城区',
-			cityCode: "110101",
-			//picker 选择器的index数组
-			value: [0, 0, 0]
-		},
-
-		birthday: date.formatTime(new Date()),
-		//默认值
-		height: 0,
-		weight: 0,
-		//最近在玩的列表
-		playGames: [],
-		//最近在玩的排行游戏列表
-		playRankingGames: [],
-		//全部的游戏列表
-		allGames: [],
-		//关注的游戏列表
-		favoriteGames: [],
-		// 排行榜里面显示的游戏
-		rankSelectedGame: null,
-		rankInfo: null,
-		cityName: "某市",
-		/**
-		 * 默认的运动数据
-		 * date.addDaysFromNewDate(new Date(),1)
-		 */
-		defaultPlanData: {
-			startTime: date.formatDate(new Date()),
-			endTime: date.addDaysFromNewDate(new Date(), 6),
-			targetWeight: 0, //目标公斤
-			calorie: 360, //运动消耗的卡路里,默认300 大卡
-			cumulativeCalorie: 0, //累计增重
-			sportTime: 40, //运动时间
-			/**
-			 * 本地记录的消耗卡路里数量
-			 */
-			localCalorie: 0,
-			/**
-			 * 显示卡路里,过了12点清空
-			 */
-			showCalorie: 0,
-			/**
-			 * 总和
-			 */
-			allCalorie: 0
-		},
-		/**
-		 * 计划的运动数据
-		 */
-		planData: {
-			startTime: date.formatDate(new Date()),
-			endTime: date.formatDate(new Date()), //date.addDaysFromNewDate(new Date(),1),
-			targetWeight: 0, //目标公斤
-			cumulativeCalorie: 0, //累计增重
-			calorie: 300, //运动消耗的卡路里
-			sportTime: 40, //运动时间
-			/**
-			 * 本地记录的消耗卡路里数量
-			 */
-			localCalorie: 0,
-			/**
-			 * 显示卡路里,过了12点清空
-			 */
-			showCalorie: 0,
-			/**
-			 * 总和
-			 */
-			allCalorie: 0
-		},
-
-		//记录表盘计划刷新的卡路里
-		oldArcbarProCalorie: 0,
-		//记录表盘当前的总卡路里
-		oldArcbarAllCalorie: 0,
-
-
-		//当前运动的世时间
-		localSportTime: 0,
-
-
-		//当前运动时间,运动时候记录的时间
-		runingTime: 0,
-		//蓝牙设备信息列表
-		//id 不可变,用于保存到本地区分
-		BLEInfoList: deviceData.getDeviceList(),
-		//记录的蓝牙设备,保存id, 和对应的蓝牙连接数据
-		BLEDeviceList: [],
-		//显示的蓝牙设备,取本地数据时候更新
-		BLEDeviceShowList: [],
-		//选择连接的蓝牙设备
-		BLEConnectDevice: null,
-		//获取到的服务
-		BLEGetServices: null,
-		//当前发送给蓝牙的指令,目前是只有蓝牙手柄
-		currentInstruction: '',
-
-		instructionState: {
-			// bAcc: false, //是否开启加速计状态
-			// bGyroscope: false, //是否开启陀螺仪状态
-			bOpen: false, //是否开启指令
-			bSteps: false, //是否开启步数
-		},
-
-
-		//绑定的设备
-		DeviceBindingList: [],
-		ConnectBindingDevice: null,
-
-		cIndex: -1,
-		//当前是否连接
-		bConnection: false,
-		/**
-		 * 通过验证的连接,比如通过mac验证,或者说是首页直连,都设置这个参数,确保已经连上
-		 */
-		bVerifiedConnection: false,
-
-		/**
-		 * Android 出现不匹配的情况下,判断
-		 * ios 暂时没有此类问题
-		 */
-		bPhoneMatched: false,
-
-		//最近连接过的设备
-		finallyUseDevice: null,
-
-		//phoneNumber
-		phoneNumber: '',
-		openid: '',
-		appleid: '',
-
-		//获取验证码
-		bCodeDisabled: false,
-		count: 59,
-		interval: null,
-
-		//conversion列表
-		oldSwiperList: [],
-
-		// 计划任务过期
-		bPlanExpired: false,
-		// 制定玩计划任务后
-		bPlanFinish: false,
-
-		//标准体重,男女根据当前年龄计算
-		standardWeight: 0,
-
-		//是否安装了微信
-		bInstallWechat: false,
-		bHideWeixin: false,
-
-		system: '', // 系统版本
-		platform: '', // 平台
-		appName: '',
-		version: '1.6.3', //软件版本
-		versionCode: '',
-		showEndTime: config.endTime, //游戏显示时间字段,后台返回对应此时间之前的数据
-
-		globalAcc: null,
-		globalOri: null,
-
-		//当前显示的模式下标
-		currentModeIndex: 0,
-
-		//蓝牙变量操作
-		/**
-		 * 操作蓝牙设备
-		 */
-		bOpenBluetooth: false,
-		/**
-		 * 是否初始化蓝牙适配器
-		 */
-		bOpenSuccess: false,
-		/**
-		 * 是否监听蓝牙状态变化
-		 */
-		bListenAdapterStateChange: false,
-		/**
-		 * 是否监听寻找新设备事件
-		 */
-		bListenDeviceFound: false,
-
-		// 设备Id
-		BLEDeviceId: "",
-		// 服务Id
-		BLEServiceId: "",
-		// 特征值id
-		BLENotifyCharacteristicId: "",
-
-		//监听rssi对象
-		BLERSSIInterval: null,
-
-		//蓝牙服务timeout
-		getBLEDeviceServicesTimeout: null,
-
-		//本地游戏地址
-		// http://192.168.0.112:7456/build/index.html
-		// http://127.0.0.1:7456/build/index.html
-		LocationGameUrl: "http://110.43.54.43/t8/",
-
-		//快速打击对象
-		filter: null,
-		deviceMs: 1,
-
-
-		/**
-		 * 蓝牙参数对象
-		 */
-
-		// 设备Id
-		deviceId: "",
-		// 服务Id
-		serviceId: "",
-		notifyCharacteristicId: "",
-		writeCharacteristicId: "",
-		currentInstruction: "",
-		showToast: false,
-		bListenerUpdate: false,
-		bListenerJson: false,
-		bListenerMac: false,
-	},
-	mutations: {
-
-		/**
-		 * 获取记录的最后一次连接设备
-		 * @param {Object} state
-		 */
-		getFinalUseDevice(state) {
-			// 获取本地存储的最后一次使用的设备
-			//1.获取最近连接的蓝牙设备, 指蓝牙搜索到的obj
-			const value = uni.getStorageSync('finallyUseDevice');
-			if (value) {
-				state.finallyUseDevice = value;
-			}
-			console.log('获取的finallyUseDevice', value);
-		},
-
-		/**
-		 * 存储最后一次使用的设备信息,后面登陆时候,如果存在设备最后一次使用信息,则自动连接
-		 * @param {Object} state
-		 * @param {Object} device
-		 */
-		setFinallUseDevice(state, device) {
-			uni.setStorage({
-				key: 'finallyUseDevice',
-				data: device,
-				success: (res) => {
-					state.finallyUseDevice = device;
-					console.log("保存finallyUseDevice:", res);
-				}
-			})
-		},
-		/**
-		 * 移除记录的use device
-		 */
-		clearFinallUseDevice(state) {
-			uni.removeStorage({
-				key: 'finallyUseDevice',
-				success: (res) => {
-					state.finallyUseDevice = null;
-					console.log("移除finallyUseDevice:", res);
-				}
-			})
-		},
-		/**
-		 * 设置运动时间
-		 * @param {Object} state
-		 * @param {Object} time
-		 */
-		setLocalSportTime(state, time) {
-			// let _sportTime = Number(time);
-			state.localSportTime = Number(time);
-
-			uni.setStorage({
-				key: 'localSportTime',
-				data: state.localSportTime,
-				success: (res) => {
-					// uni.showToast({
-					// 	title: "保存成功"
-					// })
-				}
-			})
-		},
-
-		/**
-		 * 设置卡路里
-		 * @param {Object} state
-		 * @param {Object} calorie
-		 */
-		setLocalCalorie(state, calorie) {
-			state.planData.localCalorie = Number(calorie);
-
-			uni.setStorage({
-				key: 'localCalorie',
-				data: state.planData.localCalorie,
-				success: (res) => {
-					// uni.showToast({
-					// 	title: "保存成功"
-					// })
-				}
-			})
-		},
-
-		/**
-		 * 设置表盘显示的卡路里,
-		 * @param {Object} state
-		 * @param {Object} calorie
-		 */
-		setShowCalorie(state, calorie) {
-			state.planData.showCalorie = Number(calorie);
-
-			uni.setStorage({
-				key: 'showCalorie',
-				data: state.planData.showCalorie,
-				success: (res) => {
-					// uni.showToast({
-					// 	title: "保存成功"
-					// })
-				}
-			})
-		},
-
-		/**
-		 * 增加卡路里
-		 * @param {Object} state
-		 * @param {Object} calorie
-		 */
-		addlocalCalorie(state, calorie) {
-			//卡路里不能为负数
-			calorie = Math.abs(calorie);
-
-			//当前需要添加的卡路里
-			let temNum = Number(calorie);
-			//本地的卡路里
-			let temNum2 = Number(state.planData.localCalorie);
-			// 本地加 + 传入的卡路里
-			let _numberLocal = temNum.add(temNum2);
-
-			//显示的卡路里
-			let _showCalorie = Number(state.planData.showCalorie);
-			//显示的卡路里加上 本地卡路里 和添加的卡路里之和要小于或等于 计划的卡路里
-			let _allCalorie = _numberLocal.add(_showCalorie);
-			// console.log("计算的最后卡路里_showCalorie:", _showCalorie,_allCalorie);
-			//如果超过计划的,用计划的卡路里记录
-			if (_allCalorie > state.planData.calorie) {
-				let _calorie = Number(state.planData.calorie);
-				//假如更新时候,localCalorie 值不为0,但是还未更新给服务器,此时,不能设置localCalorie 0
-				//用传入的值,减去 allcalorie 总和和目标的差
-				let _value = Number(_allCalorie).sub(_calorie);
-				let _endValue = Number(_numberLocal).sub(_value);
-				state.planData.localCalorie = Number(_endValue.toFixed(2));
-				//如果大于或者等于的话,用计划 于 显示的卡路里 差值
-				// state.planData.localCalorie = Number(_calorie.sub(_showCalorie).toFixed(2));
-
-				// //显示最大值
-				// state.planData.showCalorie = Number(_calorie.sub(state.planData.localCalorie).toFixed(2));
-			} else {
-				//
-				state.planData.localCalorie = Number(_numberLocal.toFixed(2));
-				// //输入的卡路里 + 自身显示的卡路里
-				// state.planData.showCalorie = Number(temNum.add(_showCalorie).toFixed(2)); 
-			}
-
-			console.log("计算的最后卡路里:", state.planData);
-
-			if (state.planData.localCalorie < 0) {
-				//如果修改计划时候,本地数据计算的结果为负数,先取总和,localCalorie负再重置为0
-				state.planData.showCalorie = _showCalorie.add(state.planData.localCalorie);
-				state.planData.allCalorie = state.planData.showCalorie;
-				state.planData.localCalorie = 0;
-			} else {
-				state.planData.allCalorie = _showCalorie.add(state.planData.localCalorie);
-			}
-
-
-
-
-			try {
-				uni.setStorageSync('localCalorie', state.planData.localCalorie);
-			} catch (e) {
-				// error
-				console.error(e);
-			}
-			try {
-				uni.setStorageSync('showCalorie', state.planData.showCalorie);
-			} catch (e) {
-				// error
-				console.error(e);
-			}
-			// uni.setStorage({
-			// 	key: 'localCalorie',
-			// 	data: state.planData.localCalorie,
-			// 	success: (res) => {
-			// 		// uni.showToast({
-			// 		// 	title: "保存成功"
-			// 		// })
-			// 	}
-			// })
-
-			// uni.setStorage({
-			// 	key: 'showCalorie',
-			// 	data: state.planData.showCalorie,
-			// 	success: (res) => {
-			// 		// uni.showToast({
-			// 		// 	title: "保存成功"
-			// 		// })
-			// 	}
-			// })
-		},
-		/**
-		 * 每次登陆同步本地数据到服务器
-		 * 当天的数据更新,只更新一次
-		 * @param {Object} state
-		 */
-		syncLocalDataToServer(state, callback) {
-			let self = this;
-			uni.getStorage({
-				key: 'syncDate',
-				success: function(res) {
-					// console.log(res.data);
-					let oldTime = res.data;
-					let nDate = new Date();
-					let newTime = date.formatDate(nDate);
-					let days = date.datedifference(newTime, oldTime);
-					// console.log(days);
-					// 如果相差大于1天,
-					if (days != 0) {
-						// 更新存储日期
-						uni.setStorageSync("syncDate", newTime);
-
-
-
-						// 执行更新函数
-						self.commit("syncRequestEvent", {
-							success: () => {
-								//清空显示的本地数据
-								self.commit("setShowCalorie", 0);
-								state.planData.allCalorie = state.planData.showCalorie.
-								add(state.planData.localCalorie);
-
-								if (callback)
-									callback({
-										newDate: nDate
-									});
-							}
-						});
-
-						//清空记录的本地运动时间
-						// console.log('情况运动时间');
-						self.commit("setLocalSportTime", 0);
-
-						//设置本地数据是0
-						state.localSportTime = 0;
-
-
-					} else {
-						if (callback)
-							callback({
-								newDate: nDate
-							});
-					}
-
-					// date.getDays.
-				},
-				fail: function(res) {
-					// console.error(res);
-					// 如果没有日期,则存储一个新的
-					let nDate = new Date();
-					let tempTime = date.formatDate(nDate);
-					uni.setStorageSync("syncDate", tempTime);
-
-					if (callback)
-						callback({
-							newDate: nDate
-						});
-				}
-			});
-
-
-
-		},
-		// 同步数据的请求
-		syncRequestEvent(state, data) {
-			let self = this;
-			let {
-				success,
-				fail
-			} = data;
-
-			//需要卡路里取整存服务器,小数点后面,继续保留。以消除累计误差
-			let oldLocalCalorie = state.planData.localCalorie;
-			let _localCalorieInt = parseInt(state.planData.localCalorie);
-			//小数点后面
-			let _afterLocalCalorie = Number(oldLocalCalorie).sub(_localCalorieInt);
-
-			console.log("*******===:", oldLocalCalorie, _localCalorieInt, _afterLocalCalorie);
-
-
-			if (_localCalorieInt === 0) {
-				// uni.showToast({
-				// 	title: '',
-				// 	icon: 'loading',
-				// 	mask: true,
-				// 	duration: 1000
-				// })
-				if (success)
-					success();
-				return;
-			}
-			uni.showToast({
-				title: '',
-				icon: 'loading',
-				mask: false,
-				duration: 10000
-			})
-			//把卡路里累计到cumulativeCalorie 变量,之后传服务器 += Math.round(state.planData.localCalorie)
-			state.planData.cumulativeCalorie += _localCalorieInt;
-			//添加到showCalorie 中
-			state.planData.showCalorie = Number(state.planData.showCalorie).add(_localCalorieInt);
-
-			state.planData.allCalorie = state.planData.showCalorie.add(_afterLocalCalorie);
-
-			//不管是否同步成功,清空本地记录的卡路里,前一步已添加到cumulativeCalorie
-			self.commit("setLocalCalorie", _afterLocalCalorie);
-			self.commit("setShowCalorie", Number(state.planData.showCalorie));
-
-
-			// 把卡路里记录到服务器
-			reqUtil.requestData(config.URL.FITNESSPROGRAM, state.planData, 'POST').then(
-				res => {
-					// console.warn(res);
-					if (res.code == 0) {
-						uni.showToast({
-							title: '同步成功',
-							mask: true,
-							duration: 1000
-						});
-						//同步一下服务器的返回值
-						state.planData = Object.assign(state.planData, res.data);
-						//暂时默认同步拳击1 的卡路里
-						reqUtil.requestData(config.URL.UPLOADRANKING, {
-							gameId: '1', //拳击模式 game id = 1;
-							score: _localCalorieInt,
-							cityCode: state.city.cityCode,
-						}, "POST").then(res => {
-								console.warn('****上传首页拳击卡路里,后面多个模式,可能需要多个不同的游戏id ***', res);
-							},
-							e => {
-								console.log(e)
-							});
-
-						setTimeout(() => {
-							uni.hideToast();
-						}, 1000);
-
-
-
-						if (success)
-							success();
-					} else {
-
-						state.planData.cumulativeCalorie = Number(state.planData.cumulativeCalorie).sub(_localCalorieInt);
-						state.planData.showCalorie = Number(state.planData.showCalorie).sub(_localCalorieInt);
-
-						self.commit("setLocalCalorie", oldLocalCalorie);
-						if (fail)
-							fail();
-					}
-					console.log("减法 ==", Number(state.planData.cumulativeCalorie).sub(_localCalorieInt));
-
-
-				},
-				e => {
-					console.log(e);
-					state.planData.cumulativeCalorie = Number(state.planData.cumulativeCalorie).sub(_localCalorieInt);
-					state.planData.showCalorie = Number(state.planData.showCalorie).sub(_localCalorieInt);
-					self.commit("setLocalCalorie", oldLocalCalorie);
-
-					uni.hideToast();
-					if (fail)
-						fail();
-				}
-			);
-		},
-		//登录成功后,重置一下状态
-		resetCountDown(state) {
-
-			if (state.interval) {
-				clearInterval(state.interval);
-				state.interval = null;
-				state.count = 59;
-				state.bCodeDisabled = false;
-			}
-
-		},
-
-		//验证码操作
-		countDown(state, phoneNumber) {
-			//限制验证码操作
-			state.bCodeDisabled = true;
-			state.interval = setInterval(() => {
-				--state.count;
-				if (state.count <= 0) {
-					clearInterval(state.interval);
-					state.interval = null;
-					state.count = 59;
-					state.bCodeDisabled = false;
-				}
-			}, 1000);
-			setTimeout(() => {
-				clearInterval(state.interval)
-				state.count = 59;
-				state.bCodeDisabled = false;
-			}, 60000);
-			reqUtil.requestData(config.URL.GETCODE, {
-				"phoneNumber": phoneNumber
-			}).then(res => {
-					console.log('requestData GETCODE =====', res);
-					uni.showToast({
-						title: "发送成功",
-						mask: true,
-						duration: 1000
-					})
-
-				},
-				e => {
-					console.log(e)
-				});
-
-		},
-		//获取记录的蓝牙列表数据
-		getBLEDeviceList(state) {
-			// console.log("getBLEDeviceList=");
-			uni.getStorage({
-				key: 'BLEDeviceList',
-				success: (res) => {
-					console.log("*****getBLEDeviceList=", res);
-					let _list = res.data;
-					state.BLEDeviceList = res.data;
-					//更新BLEDeviceShowList 数组
-					state.BLEDeviceShowList = [];
-					_list.forEach(item => {
-						//如果记录到本地的id,和信息列表中的id一致,则结合
-						for (let i = 0; i < state.BLEInfoList.length; i++) {
-							let eq = state.BLEInfoList[i];
-							if (item.id == eq.id) {
-								state.BLEDeviceShowList.push(Object.assign({}, item, eq));
-								break;
-							}
-						}
-					})
-
-				}
-			})
-		},
-
-		//添加蓝牙设备数据
-		addBLEDevice(state, data) {
-			let devicelist = [];
-			if (state.BLEDeviceList && state.BLEDeviceList.length != 0) {
-				devicelist = state.BLEDeviceList;
-			}
-			// console.log(data, devicelist)
-
-			let bHas = false;
-			devicelist.forEach((item, index, selfArr) => {
-				if (item.id == data.id) {
-					//如果存在,更新保存的数据,比如 mac或者uuid等 
-					selfArr[index] = item = Object.assign({}, item, data);
-					bHas = true;
-				}
-			})
-			//把当前添加的的蓝牙设信息备作为最后一次连接覆盖到本地
-			this.commit('setFinallUseDevice', data);
-
-			if (bHas) {
-				return;
-			}
-			//设置蓝牙列表本地信息
-			devicelist.push(data);
-			uni.setStorage({
-				key: 'BLEDeviceList',
-				data: devicelist,
-				success: (res) => {
-					// uni.showToast({
-					// 	title: "保存成功"
-					// })
-					state.BLEDeviceList = devicelist;
-					// console.log("devicelist:",devicelist);
-					//更新BLEDeviceShowList 数组
-					state.BLEDeviceShowList = [];
-					devicelist.forEach(item => {
-						//如果记录到本地的id,和信息列表中的id一致,则结合
-						for (let i = 0; i < state.BLEInfoList.length; i++) {
-							let eq = state.BLEInfoList[i];
-							if (item.id == eq.id) {
-								// console.log("item:",item);
-								state.BLEDeviceShowList.push(Object.assign({}, item, eq));
-								break;
-							}
-						}
-					})
-					// console.log("state.BLEDeviceShowList:",state.BLEDeviceShowList);
-				}
-			})
-		},
-		//删除蓝牙设备数据
-		deleteBLEDevice(state, index) {
-			let devicelist = [];
-			devicelist = state.BLEDeviceList;
-
-			devicelist.splice(index, 1);
-			uni.setStorage({
-				key: 'BLEDeviceList',
-				data: devicelist,
-				success: (res) => {
-					uni.showToast({
-						title: "删除成功"
-					})
-					state.BLEDeviceList = devicelist;
-					//更新BLEDeviceShowList 数组
-					state.BLEDeviceShowList = [];
-					devicelist.forEach(item => {
-						//如果记录到本地的id,和信息列表中的id一致,则结合
-						for (let i = 0; i < state.BLEInfoList.length; i++) {
-							let eq = state.BLEInfoList[i];
-							if (item.id == eq.id) {
-								state.BLEDeviceShowList.push(Object.assign({}, item, eq));
-								break;
-							}
-						}
-					})
-				}
-			})
-		},
-
-		//获取计划表数据
-		getPlanData(state, callback) {
-			reqUtil.requestData(config.URL.FITNESSPROGRAMGET).then(res => {
-					// console.log('获取计划表数据:getPlanData=====', res.data);
-					if (res.code == 0) {
-
-						state.planData = Object.assign(state.planData, res.data);
-
-						// 处理本地数据
-						let templocalCalorie = uni.getStorageSync("localCalorie");
-						// console.log("templocalCalorie:", templocalCalorie, state.planData);
-						if (templocalCalorie) {
-							templocalCalorie = Number(templocalCalorie);
-							if (templocalCalorie > state.planData.calorie) {
-								state.planData.localCalorie = state.planData.calorie;
-								uni.setStorage({
-									key: "localCalorie",
-									data: state.planData.localCalorie
-								});
-							} else {
-								state.planData.localCalorie = templocalCalorie;
-							}
-						} else {
-							state.planData.localCalorie = 0;
-						}
-
-						//处理本地的cumulativeCalorie
-						let tempShowCalorie = uni.getStorageSync("showCalorie");
-						// console.log("tempShowCalorie:", tempShowCalorie, state.planData);
-						if (tempShowCalorie) {
-							tempShowCalorie = Number(tempShowCalorie);
-							if (tempShowCalorie > state.planData.calorie) {
-								state.planData.showCalorie = state.planData.calorie;
-								uni.setStorage({
-									key: "showCalorie",
-									data: state.planData.showCalorie
-								});
-							} else {
-								state.planData.showCalorie = tempShowCalorie;
-							}
-						} else {
-							state.planData.showCalorie = 0;
-						}
-
-
-						state.planData.allCalorie = state.planData.showCalorie.add(state.planData.localCalorie);
-
-						// console.log("======",state.planData )
-						state.days = date.datedifference(res.data.startTime, res.data.endTime) + 1;
-						let nDate = new Date();
-						let tempTime = date.formatDate(nDate);
-						state.remainingDays = date.datedifference(tempTime, res.data.endTime) + 1;
-
-						// console.log("state.remainingDays======", state.remainingDays);
-					}
-					// showArcbar
-					if (callback) {
-						callback();
-					}
-
-				},
-				e => {
-					console.log(e)
-				});
-		},
-		/**
-		 * 获取全部游戏
-		 * @param {Object} state
-		 */
-		getAllGame(state, callback) {
-			//获得全部游戏列表
-			if (state.allGames.length != 0) {
-				if (callback)
-					callback();
-				return;
-			}
-			reqUtil.requestData(
-				config.URL.GAMELIST_BY_RANKING_SHOW, {
-					rankingShow: 1,
-					page: 1,
-					size: 100
-				}
-			).then(res => {
-					// console.log('获取默认的全部游戏 =====', res);
-					if (res.code == 0) {
-						state.allGames = [];
-						state.allGames = state.allGames.concat(res.data);
-					}
-					if (callback)
-						callback();
-				},
-				e => {
-					console.log(e);
-					if (callback)
-						callback();
-				}
-			);
-		},
-		getRankGame(state, data) {
-			let {
-				param,
-				callback
-			} = data;
-
-			reqUtil.requestData(config.URL.GETRANKRANGR, param).then(res => {
-
-					console.log('获取默认的游戏数据:GETRANKRANGR=====', res);
-					if (res.data != null) {
-						state.rankSelectedGame = res.data.gameInfo;
-						state.rankInfo = res.data.rankInfo;
-						//然后获取排名
-
-					}
-					if (callback)
-						callback(res);
-
-				},
-				e => {
-					console.log(e)
-				});
-		},
-		/**
-		 * 苹果端登陆
-		 * @param {Object} state
-		 * @param {Object} data
-		 */
-		appleUserInfoLogin(state, data) {
-			let self = this;
-			let {
-				params,
-				callback
-			} = data;
-			console.log('获取用户数据:USERINFOAPPLEADD params=====', params);
-			reqUtil.requestData(config.URL.USERINFOAPPLEADD, params, 'POST').then(res => {
-					console.log('获取用户数据:USERINFOAPPLEADD =====', res);
-					if (res.code == 0) {
-						let userInfo = res.data;
-						self.commit('login', userInfo);
-						console.log("11~~");
-					} else if (res.code = 201) {
-						state.hasLogin = true;
-					}
-					console.log("apple callback!!!");
-					callback();
-				},
-				e => {
-					console.log(e)
-				});
-		},
-		//添加用户信息和登录
-		addUserAvatarAndLogin(state, data) {
-			let self = this;
-			let {
-				params,
-				filePath,
-				callback
-			} = data;
-			console.log("addUserAvatarAndLogin 初始化对应数据");
-			reqUtil.reqUpload(config.URL.USERINFOADDAVATARINFO, params, filePath).then(res => {
-					console.log('获取用户数据:USERINFOADDAVATARINFO =====', res);
-					if (res.code == 0) {
-						let userInfo = res.data;
-						self.commit('login', userInfo);
-					} else if (res.code = 201) {
-						state.hasLogin = true;
-					}
-
-					if (callback) {
-						callback();
-					}
-
-
-
-				},
-				e => {
-					console.log(e)
-				});
-		},
-		//app登录或h5
-		accountLogin(state, callback) {
-			let self = this;
-			// console.log("app登录或h5 初始化对应数据")
-			reqUtil.requestData(config.URL.USERINFOURL).then(res => {
-					console.log('获取用户数据:USERINFOURL =====', res);
-					if (res.code == 0) {
-						let userInfo = res.data.userInfo;
-						state.phoneNumber = res.data.phoneNumber || '';
-						state.openid = res.data.openid || '';
-						self.commit('login', userInfo);
-					} else if (res.code = 201) {
-						state.hasLogin = true;
-					}
-
-					if (callback) {
-						callback();
-					}
-
-
-
-				},
-				e => {
-					console.log(e)
-				});
-		},
-		//小程序页面登录
-		login(state, userInfo) {
-			console.log("登陆的信息==", userInfo);
-			if (userInfo.cityCode == "" || userInfo.cityCode == null) {
-				//不存在就设置默认值
-				userInfo.cityCode = state.city.cityCode;
-			}
-			let cityCode = userInfo.cityCode;
-			// console.log("cicicicitycode:", cityCode);
-			let provinceData = require('@/components/slambb-picker/city-data/province.js').default;
-			let cityData = require('@/components/slambb-picker/city-data/city.js').default;
-			let areaData = require('@/components/slambb-picker/city-data/area.js').default;
-			// 解析citycode
-			for (let i = 0; i < provinceData.length; i++) {
-				if (provinceData[i].value == cityCode.substr(0, 2)) {
-					let currentCityData = cityData[i];
-					for (let j = 0; j < currentCityData.length; j++) {
-						if (currentCityData[j].value == cityCode.substr(0, 4)) {
-							let areaDataTemp = areaData[i][j];
-							for (let k = 0; k < areaDataTemp.length; k++) {
-								if (areaDataTemp[k].value == cityCode) {
-									state.city.value = [i, j, k];
-									state.city.label = provinceData[i].label +
-										'-' +
-										currentCityData[j].label +
-										'-' +
-										areaDataTemp[k].label;
-									state.cityName = currentCityData[j].label;
-									break;
-								}
-							}
-							break;
-						}
-					}
-					break;
-				}
-			}
-
-			state.userInfo = userInfo;
-			state.userName = userInfo.username || '新用户';
-			state.avatarUrl = userInfo.avatarUrl || '/static/defaultAvatar.png';
-			state.gender = userInfo.gender;
-			state.signature = userInfo.signature || '';
-			state.birthday = userInfo.birthday;
-			state.city.cityCode = cityCode.toString();
-			state.weight = userInfo.weight || state.weight;
-			state.height = userInfo.height || state.height;
-			state.hasLogin = true;
-
-			//登录时候 获取一下排行榜里面的游戏
-			// this.commit('getRankGame', {
-			// 	param: {
-			// 		type: "china",
-			// 		cityCode: 12345
-			// 	}
-			// });
-
-		},
-
-		// 退出登录
-		// 删除token 操作
-		delectToken(state, data) {
-			let self = this;
-			let {
-				success
-			} = data;
-			reqUtil.requestData(config.URL.USERLOGINOUT, {}).then(res => {
-					console.log('USERLOGINOUT=====', res);
-					self.commit("logout");
-					try {
-						//清空保存的storage
-						uni.clearStorageSync();
-					} catch (e) {
-						// error
-						console.error(e);
-					}
-					if (state.BLERSSIInterval) {
-						clearInterval(state.BLERSSIInterval);
-						state.BLERSSIInterval = null;
-					}
-
-					if (state.BLEConnectDevice) {
-						self.commit("onCloseBLEConnection", {
-							getSuccess: () => {}
-						});
-					}
-
-					if (success) {
-						success(res);
-					}
-
-				},
-				e => {
-					console.log(e)
-				});
-		},
-		logout(state) {
-			state.userInfo = null;
-			state.userName = "匿名";
-			state.avatarUrl = '/static/defaultAvatar.png';
-			state.days = '0';
-			state.signature = '';
-			state.gender = 0;
-			state.hasLogin = false;
-
-			state.phoneNumber = '';
-			state.openid = '';
-			state.appleid = '';
-
-			//处理设备值
-			state.cIndex = -1;
-			//绑定的设备
-			state.ConnectBindingDevice = null;
-			//蓝牙设备
-			state.BLEConnectDevice = null;
-
-			//蓝牙服务
-			state.BLEGetServices = null;
-
-			//最近连接过的设备
-			state.finallyUseDevice = null;
-
-			//记录的蓝牙设备,保存id, 和对应的蓝牙连接数据
-			state.BLEDeviceList = [];
-			//显示的蓝牙设备,取本地数据时候更新
-			state.BLEDeviceShowList = [];
-
-			//记录表盘计划刷新的卡路里
-			state.oldArcbarProCalorie = 0;
-			//记录表盘当前的总卡路里
-			state.oldArcbarAllCalorie = 0;
-		},
-
-		loginUserInfo(state, data) {
-			let {
-				infoRes,
-				success,
-				fail
-			} = data;
-			console.log('loginUserInfo');
-
-			reqUtil.requestData(config.URL.WXGETUSERINFO, {
-				appid: 'wxd6dfd60729d33d17',
-				encryptedData: infoRes.encryptedData,
-				iv: infoRes.iv,
-				signature: infoRes.signature,
-				rawData: infoRes.rawData
-			}).then(res => {
-					console.log('wxInfoRes=====', res);
-					let userInfo = res.data;
-					this.commit('login', userInfo);
-					if (success) {
-						success(res);
-					}
-
-				},
-				e => {
-					console.log(e)
-					if (fail) {
-						success(fail);
-					}
-				});
-		},
-		//这里统一静默处理login
-		oauth(state, context) {
-			let {
-				value,
-				callback
-			} = context;
-			uni.login({
-				provider: value,
-				success: (res) => {
-					// console.log('code:', res);
-					reqUtil.requestData(config.URL.USERlOGINURL, {
-						appid: 'wxd6dfd60729d33d17',
-						code: res.code,
-						platfrom: value
-					}).then(res => {
-							console.log('login token=====', res);
-							state.token = res.data.token;
-							uni.setStorageSync('token', state.token);
-							uni.getUserInfo({
-								provider: value,
-								success: (infoRes) => {
-									if (callback) {
-										callback(infoRes);
-									}
-								},
-								fail: (failRes) => {
-									//假如没有授权,login 之后,不做处理,需要用户点击授权时候,再进行处理用户登录
-									console.log('getUserInfo failRes:', failRes)
-								}
-							});
-						},
-						e => {
-							console.log(e)
-						});
-
-
-				},
-				fail: (err) => {
-					console.error('授权登录失败:' + JSON.stringify(err));
-				}
-			});
-		},
-		onLuanchLogin(state, data) {
-			let {
-				success
-			} = data;
-			const filters = ['weixin', 'qq', 'sinaweibo'];
-			let platform = '';
-			uni.getProvider({
-				service: 'oauth',
-				success: (res) => {
-					if (res.provider && res.provider.length) {
-						for (let i = 0; i < res.provider.length; i++) {
-							if (~filters.indexOf(res.provider[i])) {
-								platform = res.provider[i];
-								console.log("platform=", platform);
-								uni.showToast({
-									icon: 'loading',
-									title: ''
-								})
-								this.commit('oauth', {
-									value: platform,
-									callback: (infoRes) => {
-										// console.log("infoRes:", infoRes);
-										this.commit('loginUserInfo', {
-											infoRes: infoRes,
-											success: (res) => {
-												console.log("获取用户成功");
-												if (success) {
-													success(res);
-												}
-												uni.hideToast();
-											},
-											fail: (res) => {
-												console.error("获取用户失败");
-												uni.hideToast();
-											}
-										});
-									}
-								})
-							}
-						}
-						this.hasProvider = true;
-					}
-				},
-				fail: (err) => {
-					console.error('获取服务供应商失败:' + JSON.stringify(err));
-				}
-			});
-		},
-
-
-		initAdapter(state, callback) {
-			//初始化蓝牙模块
-			let params = {
-				success: (res) => {
-					state.bOpenSuccess = true;
-					state.bOpenBluetooth = true;
-					if (callback)
-						callback(res);
-					//监听断开事件
-					this.commit("B_OnBLEConnectionStateChange");
-				},
-				fail: (fail) => {
-					state.bOpenSuccess = false;
-					state.bOpenBluetooth = false;
-					uni.showToast({
-						title: '蓝牙尚未开启!',
-						icon: 'none'
-					})
-				},
-				complete: (complete) => {
-					console.log("complete bListenAdapterStateChange:", state.bListenAdapterStateChange);
-					if (state.bListenAdapterStateChange) return;
-
-					state.bListenAdapterStateChange = true;
-					uni.onBluetoothAdapterStateChange((res) => {
-						console.log('adapterState changed, now is', res)
-						// 手机蓝牙状态
-						state.bOpenBluetooth = res.available;
-						if (state.bOpenBluetooth && !state.bOpenSuccess) {
-							this.commit('initAdapter');
-						}
-					})
-
-				}
-			};
-			this.commit("B_OpenBluetoothAdapter", params);
-		},
-		// todo 未使用到
-		onGetDevices(state, context) {
-			let {
-				success
-			} = context;
-			if (!state.BLEConnectDevice) return;
-			// #ifdef APP-PLUS
-			let deviceId = state.BLEConnectDevice.deviceId;
-			uni.getBLEDeviceRSSI({
-				deviceId,
-				success: res => {
-					let _dis = Math.pow(Math.E, (Math.abs(res.RSSI) - 66.78) / 16.56);
-
-					if (_dis > state.BLEConnectDevice.limitDis) {
-						if (state.cIndex != -1) {
-							uni.showToast({
-								title: '设备断开连接!',
-								icon: 'none',
-								duration: 2000,
-								mask: true
-							})
-						}
-
-						setTimeout(() => {
-							this.commit("B_CloseBLEConnection", {
-								deviceId: deviceId
-							})
-							state.cIndex = -1;
-							state.bConnection = false;
-							state.bVerifiedConnection = false;
-						}, 1000)
-
-					} else {
-						// console.log("DIS~~~~~~~~~", _dis);
-						if (success) {
-							success({
-								RSSI: res.RSSI,
-								DIS: _dis
-							});
-						}
-					}
-				}
-			})
-			// #endif
-
-
-		},
-		//清除连接的开启的timeout
-		onUnloadCreateBLEConnectionTimeout(state) {
-			if (state.getBLEDeviceServicesTimeout) {
-				clearTimeout(state.getBLEDeviceServicesTimeout);
-				state.getBLEDeviceServicesTimeout = null;
-			}
-		},
-
-		initBLEData(state) {
-			// 设备Id
-			state.deviceId = "";
-			// 服务Id
-			state.serviceId = "";
-
-			state.notifyCharacteristicId = "";
-
-			state.writeCharacteristicId = "";
-
-			state.currentInstruction = "";
-
-			state.showToast = false;
-
-			state.bListenerUpdate = false;
-
-			state.bListenerJson = false;
-
-			state.bListenerMac = false;
-
-		},
-		//连接蓝牙
-		onCreateBLEConnection(state, context) {
-			let {
-				index,
-				item,
-				initItem = false,
-				getSuccess = null,
-				getinitAdapter = null
-			} = context;
-
-			let params = {
-				item: item,
-				success: (success) => {
-
-					// 	uni.getBluetoothDevices({
-					// 		success(res) {
-					// 			console.log("getBluetoothDevices:", res)
-					// 		}
-					// 	})
-
-					// 	uni.getConnectedBluetoothDevices({
-					// 		success(res) {
-					// 			console.log("getConnectedBluetoothDevices:", res)
-					// 		}
-					// 	})
-
-
-					state.bConnection = true;
-					if (state.getBLEDeviceServicesTimeout) {
-						clearTimeout(state.getBLEDeviceServicesTimeout);
-						state.getBLEDeviceServicesTimeout = null;
-					}
-
-					state.getBLEDeviceServicesTimeout = setTimeout(() => {
-						let retryCount = 5;
-						this.commit("B_GetBLEDeviceServices", {
-							retryCount:retryCount,
-							item: item,
-							callback: () => {
-								uni.showToast({
-									title: '连接成功',
-									icon: 'loading',
-									duration: 2000,
-									mask: true
-								})
-								//是否需要设置item,默认不设置
-								if (initItem) {
-									state.cIndex = index;
-									state.BLEConnectDevice = item;
-								}
-
-
-								if (getSuccess)
-									getSuccess();
-
-								/**
-								 * 直接连接过成功
-								 */
-								state.bVerifiedConnection = true;
-
-							},
-							getServiceList: (serviceList) => {
-								//搜索服务失败后
-								state.BLEGetServices = serviceList;
-							},
-							getFail:()=>{
-								this.commit("B_CloseBLEConnection", {
-									deviceId: item.deviceId
-								})
-								state.cIndex = -1;
-								state.bConnection = false;
-								state.bVerifiedConnection = false;
-							}
-						});
-
-					}, 2000);
-
-				},
-				fail: (fail) => {
-					console.log("***fail:", fail);
-					if (fail.errCode === 10012) {
-						console.log("连接超时,请重试!");
-						uni.showToast({
-							title: '连接失败,设备无响应,请重试。',
-							icon: 'none',
-							duration: 3000,
-							mask: true
-						})
-					} else if (fail.errCode === 10013) {
-						console.log("连接失败,蓝牙地址无效!");
-						uni.showToast({
-							title: '连接失败,蓝牙地址无效',
-							icon: 'none',
-							duration: 2000,
-							mask: true
-						})
-					} else if (fail.errCode === 10000) {
-						// console.log("连接失败,初始化 uni.openBluetoothAdapter 调用之后使用");
-						// uni.showToast({
-						// 	title: '连接失败,检查手机蓝牙是否开启',
-						// 	icon: 'none',
-						// 	duration: 2000,
-						// 	mask: true
-						// })
-
-						this.commit('initAdapter', () => {
-							if (getinitAdapter) {
-								getinitAdapter();
-							}
-						})
-						// this.initAdapter(() => {
-						// 	this.onDevice(item, e);
-						// });
-					} else {
-						// err.errCode10003原因多种:蓝牙设备未开启或异常导致无法连接;蓝牙设备被占用或者上次蓝牙连接未断开导致无法连接
-						console.log("连接失败,请重试!");
-						uni.showToast({
-							title: '设备未开启或被占用异常导致无法连接。',
-							icon: 'none',
-							duration: 2000,
-							mask: true
-						})
-					}
-				}
-			};
-			this.commit("B_CreateBLEConnection", params);
-		},
-		//devices hardware 连接后验证,这里不需要处理 bVerifiedConnection,通过mac 验证后处理
-		onCreateBLESuccess(state, context) {
-			let {
-				item,
-				getSuccess = null
-			} = context;
-			this.commit("B_CreateBLEConnection", {
-				item: item,
-				success: success => {
-					state.BLEConnectDevice = item;
-					state.bConnection = true;
-					if (getSuccess) {
-						getSuccess();
-					}
-				},
-				fail: fail => {
-					if (fail.errCode === 10012) {
-						console.log("连接超时,请重试!");
-						uni.showToast({
-							title: '连接超时,检查对应设备是否开启?',
-							icon: 'none',
-							duration: 2000,
-							mask: true
-						})
-					} else if (fail.errCode === 10013) {
-						console.log("连接失败,蓝牙地址无效!");
-						uni.showToast({
-							title: '蓝牙地址无效,检查设备是否正常?',
-							icon: 'none',
-							duration: 2000,
-							mask: true
-						})
-					} else if (fail.errCode === 10000) {
-						console.log("连接失败,初始化 wx.openBluetoothAdapter 调用之后使用");
-						uni.showToast({
-							title: '连接失败,检查手机蓝牙是否开启?',
-							icon: 'none',
-							duration: 2000,
-							mask: true
-						})
-					} else {
-						console.log("连接失败,请重试!");
-						uni.showModal({
-							title: '连接失败',
-							content: '设备未开启或被占用。请重启app和设备后重新连接。'
-						})
-						// uni.showToast({
-						// 	title: '设备未开启或被占用异常导致无法连接。',
-						// 	icon: 'none',
-						// 	duration: 2000,
-						// 	mask: true
-						// })
-					}
-				}
-			});
-		},
-		//获取蓝牙服务
-		onGetBLEDeviceServices(state, context) {
-			let {
-				item,
-				success = null,
-			} = context;
-			let retryCount = 5;
-			this.commit("B_GetBLEDeviceServices", {
-				retryCount:retryCount,
-				item: item,
-				callback: success,
-				getServiceList: (serviceList) => {
-					state.BLEGetServices = serviceList;
-				},
-				getFail:()=>{}
-			})
-		},
-		onCloseBLEConnection(state, context) {
-
-			console.log("onCloseBLEConnection", state.BLEConnectDevice);
-			let {
-				getSuccess = null,
-			} = context;
-
-			if (state.BLERSSIInterval) {
-				clearInterval(state.BLERSSIInterval);
-				state.BLERSSIInterval = null;
-			}
-			this.commit("B_CloseBLEConnection", {
-				deviceId: state.BLEConnectDevice.deviceId,
-				success: () => {
-					state.cIndex = -1;
-					state.BLEConnectDevice = null;
-					//蓝牙服务
-					state.BLEGetServices = null;
-
-					if (getSuccess) {
-						getSuccess();
-					}
-					state.bConnection = false;
-
-					state.bVerifiedConnection = false;
-
-					uni.closeBluetoothAdapter({
-						success(res) {
-							console.log(res)
-							state.bOpenBluetooth = false;
-						}
-					})
-				}
-			});
-
-		},
-		//不关闭 adapter
-		onOnlyCloseBLEConnection(state, context) {
-			let {
-				getSuccess = null
-			} = context;
-
-			if (state.BLERSSIInterval) {
-				clearInterval(state.BLERSSIInterval);
-				state.BLERSSIInterval = null;
-			}
-
-			this.commit("B_CloseBLEConnection", {
-				deviceId: state.BLEConnectDevice.deviceId,
-				success: () => {
-					state.cIndex = -1;
-					state.BLEConnectDevice = null;
-					//蓝牙服务
-					state.BLEGetServices = null;
-					if (getSuccess) {
-						getSuccess();
-					}
-					state.bConnection = false;
-
-					state.bVerifiedConnection = false;
-				}
-			});
-
-		},
-		onWriteBLEConnectionValue(state, context) {
-			let {
-				getSuccess = null,
-					getFail = null,
-					value
-			} = context;
-
-			if (!state.BLEConnectDevice && state.cIndex == -1) {
-				uni.showToast({
-					title: '蓝牙设备未连接',
-					icon: 'none'
-				})
-			}
-			// console.log(22);
-			//记录蓝牙盒子当前的指令
-			state.currentInstruction = value;
-			// 发送 3 :开启原始数据
-			// 发送4 :关闭原始数据
-			// 发送 5 :开启步数
-			// 发送6 :关闭步数
-			if (value == "3") {
-				state.instructionState.bOpen = true;
-			} else if (value == "4") {
-				state.instructionState.bOpen = false;
-			} else if (value == "5") {
-				state.instructionState.bSteps = true;
-			} else if (value == "6") {
-				state.instructionState.bSteps = false;
-			}
-			let retryCount = 5;
-			this.commit("B_WriteBLECharacteristicValue", {
-				value,
-				retryCount,
-				getSuccess,
-				getFail
-			});
-		},
-		//获取距离
-		onGetRSSITransDistance(state, context) {
-			let {
-				RSSI
-			} = context;
-			BLE.getRSSITransDistance(RSSI);
-		},
-
-
-		//添加使用的前端信息
-		gOnAddClientInfo(state, context) {
-
-			uni.getSystemInfo({
-				success: (res) => {
-					// console.log("系统信息:", res);
-					let clientInfo = res;
-
-					clientInfo.clientSystem = res.system;
-
-					reqUtil.requestData(config.URL.ADDCLIENTINFO, clientInfo, 'POST').then(
-						res => {
-							console.warn(res);
-						},
-						e => {}
-					);
-				},
-				fail: (err) => {},
-				complete: () => {}
-			})
-
-
-		},
-
-		//创建快速打击对象
-		gCreateFilterObj(state) {
-			state.filter = null;
-			state.deviceMs = 1;
-			state.filter = new o0Project.Filter();
-			console.log("gCreateFilterObj");
-		},
-		//更新快速打击对象数据
-		gUpdateFilter(state, context) {
-
-			let {
-				data,
-				callback
-			} = context;
-
-			let {
-				min,
-				s,
-				ms
-			} = data;
-			var msGap = ms - state.deviceMs;
-			state.deviceMs = ms;
-			while (msGap < 0) {
-				msGap += 1000;
-			}
-			// console.log(data);
-			let {
-				ax,
-				ay,
-				az
-			} = data.acc;
-
-			state.filter.Update(new o0.Vector3(ax, ay, az), msGap, callback); //我自己的更新acc的函数
-		},
-		/**
-		 * 限制开始游戏
-		 */
-		glimitPlayGame(state, context) {
-			let {
-				gameTags,
-				callback
-			} = context;
-
-			//没有标签直接进去
-			if (gameTags.length == 0) {
-				callback();
-				return;
-			}
-
-			let canPlay = false;
-			gameTags.forEach((item) => {
-				//如果存在普通模式
-				if (item.tagMode === 'normal') {
-					canPlay = true;
-				}
-				if (canPlay)
-					return;
-			})
-
-			if (!canPlay) {
-				//2.如果普通模式不存在,就判断是否连接硬件了
-				if (!state.BLEConnectDevice || state.cIndex == -1) {
-					uni.showToast({
-						title: "请连接标签对应的设备模式!",
-						icon: "none",
-						duration: 2000,
-						mask: true
-					})
-					return;
-				}
-				//3.如果连接了设备,判断但是处于什么模式
-				gameTags.forEach((item, index, selfArr) => {
-					//如果存在普通模式
-					if (item.tagMode === state.BLEConnectDevice.usageMode) {
-						canPlay = true;
-					}
-					if (canPlay)
-						return;
-					if (index == selfArr.length - 1) {
-						uni.showToast({
-							title: "游戏没有当前设备模式!",
-							icon: "none",
-							duration: 2000,
-							mask: true
-						})
-					}
-				})
-			}
-
-			if (canPlay) {
-				callback();
-			}
-		},
-
-		checkAppUpdata(state) {
-			//#ifdef APP-PLUS
-			let _temp = {
-				appid: plus.runtime.appid,
-				version: state.version,
-				versionCode: state.versionCode,
-				platform: state.platform.toLocaleLowerCase(),
-			}
-			//#endif
-			//#ifdef H5
-			//此 _temp 测试用
-			let _temp = {
-				appid: '1',
-				version: "2.0.0",
-				versionCode: "20122202",
-				platform: "android",
-			}
-			//#endif
-			reqUtil.requestData(config.URL.APPVERSIONUPDATE, _temp).then(res => {
-					console.log('requestData APPVERSIONUPDATE =====', res);
-					let _data = res.data;
-					if (res.code == 0 && res.data.status === 1) {
-						uni.showModal({ //提醒用户更新  
-							title: "更新提示",
-							content: res.data.note,
-							success: (res) => {
-								if (res.confirm) {
-									if (state.platform.toLocaleLowerCase() == "android") {
-										plus.runtime.openURL(_data.url, function(res) {
-											plus.nativeUI.alert("本机没安装应用宝,请安装后获取新版本。");
-										}, 'com.tencent.android.qqdownloader');
-
-									} else {
-										//ios
-										plus.runtime.openURL(_data.url);
-									}
-								}
-							}
-						})
-
-					} else {
-						uni.showToast({
-							title: '当前为最新版本',
-							icon: 'none',
-							duration: 2000,
-							mask: true
-						})
-					}
-				},
-				e => {
-					console.log(e)
-				});
-
-		},
-
-
-		/**
-		 * 蓝牙BLE迁移到store.js
-		 */
-		// 初始化蓝牙模块适配器
-		B_OpenBluetoothAdapter(state, context) {
-			let {
-				success,
-				fail,
-				complete
-			} = context;
-			//#ifdef H5
-			console.warn('h5不加载蓝牙模块');
-			return;
-			//#endif
-			uni.openBluetoothAdapter({
-				success: res => {
-					if (success)
-						success(res);
-				},
-				fail: res => {
-					if (fail)
-						fail(res);
-				},
-				complete: res => {
-					if (complete)
-						complete(res);
-				}
-			})
-		},
-
-		/**
-		 * 关闭蓝牙模块适配器
-		 */
-		B_CloseBluetoothAdapter() {
-			//#ifdef H5
-			console.warn('h5不加载蓝牙模块');
-			return;
-			//#endif
-			uni.closeBluetoothAdapter({
-				success: res => {
-					console.log('断开蓝牙模块成功');
-					uni.showToast({
-						icon: "none",
-						title: "蓝牙已经断开!",
-						mask: false,
-						duration: 3000
-					});
-				}
-			});
-		},
-
-		B_OnBLEConnectionStateChange(state) {
-			//#ifdef H5
-			console.warn('h5不加载蓝牙模块');
-			return;
-			//#endif
-			uni.onBLEConnectionStateChange(res => {
-				// 该方法回调中可以用于处理连接意外断开等异常情况
-				console.log(`蓝牙连接状态 -------------------------->`, JSON.stringify(res));
-				if (!res.connected) {
-					uni.$emit('callbackCloseBLE');
-				}
-			});
-		},
-		/**
-		 * 连接低功耗蓝牙设备。
-		 * 若APP在之前已有搜索过某个蓝牙设备,并成功建立连接,可直接传入之前搜索获取的 deviceId 直接尝试连接该设备,无需进行搜索操作。
-		 */
-		B_CreateBLEConnection(state, context) {
-			let {
-				item,
-				success,
-				fail
-			} = context;
-			this.commit('initBLEData');
-			state.deviceId = item.deviceId;
-			let timeout = 10000;
-			console.log("B_CreateBLEConnection deviceId ==", state.deviceId)
-			uni.createBLEConnection({
-				// 这里的 deviceId 需要已经通过 createBLEConnection 与对应设备建立链接
-				deviceId: state.deviceId,
-				timeout: timeout,
-				success: res => {
-					if (success) {
-						success(res);
-					}
-				},
-				fail: res => {
-					if (fail)
-						fail(res);
-				}
-			});
-		},
-
-
-		/**
-		 * 获取设备的服务ID
-		 */
-		B_GetBLEDeviceServices(state, context) {
-
-			let {
-				retryCount,
-				item,
-				callback,
-				getServiceList,
-				getFail,
-			} = context;
-			let serviceList = [];
-			let _self = this;
-			uni.getBLEDeviceServices({
-				deviceId: item.deviceId,
-				success: res => {
-					console.log("getBLEDeviceServices==", JSON.stringify(res), item);
-					serviceList = res.services;
-					if (getServiceList) {
-						getServiceList(serviceList);
-					}
-					if (serviceList.length == 0) {
-						if(retryCount > 0){
-							retryCount --;
-							context.retryCount = retryCount;
-							setTimeout(()=>{
-								this.commit('B_GetBLEDeviceServices',context);
-							},500)
-							return;
-						}
-						if(getFail){
-							getFail();
-						}
-						uni.hideToast();
-						uni.showModal({
-							title: '提示',
-							content: '1.获取服务失败,请尝试重新连接设备。\r\n2.尝试重启设备再重新连接。'
-						})
-						
-					}
-					for (let i = 0; i < serviceList.length; i++) {
-						let service = serviceList[i];
-						if (service.uuid.toLocaleLowerCase() === item.PRIMARY_SERVICE.toLocaleLowerCase()) {
-							state.serviceId = service.uuid;
-							//开始获取指定服务的特征值
-							_self.commit('B_GetBLEDeviceCharacteristics', {
-								item: item,
-								callback: callback
-							});
-							break;
-						}
-					}
-				},
-				fail: failRes => {
-					console.log('device services:', failRes.services)
-					uni.showModal({
-						title: '连接失败',
-						content: '未获取到相应服务,请继续尝试连接设备。'
-					})
-				}
-			});
-		},
-		/**
-		 * 获取指定服务的特征值
-		 */
-		B_GetBLEDeviceCharacteristics(state, context) {
-			let {
-				item,
-				callback
-			} = context;
-			let deviceId = state.deviceId;
-			let serviceId = state.serviceId;
-			let characteristicsList = [];
-			uni.getBLEDeviceCharacteristics({
-				deviceId,
-				serviceId,
-				success: res => {
-					if (item.PRIMARY_NOTIFY != '') {
-						state.notifyCharacteristicId = item.PRIMARY_NOTIFY;
-						this.commit('B_NotifyBLECharacteristicValueChange', {
-							callback: callback
-						});
-					}
-					if (item.PRIMARY_WRITE != '') {
-						state.writeCharacteristicId = item.PRIMARY_WRITE;
-					}
-				},
-				fail: res => {
-					console.log('device getBLEDeviceCharacteristics failed:', JSON.stringify(res))
-				}
-			})
-		},
-
-		//启用低功耗蓝牙设备特征值变化时的 notify 功能,订阅特征值。
-		//注意:必须设备的特征值支持notify或者indicate才可以成功调用,具体参照 characteristic 的 properties 属性
-		B_NotifyBLECharacteristicValueChange(state, context) {
-			let {
-				callback
-			} = context;
-			// 启用notify功能
-			// console.log("启用notify功能");
-			uni.notifyBLECharacteristicValueChange({
-				state: true,
-				deviceId: state.deviceId,
-				serviceId: state.serviceId,
-				characteristicId: state.notifyCharacteristicId,
-				success: (res) => {
-					this.commit('B_OnBLECharacteristicValueChange', {
-						callback: callback
-					});
-					// _self.onBLECharacteristicValueChange(callback); //监听特征值变化
-				},
-				fail: (res) => {
-					uni.showToast({
-						title: 'notify启动失败',
-						icon: "none",
-						mask: true
-					});
-
-				}
-			})
-		},
-		//监听低功耗蓝牙设备的特征值变化。必须先启用notify接口才能接收到设备推送的notification。
-		B_OnBLECharacteristicValueChange(state, context) {
-			let {
-				callback
-			} = context;
-			console.log("onBLECharacteristicValueChange success");
-			if (callback) {
-				callback({
-					notifyCharacteristicId: state.notifyCharacteristicId,
-					writeCharacteristicId: state.writeCharacteristicId
-				})
-			}
-			uni.onBLECharacteristicValueChange(function(res) {
-				let box = {};
-				var resValue = BLE.ab2hext(res.value); //16进制字符串
-				if (state.currentInstruction == "V" && state.showToast) {
-					var resValueStr = BLE.hexToString(resValue);
-					let _info = {
-						type: 'version',
-						instruction: 'V',
-						value: resValueStr.replace(/\{|}/g, '').trim()
-					}
-					uni.$emit('listenerBLE', _info);
-					state.currentInstruction = "";
-					state.showToast = false;
-					return;
-				} else if (state.currentInstruction == 'M' && state.bListenerMac) {
-					var resValueStr = BLE.hexToString(resValue);
-					let _info = {
-						type: 'mac',
-						instruction: 'M',
-						value: resValueStr.replace(/\{|}/g, '').trim()
-					}
-					uni.$emit('listenerBLE', _info);
-					state.currentInstruction = "";
-					state.bListenerMac = false;
-					return;
-				}
-				//步数数据解析
-				if (state.bListenerJson) {
-					var resValueStr = BLE.hexToString(resValue);
-					console.log(resValueStr);
-					box["Json"] = resValueStr;
-					uni.$emit('updateBLEDeviceJson', box);
-				}
-				//原始数据解析
-				if (state.bListenerUpdate) {
-					//R/L 左手还是右手
-					let handle = resValue.substr(6, 2);
-					let axStr = resValue.substr(8, 4);
-					let ayStr = resValue.substr(12, 4);
-					let azStr = resValue.substr(16, 4);
-					//一个字节最大只能表示265  2个字节可以表示65536  然后你这边做一下转换 例如00 3E   3*16+14=62 ----->0.03  g 
-					//(真实值= AD值 /32768  * 16)
-					//0.003 = 62 / 2768  * 16
-					let ax = BLE.hexToSignedInt(axStr) / 32768 * 16;
-					let ay = BLE.hexToSignedInt(ayStr) / 32768 * 16;
-					let az = BLE.hexToSignedInt(azStr) / 32768 * 16;
-
-					let gxStr = resValue.substr(20, 4);
-					let gyStr = resValue.substr(24, 4);
-					let gzStr = resValue.substr(28, 4);
-					//角速度(AD值/32768 * 2000) 角速度单位是 °/s  范围是 正负2000
-					let gx = BLE.hexToSignedInt(gxStr) / 32768 * 2000;
-					let gy = BLE.hexToSignedInt(gyStr) / 32768 * 2000;
-					let gz = BLE.hexToSignedInt(gzStr) / 32768 * 2000;
-					//毫秒
-					let ms = BLE.hex2int(resValue.substr(2, 4));
-					//分
-					let min = BLE.hex2int(resValue.substr(32, 2));
-					//秒
-					let s = BLE.hex2int(resValue.substr(34, 2));
-					box["handle"] = BLE.hexToString(handle);
-					box["acc"] = {
-						ax,
-						ay,
-						az
-					};
-					box["gyro"] = {
-						gx,
-						gy,
-						gz
-					};
-
-					box["min"] = min;
-					box["s"] = s;
-					box["ms"] = ms;
-
-					//更新数据给webview,在game-play-web||game-play-sub绑定
-					//后面更新数据都用此接口
-					uni.$emit('updateBLEDeviceData', box);
-				}
-
-
-			});
-		},
-
-
-		//向低功耗蓝牙设备特征值中写入二进制数据。注意:必须设备的特征值支持 write 才可以成功调用。
-		B_WriteBLECharacteristicValue(state, context) {
-			let {
-				value,
-				retryCount,
-				success,
-				getFail
-			} = context;
-			if (!value && value === '') {
-				uni.showToast({
-					title: "指令为空"
-				})
-				return;
-			}
-			//记录一下指令
-			state.currentInstruction = value;
-			//V 获取版本,M 获取mac 地址
-			if (value == "V")
-				state.showToast = true;
-
-			if (value == "M") {
-				state.showToast = true;
-				state.bListenerMac = true;
-			}
-			if (value == "4") {
-				state.bListenerUpdate = false;
-			}
-			if (value == "3") {
-				if (state.bListenerUpdate) {
-					uni.showToast({
-						title: "原始数据已开启"
-					})
-					return;
-				}
-				state.bListenerUpdate = true;
-			}
-
-			if (value == "6") {
-				state.bListenerJson = false;
-			}
-			if (value == "5") {
-				if (state.bListenerJson) {
-					uni.showToast({
-						title: "步数数据已开启"
-					})
-					return;
-				}
-				state.bListenerJson = true;
-			}
-
-
-			console.log("currentInstruction:", state.currentInstruction, value, state.bListenerUpdate, state.bListenerMac);
-			console.log("state.deviceId:", state.deviceId, state.serviceId, state.writeCharacteristicId);
-			uni.writeBLECharacteristicValue({
-				deviceId: state.deviceId,
-				serviceId: state.serviceId,
-				// 这里的 characteristicId 需要在 getBLEDeviceCharacteristics 接口中获取
-				characteristicId: state.writeCharacteristicId,
-				// 这里的value是ArrayBuffer类型
-				value: BLE.str2ab(value),
-				success: (res) => {
-					console.log('writeBLECharacteristicValue success', res.errMsg, value, retryCount);
-					if (success) {
-						success(res);
-					}
-				},
-				fail: (fail) => {
-					console.log(fail)
-					//重新写入
-					if (retryCount > 0) {
-						console.log("writeBLECharacteristicValue Rewrite ===================>" + value + " == " + retryCount);
-						retryCount--;
-						setTimeout(() => {
-							this.commit("B_WriteBLECharacteristicValue", {
-								value,
-								retryCount,
-								success,
-								getFail
-							});
-						}, 300);
-					}
-					if (getFail) {
-						getFail(fail);
-					}
-				}
-			})
-
-		},
-
-		/**
-		 * 断开蓝牙连接
-		 */
-		B_CloseBLEConnection(state, context) {
-			let {
-				deviceId,
-				success = null
-			} = context;
-			uni.closeBLEConnection({
-				deviceId,
-				success: res => {
-					if (success)
-						success();
-				},
-				fail: (fail) => {
-					console.log("关闭蓝牙失败", fail);
-				}
-			});
-		},
-
-
-		//获取手机中蓝牙已匹配的设备
-		B_GetBondedDevices(state, context) {
-			// console.log("getBondedDevices ====>");
-			// 	uni.getBluetoothDevices({
-			// 		success(res) {
-			// 			console.log("getBluetoothDevices:", res)
-			// 		}
-			// 	})
-
-			// 	uni.getConnectedBluetoothDevices({
-			// 		success(res) {
-			// 			console.log("getConnectedBluetoothDevices:", res)
-			// 		}
-			// 	})
-			let {
-				success = null
-			} = context;
-			//Android
-			function android_bluetooth_list(deviceName) {
-				var main = plus.android.runtimeMainActivity();
-				var BluetoothAdapter = plus.android.importClass("android.bluetooth.BluetoothAdapter");
-				var BAdapter = BluetoothAdapter.getDefaultAdapter();
-				var Context = plus.android.importClass("android.content.Context");
-				var lists = BAdapter.getBondedDevices();
-				plus.android.importClass(lists);
-				var len = lists.size();
-				// console.log("getBondedDevices.len=" + len);
-				if (len == 0) {
-					//如果没有配对的设备
-					return null;
-				} else {
-					var iterator = lists.iterator();
-					plus.android.importClass(iterator);
-					while (iterator.hasNext()) {
-						var d = iterator.next();
-						plus.android.importClass(d);
-						let temp = null;
-						//
-						if (d.getName().indexOf(deviceName) > -1) {
-							// console.log(d.getName());
-							// console.log(d.getAddress());
-							// Classic	1	
-							// Dual	3	
-							// Le	2	
-							// Unknown	0
-							// console.log(d.getType());
-							// Bonded	12
-							// Bonding	11	Indicates bonding (pairing) is in progress with the remote device.
-							// None	10
-							// console.log(d.getBondState());
-							let typeEnum = {
-								0: 'Unknown',
-								1: 'Classic',
-								2: 'Le',
-								3: 'Dual'
-							};
-							let bondStateEnum = {
-								10: 'None',
-								11: 'Bonding',
-								12: 'Bonded'
-							};
-							temp = {
-								name: d.getName(),
-								address: d.getAddress(),
-								type: {
-									'value': d.getType(),
-									'name': typeEnum[d.getType()]
-								},
-								bondState: {
-									'value': d.getBondState(),
-									'name': bondStateEnum[d.getBondState()]
-								}
-							}
-
-						}
-						return temp;
-					}
-				}
-
-
-			}
-			
-			
-			function searchIOS(){
-			    var CBCentralManager = plus.ios.import("CBCentralManager");   
-			    var manager = new CBCentralManager();  
-			    var delegate = plus.ios.implements("CBCentralManagerDelegate", {  
-			                    "centralManagerDidUpdateState:": centralManagerDidUpdateState,  
-			                    "centralManager:didDiscoverPeripheral:advertisementData:RSSI:": didDiscoverPeripheral  
-			               });  
-			    if(plus.device.model=="iPad" || plus.device.model=="iPod"){  
-			        manager.initWithDelegatequeue(delegate,null);       
-			    }else{  
-			        manager.initWithDelegatequeue(delegate,null,null);    
-					 let arr = manager.retrieveConnectedPeripheralsWithServices();
-					 console.error(arr.length);
-			    }  
-			}  
-			function centralManagerDidUpdateState(central) {  
-			                console.log(central);  
-			                var state = central.plusGetAttribute('state');  
-			                console.log(state);  
-			                if (state == 4) {  
-			                    writelog('请开启蓝牙');  
-			                }  
-			                if(state==5){  
-			                    console.log("中央外设管理器状态 state= " + state);  
-			                    central.scanForPeripheralsWithServicesoptions(null, null);  
-			                }  
-			                //writelog("中央外设管理器状态 state= " + state);  
-			}  
-			
-			function didDiscoverPeripheral(central, peripheral, advertisementData, RSSI) {  
-			    var name = peripheral.plusGetAttribute("name");  
-			    var uuid = peripheral.plusGetAttribute("identifier").plusGetAttribute("UUIDString");  
-			    var rssi = RSSI.plusGetAttribute("intValue");  
-			    var dist = calcDistByRSSI(rssi,74,2);  
-			    writelog("蓝牙设备:"+ name + " " + uuid + " " + rssi + " " + dist + "米");  
-			
-			}   
-			
-			function writelog(msg){  
-			    console.log(msg);
-			}  
-			
-			function calcDistByRSSI(rssi,a,n){  
-			    var rs = Math.abs(rssi);  
-			    var power = (rs-a)/(10*n);  
-			    return Math.pow(10,parseFloat(power)).toFixed(2);  
-			}
-			
-			function ios_bluetooth_list(deviceName){
-				// let CBCentralManager= plus.ios.importClass("CBCentralManager");
-				// let _centralManager =  new CBCentralManager();
-				// _centralManager.initWithDelegatequeue(plus.ios.currentWebview(),null);
-				// let arr = _centralManager.retrieveConnectedPeripheralsWithServices();
-				// console.error(arr.length);
-				searchIOS();
-				return null;
-			}
-			
-			
-			
-			let device = null;
-
-			switch (plus.os.name) {
-				case "Android":
-					// Android平台: plus.android.*  
-					device = android_bluetooth_list("BGBox");
-					console.log("android getBondedDevices 匹配的对象======>", device)
-					if (device != null) {
-						state.bPhoneMatched = true;
-					} else {
-						state.bPhoneMatched = false;
-					}
-
-					break;
-				case "iOS":
-					// iOS平台: plus.ios.*  
-					device = ios_bluetooth_list("BGBox");
-					console.log("ios getBondedDevices 匹配的对象======>", device)
-					if (device != null) {
-						state.bPhoneMatched = true;
-					} else {
-						state.bPhoneMatched = false;
-					}
-					break;
-				default:
-					// 其它平台  
-					break;
-			}
-			if (success) {
-				success(device);
-			}
-		},
-
-		B_OpenBLESetting() {
-			function bluetooth_setting() {
-				var main = plus.android.runtimeMainActivity(); //获取activity  
-				var Intent = plus.android.importClass('android.content.Intent');
-				var Settings = plus.android.importClass('android.provider.Settings');
-				var intent = new Intent(Settings.ACTION_BLUETOOTH_SETTINGS); //可设置表中所有Action字段  
-				main.startActivity(intent);
-			}
-			let device = null;
-
-			switch (plus.os.name) {
-				case "Android":
-					// Android平台: plus.android.*  
-					bluetooth_setting();
-					break;
-				case "iOS":
-					// iOS平台: plus.ios.*  
-					break;
-				default:
-					// 其它平台  
-					break;
-			}
-
-		}
-	}
-})
-
+import Vue from 'vue'
+import Vuex from 'vuex'
+import config from 'common/config.js'
+import reqUtil from 'util/util-js/requstUtil.js'
+import date from 'util/util-js/date.js'
+import cNumber from 'util/util-js/makeNumber.js'
+import BLE from 'util/util-js/BLE.js';
+//快速打击部分
+import o0 from "@/util/util-js/o0.js"
+import o0Project from "@/util/util-js/o0Project.js"
+
+import deviceData from "@/util/util-js/devices.js"
+
+Vue.use(Vuex)
+
+const store = new Vuex.Store({
+	state: {
+		//引导层
+		bGuidePages: false,
+
+		//是否显示Canvas
+		bCanvasShow: true,
+		/**
+		 * 是否需要强制登录
+		 */
+		forcedLogin: false,
+
+		/**
+		 * 蓝牙实时发送数据的页面的名称
+		 */
+		currentPageName: '',
+
+		hasLogin: false,
+		userInfo: null,
+		userName: "匿名",
+		days: 0,
+		remainingDays: 0,
+		signature: '',
+		avatarUrl: "/static/defaultAvatar.png",
+		// 是否是新用户,
+		//TODO:登录接口返回的数据来判断
+		bNewUser: false,
+		//是否是第一次走新手
+		bNewGuide: false,
+		token: '',
+		gender: 0,
+
+		//省市区数据
+		city: {
+			label: '北京市-北京市-东城区',
+			cityCode: "110101",
+			//picker 选择器的index数组
+			value: [0, 0, 0]
+		},
+
+		birthday: date.formatTime(new Date()),
+		//默认值
+		height: 0,
+		weight: 0,
+		//最近在玩的列表
+		playGames: [],
+		//最近在玩的排行游戏列表
+		playRankingGames: [],
+		//全部的游戏列表
+		allGames: [],
+		//关注的游戏列表
+		favoriteGames: [],
+		// 排行榜里面显示的游戏
+		rankSelectedGame: null,
+		rankInfo: null,
+		cityName: "某市",
+		/**
+		 * 默认的运动数据
+		 * date.addDaysFromNewDate(new Date(),1)
+		 */
+		defaultPlanData: {
+			startTime: date.formatDate(new Date()),
+			endTime: date.addDaysFromNewDate(new Date(), 6),
+			targetWeight: 0, //目标公斤
+			calorie: 360, //运动消耗的卡路里,默认300 大卡
+			cumulativeCalorie: 0, //累计增重
+			sportTime: 40, //运动时间
+			/**
+			 * 本地记录的消耗卡路里数量
+			 */
+			localCalorie: 0,
+			/**
+			 * 显示卡路里,过了12点清空
+			 */
+			showCalorie: 0,
+			/**
+			 * 总和
+			 */
+			allCalorie: 0
+		},
+		/**
+		 * 计划的运动数据
+		 */
+		planData: {
+			startTime: date.formatDate(new Date()),
+			endTime: date.formatDate(new Date()), //date.addDaysFromNewDate(new Date(),1),
+			targetWeight: 0, //目标公斤
+			cumulativeCalorie: 0, //累计增重
+			calorie: 300, //运动消耗的卡路里
+			sportTime: 40, //运动时间
+			/**
+			 * 本地记录的消耗卡路里数量
+			 */
+			localCalorie: 0,
+			/**
+			 * 显示卡路里,过了12点清空
+			 */
+			showCalorie: 0,
+			/**
+			 * 总和
+			 */
+			allCalorie: 0
+		},
+
+		//记录表盘计划刷新的卡路里
+		oldArcbarProCalorie: 0,
+		//记录表盘当前的总卡路里
+		oldArcbarAllCalorie: 0,
+
+
+		//当前运动的世时间
+		localSportTime: 0,
+
+
+		//当前运动时间,运动时候记录的时间
+		runingTime: 0,
+		//蓝牙设备信息列表
+		//id 不可变,用于保存到本地区分
+		BLEInfoList: deviceData.getDeviceList(),
+		//记录的蓝牙设备,保存id, 和对应的蓝牙连接数据
+		BLEDeviceList: [],
+		//显示的蓝牙设备,取本地数据时候更新
+		BLEDeviceShowList: [],
+		//选择连接的蓝牙设备
+		BLEConnectDevice: null,
+		//获取到的服务
+		BLEGetServices: null,
+		//当前发送给蓝牙的指令,目前是只有蓝牙手柄
+		currentInstruction: '',
+
+		instructionState: {
+			// bAcc: false, //是否开启加速计状态
+			// bGyroscope: false, //是否开启陀螺仪状态
+			bOpen: false, //是否开启指令
+			bSteps: false, //是否开启步数
+		},
+
+
+		//绑定的设备
+		DeviceBindingList: [],
+		ConnectBindingDevice: null,
+
+		cIndex: -1,
+		//当前是否连接
+		bConnection: false,
+		/**
+		 * 通过验证的连接,比如通过mac验证,或者说是首页直连,都设置这个参数,确保已经连上
+		 */
+		bVerifiedConnection: false,
+
+		/**
+		 * Android 出现不匹配的情况下,判断
+		 * ios 暂时没有此类问题
+		 */
+		bPhoneMatched: false,
+
+		//最近连接过的设备
+		finallyUseDevice: null,
+
+		//phoneNumber
+		phoneNumber: '',
+		openid: '',
+		appleid: '',
+
+		//获取验证码
+		bCodeDisabled: false,
+		count: 59,
+		interval: null,
+
+		//conversion列表
+		oldSwiperList: [],
+
+		// 计划任务过期
+		bPlanExpired: false,
+		// 制定玩计划任务后
+		bPlanFinish: false,
+
+		//标准体重,男女根据当前年龄计算
+		standardWeight: 0,
+
+		//是否安装了微信
+		bInstallWechat: false,
+		bHideWeixin: false,
+
+		system: '', // 系统版本
+		platform: '', // 平台
+		appName: '',
+		version: '1.6.3', //软件版本
+		versionCode: '',
+		showEndTime: config.endTime, //游戏显示时间字段,后台返回对应此时间之前的数据
+
+		globalAcc: null,
+		globalOri: null,
+
+		//当前显示的模式下标
+		currentModeIndex: 0,
+
+		//蓝牙变量操作
+		/**
+		 * 操作蓝牙设备
+		 */
+		bOpenBluetooth: false,
+		/**
+		 * 是否初始化蓝牙适配器
+		 */
+		bOpenSuccess: false,
+		/**
+		 * 是否监听蓝牙状态变化
+		 */
+		bListenAdapterStateChange: false,
+		/**
+		 * 是否监听寻找新设备事件
+		 */
+		bListenDeviceFound: false,
+
+		// 设备Id
+		BLEDeviceId: "",
+		// 服务Id
+		BLEServiceId: "",
+		// 特征值id
+		BLENotifyCharacteristicId: "",
+
+		//监听rssi对象
+		BLERSSIInterval: null,
+
+		//蓝牙服务timeout
+		getBLEDeviceServicesTimeout: null,
+
+		//本地游戏地址
+		// http://192.168.0.112:7456/build/index.html
+		// http://127.0.0.1:7456/build/index.html
+		LocationGameUrl: "http://110.43.54.43/t8/",
+
+		//快速打击对象
+		filter: null,
+		deviceMs: 1,
+
+
+		/**
+		 * 蓝牙参数对象
+		 */
+
+		// 设备Id
+		deviceId: "",
+		// 服务Id
+		serviceId: "",
+		notifyCharacteristicId: "",
+		writeCharacteristicId: "",
+		currentInstruction: "",
+		showToast: false,
+		bListenerUpdate: false,
+		bListenerJson: false,
+		bListenerMac: false,
+	},
+	mutations: {
+
+		/**
+		 * 获取记录的最后一次连接设备
+		 * @param {Object} state
+		 */
+		getFinalUseDevice(state) {
+			// 获取本地存储的最后一次使用的设备
+			//1.获取最近连接的蓝牙设备, 指蓝牙搜索到的obj
+			const value = uni.getStorageSync('finallyUseDevice');
+			if (value) {
+				state.finallyUseDevice = value;
+			}
+			console.log('获取的finallyUseDevice', value);
+		},
+
+		/**
+		 * 存储最后一次使用的设备信息,后面登陆时候,如果存在设备最后一次使用信息,则自动连接
+		 * @param {Object} state
+		 * @param {Object} device
+		 */
+		setFinallUseDevice(state, device) {
+			uni.setStorage({
+				key: 'finallyUseDevice',
+				data: device,
+				success: (res) => {
+					state.finallyUseDevice = device;
+					console.log("保存finallyUseDevice:", res);
+				}
+			})
+		},
+		/**
+		 * 移除记录的use device
+		 */
+		clearFinallUseDevice(state) {
+			uni.removeStorage({
+				key: 'finallyUseDevice',
+				success: (res) => {
+					state.finallyUseDevice = null;
+					console.log("移除finallyUseDevice:", res);
+				}
+			})
+		},
+		/**
+		 * 设置运动时间
+		 * @param {Object} state
+		 * @param {Object} time
+		 */
+		setLocalSportTime(state, time) {
+			// let _sportTime = Number(time);
+			state.localSportTime = Number(time);
+
+			uni.setStorage({
+				key: 'localSportTime',
+				data: state.localSportTime,
+				success: (res) => {
+					// uni.showToast({
+					// 	title: "保存成功"
+					// })
+				}
+			})
+		},
+
+		/**
+		 * 设置卡路里
+		 * @param {Object} state
+		 * @param {Object} calorie
+		 */
+		setLocalCalorie(state, calorie) {
+			state.planData.localCalorie = Number(calorie);
+
+			uni.setStorage({
+				key: 'localCalorie',
+				data: state.planData.localCalorie,
+				success: (res) => {
+					// uni.showToast({
+					// 	title: "保存成功"
+					// })
+				}
+			})
+		},
+
+		/**
+		 * 设置表盘显示的卡路里,
+		 * @param {Object} state
+		 * @param {Object} calorie
+		 */
+		setShowCalorie(state, calorie) {
+			state.planData.showCalorie = Number(calorie);
+
+			uni.setStorage({
+				key: 'showCalorie',
+				data: state.planData.showCalorie,
+				success: (res) => {
+					// uni.showToast({
+					// 	title: "保存成功"
+					// })
+				}
+			})
+		},
+
+		/**
+		 * 增加卡路里
+		 * @param {Object} state
+		 * @param {Object} calorie
+		 */
+		addlocalCalorie(state, calorie) {
+			//卡路里不能为负数
+			calorie = Math.abs(calorie);
+
+			//当前需要添加的卡路里
+			let temNum = Number(calorie);
+			//本地的卡路里
+			let temNum2 = Number(state.planData.localCalorie);
+			// 本地加 + 传入的卡路里
+			let _numberLocal = temNum.add(temNum2);
+
+			//显示的卡路里
+			let _showCalorie = Number(state.planData.showCalorie);
+			//显示的卡路里加上 本地卡路里 和添加的卡路里之和要小于或等于 计划的卡路里
+			let _allCalorie = _numberLocal.add(_showCalorie);
+			// console.log("计算的最后卡路里_showCalorie:", _showCalorie,_allCalorie);
+			//如果超过计划的,用计划的卡路里记录
+			if (_allCalorie > state.planData.calorie) {
+				let _calorie = Number(state.planData.calorie);
+				//假如更新时候,localCalorie 值不为0,但是还未更新给服务器,此时,不能设置localCalorie 0
+				//用传入的值,减去 allcalorie 总和和目标的差
+				let _value = Number(_allCalorie).sub(_calorie);
+				let _endValue = Number(_numberLocal).sub(_value);
+				state.planData.localCalorie = Number(_endValue.toFixed(2));
+				//如果大于或者等于的话,用计划 于 显示的卡路里 差值
+				// state.planData.localCalorie = Number(_calorie.sub(_showCalorie).toFixed(2));
+
+				// //显示最大值
+				// state.planData.showCalorie = Number(_calorie.sub(state.planData.localCalorie).toFixed(2));
+			} else {
+				//
+				state.planData.localCalorie = Number(_numberLocal.toFixed(2));
+				// //输入的卡路里 + 自身显示的卡路里
+				// state.planData.showCalorie = Number(temNum.add(_showCalorie).toFixed(2)); 
+			}
+
+			console.log("计算的最后卡路里:", state.planData);
+
+			if (state.planData.localCalorie < 0) {
+				//如果修改计划时候,本地数据计算的结果为负数,先取总和,localCalorie负再重置为0
+				state.planData.showCalorie = _showCalorie.add(state.planData.localCalorie);
+				state.planData.allCalorie = state.planData.showCalorie;
+				state.planData.localCalorie = 0;
+			} else {
+				state.planData.allCalorie = _showCalorie.add(state.planData.localCalorie);
+			}
+
+
+
+
+			try {
+				uni.setStorageSync('localCalorie', state.planData.localCalorie);
+			} catch (e) {
+				// error
+				console.error(e);
+			}
+			try {
+				uni.setStorageSync('showCalorie', state.planData.showCalorie);
+			} catch (e) {
+				// error
+				console.error(e);
+			}
+			// uni.setStorage({
+			// 	key: 'localCalorie',
+			// 	data: state.planData.localCalorie,
+			// 	success: (res) => {
+			// 		// uni.showToast({
+			// 		// 	title: "保存成功"
+			// 		// })
+			// 	}
+			// })
+
+			// uni.setStorage({
+			// 	key: 'showCalorie',
+			// 	data: state.planData.showCalorie,
+			// 	success: (res) => {
+			// 		// uni.showToast({
+			// 		// 	title: "保存成功"
+			// 		// })
+			// 	}
+			// })
+		},
+		/**
+		 * 每次登陆同步本地数据到服务器
+		 * 当天的数据更新,只更新一次
+		 * @param {Object} state
+		 */
+		syncLocalDataToServer(state, callback) {
+			let self = this;
+			uni.getStorage({
+				key: 'syncDate',
+				success: function(res) {
+					// console.log(res.data);
+					let oldTime = res.data;
+					let nDate = new Date();
+					let newTime = date.formatDate(nDate);
+					let days = date.datedifference(newTime, oldTime);
+					// console.log(days);
+					// 如果相差大于1天,
+					if (days != 0) {
+						// 更新存储日期
+						uni.setStorageSync("syncDate", newTime);
+
+
+
+						// 执行更新函数
+						self.commit("syncRequestEvent", {
+							success: () => {
+								//清空显示的本地数据
+								self.commit("setShowCalorie", 0);
+								state.planData.allCalorie = state.planData.showCalorie.
+								add(state.planData.localCalorie);
+
+								if (callback)
+									callback({
+										newDate: nDate
+									});
+							}
+						});
+
+						//清空记录的本地运动时间
+						// console.log('情况运动时间');
+						self.commit("setLocalSportTime", 0);
+
+						//设置本地数据是0
+						state.localSportTime = 0;
+
+
+					} else {
+						if (callback)
+							callback({
+								newDate: nDate
+							});
+					}
+
+					// date.getDays.
+				},
+				fail: function(res) {
+					// console.error(res);
+					// 如果没有日期,则存储一个新的
+					let nDate = new Date();
+					let tempTime = date.formatDate(nDate);
+					uni.setStorageSync("syncDate", tempTime);
+
+					if (callback)
+						callback({
+							newDate: nDate
+						});
+				}
+			});
+
+
+
+		},
+		// 同步数据的请求
+		syncRequestEvent(state, data) {
+			let self = this;
+			let {
+				success,
+				fail
+			} = data;
+
+			//需要卡路里取整存服务器,小数点后面,继续保留。以消除累计误差
+			let oldLocalCalorie = state.planData.localCalorie;
+			let _localCalorieInt = parseInt(state.planData.localCalorie);
+			//小数点后面
+			let _afterLocalCalorie = Number(oldLocalCalorie).sub(_localCalorieInt);
+
+			console.log("*******===:", oldLocalCalorie, _localCalorieInt, _afterLocalCalorie);
+
+
+			if (_localCalorieInt === 0) {
+				// uni.showToast({
+				// 	title: '',
+				// 	icon: 'loading',
+				// 	mask: true,
+				// 	duration: 1000
+				// })
+				if (success)
+					success();
+				return;
+			}
+			uni.showToast({
+				title: '',
+				icon: 'loading',
+				mask: false,
+				duration: 10000
+			})
+			//把卡路里累计到cumulativeCalorie 变量,之后传服务器 += Math.round(state.planData.localCalorie)
+			state.planData.cumulativeCalorie += _localCalorieInt;
+			//添加到showCalorie 中
+			state.planData.showCalorie = Number(state.planData.showCalorie).add(_localCalorieInt);
+
+			state.planData.allCalorie = state.planData.showCalorie.add(_afterLocalCalorie);
+
+			//不管是否同步成功,清空本地记录的卡路里,前一步已添加到cumulativeCalorie
+			self.commit("setLocalCalorie", _afterLocalCalorie);
+			self.commit("setShowCalorie", Number(state.planData.showCalorie));
+
+
+			// 把卡路里记录到服务器
+			reqUtil.requestData(config.URL.FITNESSPROGRAM, state.planData, 'POST').then(
+				res => {
+					// console.warn(res);
+					if (res.code == 0) {
+						uni.showToast({
+							title: '同步成功',
+							mask: true,
+							duration: 1000
+						});
+						//同步一下服务器的返回值
+						state.planData = Object.assign(state.planData, res.data);
+						//暂时默认同步拳击1 的卡路里
+						reqUtil.requestData(config.URL.UPLOADRANKING, {
+							gameId: '1', //拳击模式 game id = 1;
+							score: _localCalorieInt,
+							cityCode: state.city.cityCode,
+						}, "POST").then(res => {
+								console.warn('****上传首页拳击卡路里,后面多个模式,可能需要多个不同的游戏id ***', res);
+							},
+							e => {
+								console.log(e)
+							});
+
+						setTimeout(() => {
+							uni.hideToast();
+						}, 1000);
+
+
+
+						if (success)
+							success();
+					} else {
+
+						state.planData.cumulativeCalorie = Number(state.planData.cumulativeCalorie).sub(_localCalorieInt);
+						state.planData.showCalorie = Number(state.planData.showCalorie).sub(_localCalorieInt);
+
+						self.commit("setLocalCalorie", oldLocalCalorie);
+						if (fail)
+							fail();
+					}
+					console.log("减法 ==", Number(state.planData.cumulativeCalorie).sub(_localCalorieInt));
+
+
+				},
+				e => {
+					console.log(e);
+					state.planData.cumulativeCalorie = Number(state.planData.cumulativeCalorie).sub(_localCalorieInt);
+					state.planData.showCalorie = Number(state.planData.showCalorie).sub(_localCalorieInt);
+					self.commit("setLocalCalorie", oldLocalCalorie);
+
+					uni.hideToast();
+					if (fail)
+						fail();
+				}
+			);
+		},
+		//登录成功后,重置一下状态
+		resetCountDown(state) {
+
+			if (state.interval) {
+				clearInterval(state.interval);
+				state.interval = null;
+				state.count = 59;
+				state.bCodeDisabled = false;
+			}
+
+		},
+
+		//验证码操作
+		countDown(state, phoneNumber) {
+			//限制验证码操作
+			state.bCodeDisabled = true;
+			state.interval = setInterval(() => {
+				--state.count;
+				if (state.count <= 0) {
+					clearInterval(state.interval);
+					state.interval = null;
+					state.count = 59;
+					state.bCodeDisabled = false;
+				}
+			}, 1000);
+			setTimeout(() => {
+				clearInterval(state.interval)
+				state.count = 59;
+				state.bCodeDisabled = false;
+			}, 60000);
+			reqUtil.requestData(config.URL.GETCODE, {
+				"phoneNumber": phoneNumber
+			}).then(res => {
+					console.log('requestData GETCODE =====', res);
+					uni.showToast({
+						title: "发送成功",
+						mask: true,
+						duration: 1000
+					})
+
+				},
+				e => {
+					console.log(e)
+				});
+
+		},
+		//获取记录的蓝牙列表数据
+		getBLEDeviceList(state) {
+			// console.log("getBLEDeviceList=");
+			uni.getStorage({
+				key: 'BLEDeviceList',
+				success: (res) => {
+					console.log("*****getBLEDeviceList=", res);
+					let _list = res.data;
+					state.BLEDeviceList = res.data;
+					//更新BLEDeviceShowList 数组
+					state.BLEDeviceShowList = [];
+					_list.forEach(item => {
+						//如果记录到本地的id,和信息列表中的id一致,则结合
+						for (let i = 0; i < state.BLEInfoList.length; i++) {
+							let eq = state.BLEInfoList[i];
+							if (item.id == eq.id) {
+								state.BLEDeviceShowList.push(Object.assign({}, item, eq));
+								break;
+							}
+						}
+					})
+
+				}
+			})
+		},
+
+		//添加蓝牙设备数据
+		addBLEDevice(state, data) {
+			let devicelist = [];
+			if (state.BLEDeviceList && state.BLEDeviceList.length != 0) {
+				devicelist = state.BLEDeviceList;
+			}
+			// console.log(data, devicelist)
+
+			let bHas = false;
+			devicelist.forEach((item, index, selfArr) => {
+				if (item.id == data.id) {
+					//如果存在,更新保存的数据,比如 mac或者uuid等 
+					selfArr[index] = item = Object.assign({}, item, data);
+					bHas = true;
+				}
+			})
+			//把当前添加的的蓝牙设信息备作为最后一次连接覆盖到本地
+			this.commit('setFinallUseDevice', data);
+
+			if (bHas) {
+				return;
+			}
+			//设置蓝牙列表本地信息
+			devicelist.push(data);
+			uni.setStorage({
+				key: 'BLEDeviceList',
+				data: devicelist,
+				success: (res) => {
+					// uni.showToast({
+					// 	title: "保存成功"
+					// })
+					state.BLEDeviceList = devicelist;
+					// console.log("devicelist:",devicelist);
+					//更新BLEDeviceShowList 数组
+					state.BLEDeviceShowList = [];
+					devicelist.forEach(item => {
+						//如果记录到本地的id,和信息列表中的id一致,则结合
+						for (let i = 0; i < state.BLEInfoList.length; i++) {
+							let eq = state.BLEInfoList[i];
+							if (item.id == eq.id) {
+								// console.log("item:",item);
+								state.BLEDeviceShowList.push(Object.assign({}, item, eq));
+								break;
+							}
+						}
+					})
+					// console.log("state.BLEDeviceShowList:",state.BLEDeviceShowList);
+				}
+			})
+		},
+		//删除蓝牙设备数据
+		deleteBLEDevice(state, index) {
+			let devicelist = [];
+			devicelist = state.BLEDeviceList;
+
+			devicelist.splice(index, 1);
+			uni.setStorage({
+				key: 'BLEDeviceList',
+				data: devicelist,
+				success: (res) => {
+					uni.showToast({
+						title: "删除成功"
+					})
+					state.BLEDeviceList = devicelist;
+					//更新BLEDeviceShowList 数组
+					state.BLEDeviceShowList = [];
+					devicelist.forEach(item => {
+						//如果记录到本地的id,和信息列表中的id一致,则结合
+						for (let i = 0; i < state.BLEInfoList.length; i++) {
+							let eq = state.BLEInfoList[i];
+							if (item.id == eq.id) {
+								state.BLEDeviceShowList.push(Object.assign({}, item, eq));
+								break;
+							}
+						}
+					})
+				}
+			})
+		},
+
+		//获取计划表数据
+		getPlanData(state, callback) {
+			reqUtil.requestData(config.URL.FITNESSPROGRAMGET).then(res => {
+					// console.log('获取计划表数据:getPlanData=====', res.data);
+					if (res.code == 0) {
+
+						state.planData = Object.assign(state.planData, res.data);
+
+						// 处理本地数据
+						let templocalCalorie = uni.getStorageSync("localCalorie");
+						// console.log("templocalCalorie:", templocalCalorie, state.planData);
+						if (templocalCalorie) {
+							templocalCalorie = Number(templocalCalorie);
+							if (templocalCalorie > state.planData.calorie) {
+								state.planData.localCalorie = state.planData.calorie;
+								uni.setStorage({
+									key: "localCalorie",
+									data: state.planData.localCalorie
+								});
+							} else {
+								state.planData.localCalorie = templocalCalorie;
+							}
+						} else {
+							state.planData.localCalorie = 0;
+						}
+
+						//处理本地的cumulativeCalorie
+						let tempShowCalorie = uni.getStorageSync("showCalorie");
+						// console.log("tempShowCalorie:", tempShowCalorie, state.planData);
+						if (tempShowCalorie) {
+							tempShowCalorie = Number(tempShowCalorie);
+							if (tempShowCalorie > state.planData.calorie) {
+								state.planData.showCalorie = state.planData.calorie;
+								uni.setStorage({
+									key: "showCalorie",
+									data: state.planData.showCalorie
+								});
+							} else {
+								state.planData.showCalorie = tempShowCalorie;
+							}
+						} else {
+							state.planData.showCalorie = 0;
+						}
+
+
+						state.planData.allCalorie = state.planData.showCalorie.add(state.planData.localCalorie);
+
+						// console.log("======",state.planData )
+						state.days = date.datedifference(res.data.startTime, res.data.endTime) + 1;
+						let nDate = new Date();
+						let tempTime = date.formatDate(nDate);
+						state.remainingDays = date.datedifference(tempTime, res.data.endTime) + 1;
+
+						// console.log("state.remainingDays======", state.remainingDays);
+					}
+					// showArcbar
+					if (callback) {
+						callback();
+					}
+
+				},
+				e => {
+					console.log(e)
+				});
+		},
+		/**
+		 * 获取全部游戏
+		 * @param {Object} state
+		 */
+		getAllGame(state, callback) {
+			//获得全部游戏列表
+			if (state.allGames.length != 0) {
+				if (callback)
+					callback();
+				return;
+			}
+			reqUtil.requestData(
+				config.URL.GAMELIST_BY_RANKING_SHOW, {
+					rankingShow: 1,
+					page: 1,
+					size: 100
+				}
+			).then(res => {
+					// console.log('获取默认的全部游戏 =====', res);
+					if (res.code == 0) {
+						state.allGames = [];
+						state.allGames = state.allGames.concat(res.data);
+					}
+					if (callback)
+						callback();
+				},
+				e => {
+					console.log(e);
+					if (callback)
+						callback();
+				}
+			);
+		},
+		getRankGame(state, data) {
+			let {
+				param,
+				callback
+			} = data;
+
+			reqUtil.requestData(config.URL.GETRANKRANGR, param).then(res => {
+
+					console.log('获取默认的游戏数据:GETRANKRANGR=====', res);
+					if (res.data != null) {
+						state.rankSelectedGame = res.data.gameInfo;
+						state.rankInfo = res.data.rankInfo;
+						//然后获取排名
+
+					}
+					if (callback)
+						callback(res);
+
+				},
+				e => {
+					console.log(e)
+				});
+		},
+		/**
+		 * 苹果端登陆
+		 * @param {Object} state
+		 * @param {Object} data
+		 */
+		appleUserInfoLogin(state, data) {
+			let self = this;
+			let {
+				params,
+				callback
+			} = data;
+			console.log('获取用户数据:USERINFOAPPLEADD params=====', params);
+			reqUtil.requestData(config.URL.USERINFOAPPLEADD, params, 'POST').then(res => {
+					console.log('获取用户数据:USERINFOAPPLEADD =====', res);
+					if (res.code == 0) {
+						let userInfo = res.data;
+						self.commit('login', userInfo);
+						console.log("11~~");
+					} else if (res.code = 201) {
+						state.hasLogin = true;
+					}
+					console.log("apple callback!!!");
+					callback();
+				},
+				e => {
+					console.log(e)
+				});
+		},
+		//添加用户信息和登录
+		addUserAvatarAndLogin(state, data) {
+			let self = this;
+			let {
+				params,
+				filePath,
+				callback
+			} = data;
+			console.log("addUserAvatarAndLogin 初始化对应数据");
+			reqUtil.reqUpload(config.URL.USERINFOADDAVATARINFO, params, filePath).then(res => {
+					console.log('获取用户数据:USERINFOADDAVATARINFO =====', res);
+					if (res.code == 0) {
+						let userInfo = res.data;
+						self.commit('login', userInfo);
+					} else if (res.code = 201) {
+						state.hasLogin = true;
+					}
+
+					if (callback) {
+						callback();
+					}
+
+
+
+				},
+				e => {
+					console.log(e)
+				});
+		},
+		//app登录或h5
+		accountLogin(state, callback) {
+			let self = this;
+			// console.log("app登录或h5 初始化对应数据")
+			reqUtil.requestData(config.URL.USERINFOURL).then(res => {
+					console.log('获取用户数据:USERINFOURL =====', res);
+					if (res.code == 0) {
+						let userInfo = res.data.userInfo;
+						state.phoneNumber = res.data.phoneNumber || '';
+						state.openid = res.data.openid || '';
+						self.commit('login', userInfo);
+					} else if (res.code = 201) {
+						state.hasLogin = true;
+					}
+
+					if (callback) {
+						callback();
+					}
+
+
+
+				},
+				e => {
+					console.log(e)
+				});
+		},
+		//小程序页面登录
+		login(state, userInfo) {
+			console.log("登陆的信息==", userInfo);
+			if (userInfo.cityCode == "" || userInfo.cityCode == null) {
+				//不存在就设置默认值
+				userInfo.cityCode = state.city.cityCode;
+			}
+			let cityCode = userInfo.cityCode;
+			// console.log("cicicicitycode:", cityCode);
+			let provinceData = require('@/components/slambb-picker/city-data/province.js').default;
+			let cityData = require('@/components/slambb-picker/city-data/city.js').default;
+			let areaData = require('@/components/slambb-picker/city-data/area.js').default;
+			// 解析citycode
+			for (let i = 0; i < provinceData.length; i++) {
+				if (provinceData[i].value == cityCode.substr(0, 2)) {
+					let currentCityData = cityData[i];
+					for (let j = 0; j < currentCityData.length; j++) {
+						if (currentCityData[j].value == cityCode.substr(0, 4)) {
+							let areaDataTemp = areaData[i][j];
+							for (let k = 0; k < areaDataTemp.length; k++) {
+								if (areaDataTemp[k].value == cityCode) {
+									state.city.value = [i, j, k];
+									state.city.label = provinceData[i].label +
+										'-' +
+										currentCityData[j].label +
+										'-' +
+										areaDataTemp[k].label;
+									state.cityName = currentCityData[j].label;
+									break;
+								}
+							}
+							break;
+						}
+					}
+					break;
+				}
+			}
+
+			state.userInfo = userInfo;
+			state.userName = userInfo.username || '新用户';
+			state.avatarUrl = userInfo.avatarUrl || '/static/defaultAvatar.png';
+			state.gender = userInfo.gender;
+			state.signature = userInfo.signature || '';
+			state.birthday = userInfo.birthday;
+			state.city.cityCode = cityCode.toString();
+			state.weight = userInfo.weight || state.weight;
+			state.height = userInfo.height || state.height;
+			state.hasLogin = true;
+
+			//登录时候 获取一下排行榜里面的游戏
+			// this.commit('getRankGame', {
+			// 	param: {
+			// 		type: "china",
+			// 		cityCode: 12345
+			// 	}
+			// });
+
+		},
+
+		// 退出登录
+		// 删除token 操作
+		delectToken(state, data) {
+			let self = this;
+			let {
+				success
+			} = data;
+			reqUtil.requestData(config.URL.USERLOGINOUT, {}).then(res => {
+					console.log('USERLOGINOUT=====', res);
+					self.commit("logout");
+					try {
+						//清空保存的storage
+						uni.clearStorageSync();
+					} catch (e) {
+						// error
+						console.error(e);
+					}
+					if (state.BLERSSIInterval) {
+						clearInterval(state.BLERSSIInterval);
+						state.BLERSSIInterval = null;
+					}
+
+					if (state.BLEConnectDevice) {
+						self.commit("onCloseBLEConnection", {
+							getSuccess: () => {}
+						});
+					}
+
+					if (success) {
+						success(res);
+					}
+
+				},
+				e => {
+					console.log(e)
+				});
+		},
+		logout(state) {
+			state.userInfo = null;
+			state.userName = "匿名";
+			state.avatarUrl = '/static/defaultAvatar.png';
+			state.days = '0';
+			state.signature = '';
+			state.gender = 0;
+			state.hasLogin = false;
+
+			state.phoneNumber = '';
+			state.openid = '';
+			state.appleid = '';
+
+			//处理设备值
+			state.cIndex = -1;
+			//绑定的设备
+			state.ConnectBindingDevice = null;
+			//蓝牙设备
+			state.BLEConnectDevice = null;
+
+			//蓝牙服务
+			state.BLEGetServices = null;
+
+			//最近连接过的设备
+			state.finallyUseDevice = null;
+
+			//记录的蓝牙设备,保存id, 和对应的蓝牙连接数据
+			state.BLEDeviceList = [];
+			//显示的蓝牙设备,取本地数据时候更新
+			state.BLEDeviceShowList = [];
+
+			//记录表盘计划刷新的卡路里
+			state.oldArcbarProCalorie = 0;
+			//记录表盘当前的总卡路里
+			state.oldArcbarAllCalorie = 0;
+		},
+
+		loginUserInfo(state, data) {
+			let {
+				infoRes,
+				success,
+				fail
+			} = data;
+			console.log('loginUserInfo');
+
+			reqUtil.requestData(config.URL.WXGETUSERINFO, {
+				appid: 'wxd6dfd60729d33d17',
+				encryptedData: infoRes.encryptedData,
+				iv: infoRes.iv,
+				signature: infoRes.signature,
+				rawData: infoRes.rawData
+			}).then(res => {
+					console.log('wxInfoRes=====', res);
+					let userInfo = res.data;
+					this.commit('login', userInfo);
+					if (success) {
+						success(res);
+					}
+
+				},
+				e => {
+					console.log(e)
+					if (fail) {
+						success(fail);
+					}
+				});
+		},
+		//这里统一静默处理login
+		oauth(state, context) {
+			let {
+				value,
+				callback
+			} = context;
+			uni.login({
+				provider: value,
+				success: (res) => {
+					// console.log('code:', res);
+					reqUtil.requestData(config.URL.USERlOGINURL, {
+						appid: 'wxd6dfd60729d33d17',
+						code: res.code,
+						platfrom: value
+					}).then(res => {
+							console.log('login token=====', res);
+							state.token = res.data.token;
+							uni.setStorageSync('token', state.token);
+							uni.getUserInfo({
+								provider: value,
+								success: (infoRes) => {
+									if (callback) {
+										callback(infoRes);
+									}
+								},
+								fail: (failRes) => {
+									//假如没有授权,login 之后,不做处理,需要用户点击授权时候,再进行处理用户登录
+									console.log('getUserInfo failRes:', failRes)
+								}
+							});
+						},
+						e => {
+							console.log(e)
+						});
+
+
+				},
+				fail: (err) => {
+					console.error('授权登录失败:' + JSON.stringify(err));
+				}
+			});
+		},
+		onLuanchLogin(state, data) {
+			let {
+				success
+			} = data;
+			const filters = ['weixin', 'qq', 'sinaweibo'];
+			let platform = '';
+			uni.getProvider({
+				service: 'oauth',
+				success: (res) => {
+					if (res.provider && res.provider.length) {
+						for (let i = 0; i < res.provider.length; i++) {
+							if (~filters.indexOf(res.provider[i])) {
+								platform = res.provider[i];
+								console.log("platform=", platform);
+								uni.showToast({
+									icon: 'loading',
+									title: ''
+								})
+								this.commit('oauth', {
+									value: platform,
+									callback: (infoRes) => {
+										// console.log("infoRes:", infoRes);
+										this.commit('loginUserInfo', {
+											infoRes: infoRes,
+											success: (res) => {
+												console.log("获取用户成功");
+												if (success) {
+													success(res);
+												}
+												uni.hideToast();
+											},
+											fail: (res) => {
+												console.error("获取用户失败");
+												uni.hideToast();
+											}
+										});
+									}
+								})
+							}
+						}
+						this.hasProvider = true;
+					}
+				},
+				fail: (err) => {
+					console.error('获取服务供应商失败:' + JSON.stringify(err));
+				}
+			});
+		},
+
+
+		initAdapter(state, callback) {
+			//初始化蓝牙模块
+			let params = {
+				success: (res) => {
+					state.bOpenSuccess = true;
+					state.bOpenBluetooth = true;
+					if (callback)
+						callback(res);
+					//监听断开事件
+					this.commit("B_OnBLEConnectionStateChange");
+				},
+				fail: (fail) => {
+					state.bOpenSuccess = false;
+					state.bOpenBluetooth = false;
+					uni.showToast({
+						title: '蓝牙尚未开启!',
+						icon: 'none'
+					})
+				},
+				complete: (complete) => {
+					console.log("complete bListenAdapterStateChange:", state.bListenAdapterStateChange);
+					if (state.bListenAdapterStateChange) return;
+
+					state.bListenAdapterStateChange = true;
+					uni.onBluetoothAdapterStateChange((res) => {
+						console.log('adapterState changed, now is', res)
+						// 手机蓝牙状态
+						state.bOpenBluetooth = res.available;
+						if (state.bOpenBluetooth && !state.bOpenSuccess) {
+							this.commit('initAdapter');
+						}
+					})
+
+				}
+			};
+			this.commit("B_OpenBluetoothAdapter", params);
+		},
+		// todo 未使用到
+		onGetDevices(state, context) {
+			let {
+				success
+			} = context;
+			if (!state.BLEConnectDevice) return;
+			// #ifdef APP-PLUS
+			let deviceId = state.BLEConnectDevice.deviceId;
+			uni.getBLEDeviceRSSI({
+				deviceId,
+				success: res => {
+					let _dis = Math.pow(Math.E, (Math.abs(res.RSSI) - 66.78) / 16.56);
+
+					if (_dis > state.BLEConnectDevice.limitDis) {
+						if (state.cIndex != -1) {
+							uni.showToast({
+								title: '设备断开连接!',
+								icon: 'none',
+								duration: 2000,
+								mask: true
+							})
+						}
+
+						setTimeout(() => {
+							this.commit("B_CloseBLEConnection", {
+								deviceId: deviceId
+							})
+							state.cIndex = -1;
+							state.bConnection = false;
+							state.bVerifiedConnection = false;
+						}, 1000)
+
+					} else {
+						// console.log("DIS~~~~~~~~~", _dis);
+						if (success) {
+							success({
+								RSSI: res.RSSI,
+								DIS: _dis
+							});
+						}
+					}
+				}
+			})
+			// #endif
+
+
+		},
+		//清除连接的开启的timeout
+		onUnloadCreateBLEConnectionTimeout(state) {
+			if (state.getBLEDeviceServicesTimeout) {
+				clearTimeout(state.getBLEDeviceServicesTimeout);
+				state.getBLEDeviceServicesTimeout = null;
+			}
+		},
+
+		initBLEData(state) {
+			// 设备Id
+			state.deviceId = "";
+			// 服务Id
+			state.serviceId = "";
+
+			state.notifyCharacteristicId = "";
+
+			state.writeCharacteristicId = "";
+
+			state.currentInstruction = "";
+
+			state.showToast = false;
+
+			state.bListenerUpdate = false;
+
+			state.bListenerJson = false;
+
+			state.bListenerMac = false;
+
+		},
+		//连接蓝牙
+		onCreateBLEConnection(state, context) {
+			let {
+				index,
+				item,
+				initItem = false,
+				getSuccess = null,
+				getinitAdapter = null
+			} = context;
+
+			let params = {
+				item: item,
+				success: (success) => {
+
+					// 	uni.getBluetoothDevices({
+					// 		success(res) {
+					// 			console.log("getBluetoothDevices:", res)
+					// 		}
+					// 	})
+
+					// 	uni.getConnectedBluetoothDevices({
+					// 		success(res) {
+					// 			console.log("getConnectedBluetoothDevices:", res)
+					// 		}
+					// 	})
+
+
+					state.bConnection = true;
+					if (state.getBLEDeviceServicesTimeout) {
+						clearTimeout(state.getBLEDeviceServicesTimeout);
+						state.getBLEDeviceServicesTimeout = null;
+					}
+
+					state.getBLEDeviceServicesTimeout = setTimeout(() => {
+						let retryCount = 5;
+						this.commit("B_GetBLEDeviceServices", {
+							retryCount: retryCount,
+							item: item,
+							callback: () => {
+								uni.showToast({
+									title: '连接成功',
+									icon: 'loading',
+									duration: 2000,
+									mask: true
+								})
+								//是否需要设置item,默认不设置
+								if (initItem) {
+									state.cIndex = index;
+									state.BLEConnectDevice = item;
+								}
+
+
+								if (getSuccess)
+									getSuccess();
+
+								/**
+								 * 直接连接过成功
+								 */
+								state.bVerifiedConnection = true;
+
+							},
+							getServiceList: (serviceList) => {
+								//搜索服务失败后
+								state.BLEGetServices = serviceList;
+							},
+							getFail: () => {
+								this.commit("B_CloseBLEConnection", {
+									deviceId: item.deviceId
+								})
+								state.cIndex = -1;
+								state.bConnection = false;
+								state.bVerifiedConnection = false;
+							}
+						});
+
+					}, 2000);
+
+				},
+				fail: (fail) => {
+					console.log("***fail:", fail);
+					if (fail.errCode === 10012) {
+						console.log("连接超时,请重试!");
+						uni.showToast({
+							title: '连接失败,设备无响应,请重试。',
+							icon: 'none',
+							duration: 3000,
+							mask: true
+						})
+					} else if (fail.errCode === 10013) {
+						console.log("连接失败,蓝牙地址无效!");
+						uni.showToast({
+							title: '连接失败,蓝牙地址无效',
+							icon: 'none',
+							duration: 2000,
+							mask: true
+						})
+					} else if (fail.errCode === 10000) {
+						// console.log("连接失败,初始化 uni.openBluetoothAdapter 调用之后使用");
+						// uni.showToast({
+						// 	title: '连接失败,检查手机蓝牙是否开启',
+						// 	icon: 'none',
+						// 	duration: 2000,
+						// 	mask: true
+						// })
+
+						this.commit('initAdapter', () => {
+							if (getinitAdapter) {
+								getinitAdapter();
+							}
+						})
+						// this.initAdapter(() => {
+						// 	this.onDevice(item, e);
+						// });
+					} else {
+						// err.errCode10003原因多种:蓝牙设备未开启或异常导致无法连接;蓝牙设备被占用或者上次蓝牙连接未断开导致无法连接
+						console.log("连接失败,请重试!");
+						uni.showToast({
+							title: '设备未开启或被占用异常导致无法连接。',
+							icon: 'none',
+							duration: 2000,
+							mask: true
+						})
+					}
+				}
+			};
+			this.commit("B_CreateBLEConnection", params);
+		},
+		//devices hardware 连接后验证,这里不需要处理 bVerifiedConnection,通过mac 验证后处理
+		onCreateBLESuccess(state, context) {
+			let {
+				item,
+				getSuccess = null
+			} = context;
+			this.commit("B_CreateBLEConnection", {
+				item: item,
+				success: success => {
+					state.BLEConnectDevice = item;
+					state.bConnection = true;
+					if (getSuccess) {
+						getSuccess();
+					}
+				},
+				fail: fail => {
+					if (fail.errCode === 10012) {
+						console.log("连接超时,请重试!");
+						uni.showToast({
+							title: '连接超时,检查对应设备是否开启?',
+							icon: 'none',
+							duration: 2000,
+							mask: true
+						})
+					} else if (fail.errCode === 10013) {
+						console.log("连接失败,蓝牙地址无效!");
+						uni.showToast({
+							title: '蓝牙地址无效,检查设备是否正常?',
+							icon: 'none',
+							duration: 2000,
+							mask: true
+						})
+					} else if (fail.errCode === 10000) {
+						console.log("连接失败,初始化 wx.openBluetoothAdapter 调用之后使用");
+						uni.showToast({
+							title: '连接失败,检查手机蓝牙是否开启?',
+							icon: 'none',
+							duration: 2000,
+							mask: true
+						})
+					} else {
+						console.log("连接失败,请重试!");
+						uni.showModal({
+							title: '连接失败',
+							content: '设备未开启或被占用。请重启app和设备后重新连接。'
+						})
+						// uni.showToast({
+						// 	title: '设备未开启或被占用异常导致无法连接。',
+						// 	icon: 'none',
+						// 	duration: 2000,
+						// 	mask: true
+						// })
+					}
+				}
+			});
+		},
+		//获取蓝牙服务
+		onGetBLEDeviceServices(state, context) {
+			let {
+				item,
+				success = null,
+			} = context;
+			let retryCount = 5;
+			this.commit("B_GetBLEDeviceServices", {
+				retryCount: retryCount,
+				item: item,
+				callback: success,
+				getServiceList: (serviceList) => {
+					state.BLEGetServices = serviceList;
+				},
+				getFail: () => {}
+			})
+		},
+		onCloseBLEConnection(state, context) {
+
+			console.log("onCloseBLEConnection", state.BLEConnectDevice);
+			let {
+				getSuccess = null,
+			} = context;
+
+			if (state.BLERSSIInterval) {
+				clearInterval(state.BLERSSIInterval);
+				state.BLERSSIInterval = null;
+			}
+			this.commit("B_CloseBLEConnection", {
+				deviceId: state.BLEConnectDevice.deviceId,
+				success: () => {
+					state.cIndex = -1;
+					state.BLEConnectDevice = null;
+					//蓝牙服务
+					state.BLEGetServices = null;
+
+					if (getSuccess) {
+						getSuccess();
+					}
+					state.bConnection = false;
+
+					state.bVerifiedConnection = false;
+
+					uni.closeBluetoothAdapter({
+						success(res) {
+							console.log(res)
+							state.bOpenBluetooth = false;
+						}
+					})
+				}
+			});
+
+		},
+		//不关闭 adapter
+		onOnlyCloseBLEConnection(state, context) {
+			let {
+				getSuccess = null
+			} = context;
+
+			if (state.BLERSSIInterval) {
+				clearInterval(state.BLERSSIInterval);
+				state.BLERSSIInterval = null;
+			}
+
+			this.commit("B_CloseBLEConnection", {
+				deviceId: state.BLEConnectDevice.deviceId,
+				success: () => {
+					state.cIndex = -1;
+					state.BLEConnectDevice = null;
+					//蓝牙服务
+					state.BLEGetServices = null;
+					if (getSuccess) {
+						getSuccess();
+					}
+					state.bConnection = false;
+
+					state.bVerifiedConnection = false;
+				}
+			});
+
+		},
+		onWriteBLEConnectionValue(state, context) {
+			let {
+				getSuccess = null,
+					getFail = null,
+					value
+			} = context;
+
+			if (!state.BLEConnectDevice && state.cIndex == -1) {
+				uni.showToast({
+					title: '蓝牙设备未连接',
+					icon: 'none'
+				})
+			}
+			// console.log(22);
+			//记录蓝牙盒子当前的指令
+			state.currentInstruction = value;
+			// 发送 3 :开启原始数据
+			// 发送4 :关闭原始数据
+			// 发送 5 :开启步数
+			// 发送6 :关闭步数
+			if (value == "3") {
+				state.instructionState.bOpen = true;
+			} else if (value == "4") {
+				state.instructionState.bOpen = false;
+			} else if (value == "5") {
+				state.instructionState.bSteps = true;
+			} else if (value == "6") {
+				state.instructionState.bSteps = false;
+			}
+			let retryCount = 5;
+			this.commit("B_WriteBLECharacteristicValue", {
+				value,
+				retryCount,
+				getSuccess,
+				getFail
+			});
+		},
+		//获取距离
+		onGetRSSITransDistance(state, context) {
+			let {
+				RSSI
+			} = context;
+			BLE.getRSSITransDistance(RSSI);
+		},
+
+
+		//添加使用的前端信息
+		gOnAddClientInfo(state, context) {
+
+			uni.getSystemInfo({
+				success: (res) => {
+					// console.log("系统信息:", res);
+					let clientInfo = res;
+
+					clientInfo.clientSystem = res.system;
+
+					reqUtil.requestData(config.URL.ADDCLIENTINFO, clientInfo, 'POST').then(
+						res => {
+							console.warn(res);
+						},
+						e => {}
+					);
+				},
+				fail: (err) => {},
+				complete: () => {}
+			})
+
+
+		},
+
+		//创建快速打击对象
+		gCreateFilterObj(state) {
+			state.filter = null;
+			state.deviceMs = 1;
+			state.filter = new o0Project.Filter();
+			console.log("gCreateFilterObj");
+		},
+		//更新快速打击对象数据
+		gUpdateFilter(state, context) {
+
+			let {
+				data,
+				callback
+			} = context;
+
+			let {
+				min,
+				s,
+				ms
+			} = data;
+			var msGap = ms - state.deviceMs;
+			state.deviceMs = ms;
+			while (msGap < 0) {
+				msGap += 1000;
+			}
+			// console.log(data);
+			let {
+				ax,
+				ay,
+				az
+			} = data.acc;
+
+			state.filter.Update(new o0.Vector3(ax, ay, az), msGap, callback); //我自己的更新acc的函数
+		},
+		/**
+		 * 限制开始游戏
+		 */
+		glimitPlayGame(state, context) {
+			let {
+				gameTags,
+				callback
+			} = context;
+
+			//没有标签直接进去
+			if (gameTags.length == 0) {
+				callback();
+				return;
+			}
+
+			let canPlay = false;
+			gameTags.forEach((item) => {
+				//如果存在普通模式
+				if (item.tagMode === 'normal') {
+					canPlay = true;
+				}
+				if (canPlay)
+					return;
+			})
+
+			if (!canPlay) {
+				//2.如果普通模式不存在,就判断是否连接硬件了
+				if (!state.BLEConnectDevice || state.cIndex == -1) {
+					uni.showToast({
+						title: "请连接标签对应的设备模式!",
+						icon: "none",
+						duration: 2000,
+						mask: true
+					})
+					return;
+				}
+				//3.如果连接了设备,判断但是处于什么模式
+				gameTags.forEach((item, index, selfArr) => {
+					//如果存在普通模式
+					if (item.tagMode === state.BLEConnectDevice.usageMode) {
+						canPlay = true;
+					}
+					if (canPlay)
+						return;
+					if (index == selfArr.length - 1) {
+						uni.showToast({
+							title: "游戏没有当前设备模式!",
+							icon: "none",
+							duration: 2000,
+							mask: true
+						})
+					}
+				})
+			}
+
+			if (canPlay) {
+				callback();
+			}
+		},
+
+		checkAppUpdata(state) {
+			//#ifdef APP-PLUS
+			let _temp = {
+				appid: plus.runtime.appid,
+				version: state.version,
+				versionCode: state.versionCode,
+				platform: state.platform.toLocaleLowerCase(),
+			}
+			//#endif
+			//#ifdef H5
+			//此 _temp 测试用
+			let _temp = {
+				appid: '1',
+				version: "2.0.0",
+				versionCode: "20122202",
+				platform: "android",
+			}
+			//#endif
+			reqUtil.requestData(config.URL.APPVERSIONUPDATE, _temp).then(res => {
+					console.log('requestData APPVERSIONUPDATE =====', res);
+					let _data = res.data;
+					if (res.code == 0 && res.data.status === 1) {
+						uni.showModal({ //提醒用户更新  
+							title: "更新提示",
+							content: res.data.note,
+							success: (res) => {
+								if (res.confirm) {
+									if (state.platform.toLocaleLowerCase() == "android") {
+										plus.runtime.openURL(_data.url, function(res) {
+											plus.nativeUI.alert("本机没安装应用宝,请安装后获取新版本。");
+										}, 'com.tencent.android.qqdownloader');
+
+									} else {
+										//ios
+										plus.runtime.openURL(_data.url);
+									}
+								}
+							}
+						})
+
+					} else {
+						uni.showToast({
+							title: '当前为最新版本',
+							icon: 'none',
+							duration: 2000,
+							mask: true
+						})
+					}
+				},
+				e => {
+					console.log(e)
+				});
+
+		},
+
+
+		/**
+		 * 蓝牙BLE迁移到store.js
+		 */
+		// 初始化蓝牙模块适配器
+		B_OpenBluetoothAdapter(state, context) {
+			let {
+				success,
+				fail,
+				complete
+			} = context;
+			//#ifdef H5
+			console.warn('h5不加载蓝牙模块');
+			return;
+			//#endif
+			uni.openBluetoothAdapter({
+				success: res => {
+					if (success)
+						success(res);
+				},
+				fail: res => {
+					if (fail)
+						fail(res);
+				},
+				complete: res => {
+					if (complete)
+						complete(res);
+				}
+			})
+		},
+
+		/**
+		 * 关闭蓝牙模块适配器
+		 */
+		B_CloseBluetoothAdapter() {
+			//#ifdef H5
+			console.warn('h5不加载蓝牙模块');
+			return;
+			//#endif
+			uni.closeBluetoothAdapter({
+				success: res => {
+					console.log('断开蓝牙模块成功');
+					uni.showToast({
+						icon: "none",
+						title: "蓝牙已经断开!",
+						mask: false,
+						duration: 3000
+					});
+				}
+			});
+		},
+
+		B_OnBLEConnectionStateChange(state) {
+			//#ifdef H5
+			console.warn('h5不加载蓝牙模块');
+			return;
+			//#endif
+			uni.onBLEConnectionStateChange(res => {
+				// 该方法回调中可以用于处理连接意外断开等异常情况
+				console.log(`蓝牙连接状态 -------------------------->`, JSON.stringify(res));
+				if (!res.connected) {
+					uni.$emit('callbackCloseBLE');
+				}
+			});
+		},
+		/**
+		 * 连接低功耗蓝牙设备。
+		 * 若APP在之前已有搜索过某个蓝牙设备,并成功建立连接,可直接传入之前搜索获取的 deviceId 直接尝试连接该设备,无需进行搜索操作。
+		 */
+		B_CreateBLEConnection(state, context) {
+			let {
+				item,
+				success,
+				fail
+			} = context;
+			this.commit('initBLEData');
+			state.deviceId = item.deviceId;
+			let timeout = 10000;
+			console.log("B_CreateBLEConnection deviceId ==", state.deviceId)
+			uni.createBLEConnection({
+				// 这里的 deviceId 需要已经通过 createBLEConnection 与对应设备建立链接
+				deviceId: state.deviceId,
+				timeout: timeout,
+				success: res => {
+					if (success) {
+						success(res);
+					}
+				},
+				fail: res => {
+					if (fail)
+						fail(res);
+				}
+			});
+		},
+
+
+		/**
+		 * 获取设备的服务ID
+		 */
+		B_GetBLEDeviceServices(state, context) {
+
+			let {
+				retryCount,
+				item,
+				callback,
+				getServiceList,
+				getFail,
+			} = context;
+			let serviceList = [];
+			let _self = this;
+			uni.getBLEDeviceServices({
+				deviceId: item.deviceId,
+				success: res => {
+					console.log("getBLEDeviceServices==", JSON.stringify(res), item);
+					serviceList = res.services;
+					if (getServiceList) {
+						getServiceList(serviceList);
+					}
+					if (serviceList.length == 0) {
+						if (retryCount > 0) {
+							retryCount--;
+							context.retryCount = retryCount;
+							setTimeout(() => {
+								this.commit('B_GetBLEDeviceServices', context);
+							}, 500)
+							return;
+						}
+						if (getFail) {
+							getFail();
+						}
+						uni.hideToast();
+						uni.showModal({
+							title: '提示',
+							content: '1.获取服务失败,请尝试重新连接设备。\r\n2.尝试重启设备再重新连接。'
+						})
+
+					}
+					for (let i = 0; i < serviceList.length; i++) {
+						let service = serviceList[i];
+						if (service.uuid.toLocaleLowerCase() === item.PRIMARY_SERVICE.toLocaleLowerCase()) {
+							state.serviceId = service.uuid;
+							//开始获取指定服务的特征值
+							_self.commit('B_GetBLEDeviceCharacteristics', {
+								item: item,
+								callback: callback
+							});
+							break;
+						}
+					}
+				},
+				fail: failRes => {
+					console.log('device services:', failRes.services)
+					uni.showModal({
+						title: '连接失败',
+						content: '未获取到相应服务,请继续尝试连接设备。'
+					})
+				}
+			});
+		},
+		/**
+		 * 获取指定服务的特征值
+		 */
+		B_GetBLEDeviceCharacteristics(state, context) {
+			let {
+				item,
+				callback
+			} = context;
+			let deviceId = state.deviceId;
+			let serviceId = state.serviceId;
+			let characteristicsList = [];
+			uni.getBLEDeviceCharacteristics({
+				deviceId,
+				serviceId,
+				success: res => {
+					if (item.PRIMARY_NOTIFY != '') {
+						state.notifyCharacteristicId = item.PRIMARY_NOTIFY;
+						this.commit('B_NotifyBLECharacteristicValueChange', {
+							callback: callback
+						});
+					}
+					if (item.PRIMARY_WRITE != '') {
+						state.writeCharacteristicId = item.PRIMARY_WRITE;
+					}
+				},
+				fail: res => {
+					console.log('device getBLEDeviceCharacteristics failed:', JSON.stringify(res))
+				}
+			})
+		},
+
+		//启用低功耗蓝牙设备特征值变化时的 notify 功能,订阅特征值。
+		//注意:必须设备的特征值支持notify或者indicate才可以成功调用,具体参照 characteristic 的 properties 属性
+		B_NotifyBLECharacteristicValueChange(state, context) {
+			let {
+				callback
+			} = context;
+			// 启用notify功能
+			// console.log("启用notify功能");
+			uni.notifyBLECharacteristicValueChange({
+				state: true,
+				deviceId: state.deviceId,
+				serviceId: state.serviceId,
+				characteristicId: state.notifyCharacteristicId,
+				success: (res) => {
+					this.commit('B_OnBLECharacteristicValueChange', {
+						callback: callback
+					});
+					// _self.onBLECharacteristicValueChange(callback); //监听特征值变化
+				},
+				fail: (res) => {
+					uni.showToast({
+						title: 'notify启动失败',
+						icon: "none",
+						mask: true
+					});
+
+				}
+			})
+		},
+		//监听低功耗蓝牙设备的特征值变化。必须先启用notify接口才能接收到设备推送的notification。
+		B_OnBLECharacteristicValueChange(state, context) {
+			let {
+				callback
+			} = context;
+			console.log("onBLECharacteristicValueChange success");
+			if (callback) {
+				callback({
+					notifyCharacteristicId: state.notifyCharacteristicId,
+					writeCharacteristicId: state.writeCharacteristicId
+				})
+			}
+			uni.onBLECharacteristicValueChange(function(res) {
+				let box = {};
+				var resValue = BLE.ab2hext(res.value); //16进制字符串
+				if (state.currentInstruction == "V" && state.showToast) {
+					var resValueStr = BLE.hexToString(resValue);
+					let _info = {
+						type: 'version',
+						instruction: 'V',
+						value: resValueStr.replace(/\{|}/g, '').trim()
+					}
+					uni.$emit('listenerBLE', _info);
+					state.currentInstruction = "";
+					state.showToast = false;
+					return;
+				} else if (state.currentInstruction == 'M' && state.bListenerMac) {
+					var resValueStr = BLE.hexToString(resValue);
+					let _info = {
+						type: 'mac',
+						instruction: 'M',
+						value: resValueStr.replace(/\{|}/g, '').trim()
+					}
+					uni.$emit('listenerBLE', _info);
+					state.currentInstruction = "";
+					state.bListenerMac = false;
+					return;
+				}
+				//步数数据解析
+				if (state.bListenerJson) {
+					var resValueStr = BLE.hexToString(resValue);
+					console.log(resValueStr);
+					box["Json"] = resValueStr;
+					uni.$emit('updateBLEDeviceJson', box);
+				}
+				//原始数据解析
+				if (state.bListenerUpdate) {
+					//R/L 左手还是右手
+					let handle = resValue.substr(6, 2);
+					let axStr = resValue.substr(8, 4);
+					let ayStr = resValue.substr(12, 4);
+					let azStr = resValue.substr(16, 4);
+					//一个字节最大只能表示265  2个字节可以表示65536  然后你这边做一下转换 例如00 3E   3*16+14=62 ----->0.03  g 
+					//(真实值= AD值 /32768  * 16)
+					//0.003 = 62 / 2768  * 16
+					let ax = BLE.hexToSignedInt(axStr) / 32768 * 16;
+					let ay = BLE.hexToSignedInt(ayStr) / 32768 * 16;
+					let az = BLE.hexToSignedInt(azStr) / 32768 * 16;
+
+					let gxStr = resValue.substr(20, 4);
+					let gyStr = resValue.substr(24, 4);
+					let gzStr = resValue.substr(28, 4);
+					//角速度(AD值/32768 * 2000) 角速度单位是 °/s  范围是 正负2000
+					let gx = BLE.hexToSignedInt(gxStr) / 32768 * 2000;
+					let gy = BLE.hexToSignedInt(gyStr) / 32768 * 2000;
+					let gz = BLE.hexToSignedInt(gzStr) / 32768 * 2000;
+					//毫秒
+					let ms = BLE.hex2int(resValue.substr(2, 4));
+					//分
+					let min = BLE.hex2int(resValue.substr(32, 2));
+					//秒
+					let s = BLE.hex2int(resValue.substr(34, 2));
+					box["handle"] = BLE.hexToString(handle);
+					box["acc"] = {
+						ax,
+						ay,
+						az
+					};
+					box["gyro"] = {
+						gx,
+						gy,
+						gz
+					};
+
+					box["min"] = min;
+					box["s"] = s;
+					box["ms"] = ms;
+
+					//更新数据给webview,在game-play-web||game-play-sub绑定
+					//后面更新数据都用此接口
+					uni.$emit('updateBLEDeviceData', box);
+				}
+
+
+			});
+		},
+
+
+		//向低功耗蓝牙设备特征值中写入二进制数据。注意:必须设备的特征值支持 write 才可以成功调用。
+		B_WriteBLECharacteristicValue(state, context) {
+			let {
+				value,
+				retryCount,
+				success,
+				getFail
+			} = context;
+			if (!value && value === '') {
+				uni.showToast({
+					title: "指令为空"
+				})
+				return;
+			}
+			//记录一下指令
+			state.currentInstruction = value;
+			//V 获取版本,M 获取mac 地址
+			if (value == "V")
+				state.showToast = true;
+
+			if (value == "M") {
+				state.showToast = true;
+				state.bListenerMac = true;
+			}
+			if (value == "4") {
+				state.bListenerUpdate = false;
+			}
+			if (value == "3") {
+				if (state.bListenerUpdate) {
+					uni.showToast({
+						title: "原始数据已开启"
+					})
+					return;
+				}
+				state.bListenerUpdate = true;
+			}
+
+			if (value == "6") {
+				state.bListenerJson = false;
+			}
+			if (value == "5") {
+				if (state.bListenerJson) {
+					uni.showToast({
+						title: "步数数据已开启"
+					})
+					return;
+				}
+				state.bListenerJson = true;
+			}
+
+
+			console.log("currentInstruction:", state.currentInstruction, value, state.bListenerUpdate, state.bListenerMac);
+			console.log("state.deviceId:", state.deviceId, state.serviceId, state.writeCharacteristicId);
+			uni.writeBLECharacteristicValue({
+				deviceId: state.deviceId,
+				serviceId: state.serviceId,
+				// 这里的 characteristicId 需要在 getBLEDeviceCharacteristics 接口中获取
+				characteristicId: state.writeCharacteristicId,
+				// 这里的value是ArrayBuffer类型
+				value: BLE.str2ab(value),
+				success: (res) => {
+					console.log('writeBLECharacteristicValue success', res.errMsg, value, retryCount);
+					if (success) {
+						success(res);
+					}
+				},
+				fail: (fail) => {
+					console.log(fail)
+					//重新写入
+					if (retryCount > 0) {
+						console.log("writeBLECharacteristicValue Rewrite ===================>" + value + " == " + retryCount);
+						retryCount--;
+						setTimeout(() => {
+							this.commit("B_WriteBLECharacteristicValue", {
+								value,
+								retryCount,
+								success,
+								getFail
+							});
+						}, 300);
+					}
+					if (getFail) {
+						getFail(fail);
+					}
+				}
+			})
+
+		},
+
+		/**
+		 * 断开蓝牙连接
+		 */
+		B_CloseBLEConnection(state, context) {
+			let {
+				deviceId,
+				success = null
+			} = context;
+			uni.closeBLEConnection({
+				deviceId,
+				success: res => {
+					if (success)
+						success();
+				},
+				fail: (fail) => {
+					console.log("关闭蓝牙失败", fail);
+				}
+			});
+		},
+
+
+		//获取手机中蓝牙已匹配的设备
+		B_GetBondedDevices(state, context) {
+			// console.log("getBondedDevices ====>");
+			// 	uni.getBluetoothDevices({
+			// 		success(res) {
+			// 			console.log("getBluetoothDevices:", res)
+			// 		}
+			// 	})
+
+			// 	uni.getConnectedBluetoothDevices({
+			// 		success(res) {
+			// 			console.log("getConnectedBluetoothDevices:", res)
+			// 		}
+			// 	})
+			let {
+				success = null
+			} = context;
+			//Android
+			function android_bluetooth_list(deviceName) {
+				var main = plus.android.runtimeMainActivity();
+				var BluetoothAdapter = plus.android.importClass("android.bluetooth.BluetoothAdapter");
+				var BAdapter = BluetoothAdapter.getDefaultAdapter();
+				var Context = plus.android.importClass("android.content.Context");
+				var lists = BAdapter.getBondedDevices();
+				plus.android.importClass(lists);
+				var len = lists.size();
+				// console.log("getBondedDevices.len=" + len);
+				if (len == 0) {
+					//如果没有配对的设备
+					return null;
+				} else {
+					var iterator = lists.iterator();
+					plus.android.importClass(iterator);
+					while (iterator.hasNext()) {
+						var d = iterator.next();
+						plus.android.importClass(d);
+						let temp = null;
+						//
+						if (d.getName().indexOf(deviceName) > -1) {
+							// console.log(d.getName());
+							// console.log(d.getAddress());
+							// Classic	1	
+							// Dual	3	
+							// Le	2	
+							// Unknown	0
+							// console.log(d.getType());
+							// Bonded	12
+							// Bonding	11	Indicates bonding (pairing) is in progress with the remote device.
+							// None	10
+							// console.log(d.getBondState());
+							let typeEnum = {
+								0: 'Unknown',
+								1: 'Classic',
+								2: 'Le',
+								3: 'Dual'
+							};
+							let bondStateEnum = {
+								10: 'None',
+								11: 'Bonding',
+								12: 'Bonded'
+							};
+							temp = {
+								name: d.getName(),
+								address: d.getAddress(),
+								type: {
+									'value': d.getType(),
+									'name': typeEnum[d.getType()]
+								},
+								bondState: {
+									'value': d.getBondState(),
+									'name': bondStateEnum[d.getBondState()]
+								}
+							}
+
+						}
+						return temp;
+					}
+				}
+
+
+			}
+
+
+			function searchIOS() {
+				var CBCentralManager = plus.ios.import("CBCentralManager");
+				var manager = new CBCentralManager();
+				var delegate = plus.ios.implements("CBCentralManagerDelegate", {
+					"centralManagerDidUpdateState:": centralManagerDidUpdateState,
+					"centralManager:didDiscoverPeripheral:advertisementData:RSSI:": didDiscoverPeripheral
+				});
+				if (plus.device.model == "iPad" || plus.device.model == "iPod") {
+					manager.initWithDelegatequeue(delegate, null);
+				} else {
+					manager.initWithDelegatequeue(delegate, null, null);
+					let arr = manager.retrieveConnectedPeripheralsWithServices();
+					console.error(arr.length);
+				}
+			}
+
+			function centralManagerDidUpdateState(central) {
+				console.log(central);
+				var state = central.plusGetAttribute('state');
+				console.log(state);
+				if (state == 4) {
+					writelog('请开启蓝牙');
+				}
+				if (state == 5) {
+					console.log("中央外设管理器状态 state= " + state);
+					central.scanForPeripheralsWithServicesoptions(null, null);
+				}
+				//writelog("中央外设管理器状态 state= " + state);  
+			}
+
+			function didDiscoverPeripheral(central, peripheral, advertisementData, RSSI) {
+				var name = peripheral.plusGetAttribute("name");
+				var uuid = peripheral.plusGetAttribute("identifier").plusGetAttribute("UUIDString");
+				var rssi = RSSI.plusGetAttribute("intValue");
+				var dist = calcDistByRSSI(rssi, 74, 2);
+				writelog("蓝牙设备:" + name + " " + uuid + " " + rssi + " " + dist + "米");
+
+			}
+
+			function writelog(msg) {
+				console.log(msg);
+			}
+
+			function calcDistByRSSI(rssi, a, n) {
+				var rs = Math.abs(rssi);
+				var power = (rs - a) / (10 * n);
+				return Math.pow(10, parseFloat(power)).toFixed(2);
+			}
+
+			function ios_bluetooth_list(deviceName) {
+				// let CBCentralManager= plus.ios.importClass("CBCentralManager");
+				// let _centralManager =  new CBCentralManager();
+				// _centralManager.initWithDelegatequeue(plus.ios.currentWebview(),null);
+				// let arr = _centralManager.retrieveConnectedPeripheralsWithServices();
+				// console.error(arr.length);
+				// searchIOS();
+				return null;
+			}
+
+
+
+			let device = null;
+
+			switch (plus.os.name) {
+				case "Android":
+					// Android平台: plus.android.*  
+					device = android_bluetooth_list("BGBox");
+					console.log("android getBondedDevices 匹配的对象======>", device)
+					if (device != null) {
+						state.bPhoneMatched = true;
+					} else {
+						state.bPhoneMatched = false;
+					}
+
+					break;
+				case "iOS":
+					// iOS平台: plus.ios.*  
+					device = ios_bluetooth_list("BGBox");
+					console.log("ios getBondedDevices 匹配的对象======>", device)
+					if (device != null) {
+						state.bPhoneMatched = true;
+					} else {
+						state.bPhoneMatched = false;
+					}
+					break;
+				default:
+					// 其它平台  
+					break;
+			}
+			if (success) {
+				success(device);
+			}
+		},
+
+		B_OpenBLESetting() {
+			function android_bluetooth_setting() {
+				var main = plus.android.runtimeMainActivity(); //获取activity  
+				var Intent = plus.android.importClass('android.content.Intent');
+				var Settings = plus.android.importClass('android.provider.Settings');
+				var intent = new Intent(Settings.ACTION_BLUETOOTH_SETTINGS); //可设置表中所有Action字段  
+				main.startActivity(intent);
+			}
+
+			function ios_bluetooth_setting() {
+				// var UIApplication = plus.ios.import("UIApplication");  
+				// var application2 = UIApplication.sharedApplication();  
+				// var NSURL2 = plus.ios.import("NSURL");  
+				// var setting2 = NSURL2.URLWithString("app-settings:");  
+				// application2.openURL(setting2);  
+
+				// plus.ios.deleteObject(setting2);  
+				// plus.ios.deleteObject(NSURL2);  
+				// plus.ios.deleteObject(application2);
+				// plus.runtime.openURL({
+				// 	action: 'App-Prefs:root=Bluetooth'
+				// }, function(e) {
+				// 	console.log(JSON.stringify(e));
+				// });
+				
+				plus.runtime.launchApplication({action:'App-Prefs:root=Bluetooth'}, function(e){
+				console.log(JSON.stringify(e));
+				});
+			}
+
+			let device = null;
+
+			switch (plus.os.name) {
+				case "Android":
+					// Android平台: plus.android.*  
+					android_bluetooth_setting();
+					break;
+				case "iOS":
+					// iOS平台: plus.ios.*  
+					ios_bluetooth_setting();
+					break;
+				default:
+					// 其它平台  
+					break;
+			}
+
+		}
+	}
+})
+
 export default store