Эх сурвалжийг харах

修改首页子窗体,调整到store里面。添加一个测试websocket。修复其他相关bug

slambb 4 жил өмнө
parent
commit
fd64b55da0

+ 4 - 1
App.vue

@@ -6,7 +6,7 @@
 	export default {
 
 		methods: {
-			...mapMutations(['onLuanchLogin', 'getBLEDeviceList', 'getFinalUseDevice']),
+			...mapMutations(['onLuanchLogin', 'getBLEDeviceList', 'getFinalUseDevice','onAccAndGyroConvertDataGet']),
 
 		},
 		onLaunch: function() {
@@ -53,6 +53,9 @@
 			//开始登陆
 			this.onLuanchLogin({});
 			// #endif
+			
+			
+			this.onAccAndGyroConvertDataGet();
 		},
 		onShow: function() {
 			console.log('App Show');

+ 7 - 3
common/config.js

@@ -9,9 +9,9 @@ const active = "dev";
 //线上地址,腾讯云服务器
 // 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.1.12:9090/api_dev"
+const host = "http://192.168.1.15:9090/api_dev"
 // const host = "http://192.168.0.112:9090/api_dev"
 // const host = "http://47.104.216.192:9090/api_dev"
 // const host = "http://121.4.103.151:9090/api_prd"
@@ -152,7 +152,11 @@ const URL = {
 	GETLEVELJUMPLIST: `${host}/level/getLevelJumpList`,//只获取levelJump列表,后续其他扩展新加
 	PASSTHELEVEL: `${host}/level/passTheLevel`,//通用处理过关操作
 	UNLOCKLEVEL: `${host}/level/unlockLevel`,//通用处理解锁关卡操作
-
+	
+	/**
+	 * 奖励,荣誉,金币,钻石等
+	 */
+	GETALLHONORS: `${host}/reward/getAllHonorList`,//获取全部荣誉
 
 	/**
 	 * fc 游戏接口

+ 14 - 12
components/modal/action-jump/action-jump.vue

@@ -76,11 +76,11 @@
 		<!-- <view style="height: 41px;"></view> -->
 
 		<!-- 测试按钮 -->
-		<view style="display: flex;justify-content: space-between;">
+	<!-- 	<view style="display: flex;justify-content: space-between;">
 			<view>{{isY?'Y':'X'}}</view>
 			<button @click="onChangeY">Y为旋转轴</button>
 			<button @click="onChangeX">X为旋转轴</button>
-		</view>
+		</view> -->
 
 		<view style="display: flex;justify-content: space-between;" class="margin-top margin-bottom">
 			<button @click="onJumpType(0)">jump</button>
@@ -273,7 +273,7 @@
 			this.onListenActionJump();
 		},
 		methods: {
-			...mapMutations(['onWriteBLEConnectionValue']),
+			...mapMutations(['onWriteBLEConnectionValue','onConvertDeviceData']),
 			onListenActionJump() {
 				let _self = this;
 				_self.actionJumpObj = new ActionJump();
@@ -841,7 +841,7 @@
 					currentMaxValue,
 					oGyroValue
 				} = data
-				// console.log(data);
+				console.log('stateDataOfJump:',JSON.stringify(data));
 				if (currentMaxValue == 0) {
 					//JumpType.NORMAL = 0
 					if (_jumpType == 0) {
@@ -862,10 +862,12 @@
 					}
 
 				} else {
-					console.log('2====', data);
-					if (currentMaxValue > 5) {
+					// console.log('2====', data);
+					if (currentMaxValue < -5) {
+						//left jump
 						_tempState[1].bTrigger = true;
-					} else if (currentMaxValue < -5) {
+					} else if (currentMaxValue > 5 ) {
+						//right jump
 						_tempState[2].bTrigger = true;
 					}
 
@@ -896,7 +898,7 @@
 				//如果消除完,需要重新生成
 				let _temp = this.spawnArray[this.index];
 				let bSuccess = false;
-				console.log(_tempState);
+				console.log(JSON.stringify(_tempState));
 				for (let i = 0; i < _tempState.length; i++) {
 					let _state = _tempState[i];
 					//如果当前的跳类型和预制目标一样
@@ -908,7 +910,7 @@
 				}
 				//如果存在其中一个为true
 				if (bSuccess) {
-					console.log("bSuccess:", bSuccess);
+					// console.log("bSuccess:", bSuccess);
 					_temp.bTrigger = true;
 					this.index++;
 					if (this.index >= this.spawnArray.length) {
@@ -947,8 +949,8 @@
 					s,
 					ms
 				} = gameData;
-
-				let _ax = -gameData.acc.ax * 10;
+				//-gameData.acc.ax * 10;
+				let _ax = gameData.acc.ax * 10;
 				let _ay = gameData.acc.ay * 10;
 				let _az = gameData.acc.az * 10;
 				//低通滤波分离重力
@@ -989,7 +991,7 @@
 						oGyroZ: gz
 					},
 					//输入当前轴
-					bYAxis: this.isY,
+					bYAxis: true,
 				};
 				this.actionJumpObj.updateJump(_temp);
 

+ 3 - 0
main.js

@@ -2,12 +2,15 @@ import Vue from 'vue'
 import App from './App'
 
 import store from './util/util-js/store.js'
+import testWebSocket from './util/util-js/webSocket.js'
 
 
 Vue.config.productionTip = false
 
 Vue.prototype.$store = store
 
+Vue.prototype.$testWS = testWebSocket;
+
 
 App.mpType = 'app'
 

+ 12 - 41
pages.json

@@ -266,6 +266,13 @@
 					"popGesture": "none"
 				}
 			}
+		}, {
+			"path": "pages/personal-page/directionOfDetection/directionOfDetection",
+			"style": {
+				"navigationBarTitleText": "",
+				"enablePullDownRefresh": false
+			}
+
 		}
 	],
 	"subPackages": [{
@@ -300,46 +307,7 @@
 				}
 			}
 			// #endif
-		]
-	}, {
-		"root": "pages/game-page",
-		"pages": [
-			// #ifdef APP-PLUS
-			{
-				"path": "game-list/game-list",
-				"style": {
-					// "navigationBarTitleText": "原生子窗体",
-					"titleNView": false,
-					"app-plus": {
-						"subNVues": [{
-							"id": "game-list-drawer",
-							"path": "../../platform/app-plus/subNVue/drawer",
-							"type": "popup",
-							"style": {
-								"width": "89%"
-							}
-						}]
-					}
-				}
-			},
-			{
-				"path": "game-video/game-video",
-				"style": {
-					// "navigationBarTitleText": "原生子窗体",
-					"titleNView": false,
-					"app-plus": {
-						"subNVues": [{
-							"id": "game-video-drawer",
-							"path": "../../platform/app-plus/subNVue/drawer",
-							"type": "popup",
-							"style": {
-								"width": "89%"
-							}
-						}]
-					}
-				}
-			}
-			// #endif
+
 		]
 	}],
 	"globalStyle": {
@@ -347,7 +315,10 @@
 		"navigationBarTitleText": "uni-app",
 		"navigationBarBackgroundColor": "#FFFFFF",
 		"backgroundColor": "#F8F8F8",
-		"navigationStyle": "custom"
+		"navigationStyle": "custom",
+		"app-plus":{
+			"bounce":"none"
+		}
 	},
 	"condition": { //模式配置,仅开发期间生效
 		"current": 0, //当前激活的模式(list 的索引项)

+ 4 - 3
pages/game-page/game-list/game-list.vue

@@ -143,10 +143,10 @@
 		onReady() {
 			let phoneHeight = this.systemInfo.windowHeight;
 			// 计算组件的高度
-			this.scrollviewHight = phoneHeight - this.navHeight - this.tabbarHeight;
+			this.scrollviewHight = phoneHeight - this.navHeight - this.tabbarHeight - this.systemInfo.statusBarHeight;
 		},
 		methods: {
-			...mapMutations(['glimitPlayGame']),
+			...mapMutations(['glimitPlayGame','showDrawerById']),
 			// 跳转转换页面
 			onNavConver() {
 				uni.reLaunch({
@@ -390,7 +390,8 @@
 				this.getGameList(this.categoryType);
 			},
 			showDrawer() {
-				uni.getSubNVueById('game-list-drawer').show('slide-in-left', 200);
+				// uni.getSubNVueById('game-list-drawer').show('slide-in-left', 200); {id:'game-list-drawer'}
+				this.showDrawerById();
 			}
 		}
 	};

+ 1 - 1
pages/game-page/game-play-sub/subGame/subGame.nvue

@@ -2,7 +2,7 @@
 	<view class="web-view">
 		<!-- :src="url" src = 'http://192.168.0.112:7456/build/index.html' :src="LocationGameUrl" -->
 		<!-- @receivedtitle="onReceivedTitle"   @pagefinish="onPageFinish"-->
-		<web-view class="web-view-child" src = 'http://192.168.1.14:7456/build/index.html' ref="webview" @pagestart="onPageStart" @onPostMessage="handlePostMessage"
+		<web-view class="web-view-child" :src="url" ref="webview" @pagestart="onPageStart" @onPostMessage="handlePostMessage"
 		 @error="onError"></web-view>
 		<view class="web-back" @click="navBack">
 			<image style="width: 40rpx;height: 40rpx;" src="/static/gameCloseW.png"></image>

+ 4 - 3
pages/game-page/game-video/game-video.vue

@@ -137,10 +137,10 @@
 		onReady() {
 			let phoneHeight = this.systemInfo.windowHeight;
 			// 计算组件的高度
-			this.scrollviewHight = phoneHeight - this.navHeight - this.tabbarHeight;
+			this.scrollviewHight = phoneHeight - this.navHeight - this.tabbarHeight - this.systemInfo.statusBarHeight;
 		},
 		methods: {
-			...mapMutations(['glimitPlayGame']),
+			...mapMutations(['glimitPlayGame','showDrawerById']),
 			// 跳转转换页面
 			onNavConver() {
 				uni.reLaunch({
@@ -382,7 +382,8 @@
 				this.getGameList(this.categoryType);
 			},
 			showDrawer() {
-				uni.getSubNVueById('game-video-drawer').show('slide-in-left', 200);
+				// uni.getSubNVueById('game-video-drawer').show('slide-in-left', 200); {id:'personal-drawer'}
+				this.showDrawerById();
 			}
 		}
 	};

+ 22 - 4
pages/my-page/achievement/achievement.vue

@@ -12,9 +12,9 @@
 		
 		<view class="cu-form-group">
 			<view  class="grid col-4 flex-sub" >
-				<view class="flex flex-direction align-center padding" v-for="(item,index) in 10" :key="index">
-					<image style="width: 110rpx;height:110rpx;"  src="../../../static/achievement/11-01@2x.png"></image>
-					<text>成就名称</text>
+				<view class="flex flex-direction align-center padding" v-for="(item,index) in lists" :key="index">
+					<image style="width: 110rpx;height:110rpx;"  :src="item.url"></image>
+					<text>{{item.name}}</text>
 				</view>
 			</view>
 		</view>
@@ -22,12 +22,30 @@
 </template>
 
 <script>
+	import reqUtil from '@/util/util-js/requstUtil.js';
+	import config from '@/common/config.js';
+	
 	export default {
 		data() {
 			return {
-				
+				lists:[],
 			}
 		},
+		onLoad() {
+			reqUtil
+				.requestData(config.URL.GETALLHONORS, {})
+				.then(
+					res => {
+						if (res.code == 0) {
+							console.log(JSON.stringify(res.data));
+							this.lists = res.data;
+						}
+					},
+					e => {
+						console.log(e);
+					}
+				);
+		},
 		methods: {
 			onBack(){
 				uni.navigateBack({

+ 5 - 5
pages/my-page/homepage/homepage.vue

@@ -34,7 +34,7 @@
 		</view> -->
 		<image class="bg-image" src="../../../static/loginBg.png" mode="aspectFill"></image>
 		
-		<scroll-view  style="border: 1rpx solid #000000;" :style="{ height: scrollviewHight + 'px' }" scroll-y="true">
+		<scroll-view  :style="{ height: scrollviewHight + 'px' }" scroll-y="true">
 			<view class="card-view flex align-center " style="position: relative; margin-top: 113px;">
 				<view class="avatar-size">
 					<image class="avatar-img round" :src="avatarUrl"></image>
@@ -43,8 +43,8 @@
 					<view class="text-lg flex justify-between align-center justify-center">
 						<text class="text-black text-bold">{{userName}}</text>
 						<view style="width: 126rpx;height: 50rpx; position: relative;" class="flex align-center justify-center" >
-							<image style="height: 100%; width: 100%;" src="/static/bg-days.png"></image>
-							<text class="text-white text-13px text-center" style="line-height: 50rpx; position: absolute;top: 0;right: 10rpx;">{{days}}天</text>
+							<image style="height: 50rpx; width: 100%;" src="/static/bg-days.png"></image>
+							<text class="text-white text-13px" style="line-height: 50rpx; position: absolute;top: 3rpx;right: 10rpx;">{{days}}天</text>
 						</view>
 					</view>
 					<!-- <view class="text-xs padding-top">
@@ -58,7 +58,7 @@
 			</view>
 			
 			<view class="card-view flex align-center " style="position: relative; height: 132rpx; margin-top: 8px;">
-				<image class="achievement-img round" src="../../../static/achievement/11-01@2x.png"></image>
+				<image class="achievement-img round" src="../../../static/achievement/11-07@2x.png"></image>
 				<view class="text-lg flex justify-between align-center justify-center">
 					<text class="text-gray text-14px">我的成就</text>
 				</view>
@@ -169,7 +169,7 @@
 		onReady() {
 			let phoneHeight = this.systemInfo.windowHeight;
 			// 计算组件的高度
-			this.scrollviewHight = phoneHeight - this.navHeight - this.tabbarHeight;
+			this.scrollviewHight = phoneHeight - this.navHeight - this.tabbarHeight - this.systemInfo.statusBarHeight;
 		},
 		methods: {
 			onViewImage(item) {

+ 382 - 0
pages/personal-page/directionOfDetection/directionOfDetection.vue

@@ -0,0 +1,382 @@
+<template>
+	<view>
+		<uni-nav-bar id="nav-bar" status-bar="true" @clickLeft="onBack()" title="校准设备方向" color="#000000" fixed="true"
+			:border="false" @clickRight="onResetCalibration()">
+			<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">
+				<button class="cu-btn make-bg-bPurple text-white margin-top margin-bottom text-11px">重置</button>
+			</view>
+
+		</uni-nav-bar>
+		<view class="flex justify-center align-center" style="height: 200rpx;">
+			<view v-if="currentBLEData">
+				<view>加速计 acc: x:{{currentBLEData.acc.ax.toFixed(4)}} y:{{currentBLEData.acc.ay.toFixed(4)}}
+					z:{{currentBLEData.acc.az.toFixed(4)}}
+				</view>
+				<view v-if="outBLEData">校准后 acc: x:{{outBLEData.acc.ax.toFixed(4)}} y:{{outBLEData.acc.ay.toFixed(4)}}
+					z:{{outBLEData.acc.az.toFixed(4)}}
+				</view>
+
+				<view>陀螺仪 gyro: x:{{currentBLEData.gyro.gx.toFixed(4)}} y:{{currentBLEData.gyro.gy.toFixed(4)}}
+					z:{{currentBLEData.gyro.gz.toFixed(4)}}
+				</view>
+				<view v-if="outBLEData">校准后 gyro: y:{{outBLEData.gyro.gy.toFixed(4)}}
+				</view>
+
+			</view>
+		</view>
+		<!-- 任务栏 -->
+		<scroll-view scroll-y="true" style="height: 500px; max-height: 600px;min-height: 230rpx;margin-top: 10rpx;"
+			:scroll-into-view="taskIntoView" :scroll-top="taskScrollTop">
+			<view class="my-column-cu-steps">
+				<view class="cu-item" :class="!item.isUnlock?'':'make-text-bPurple'"
+					v-for="(item,index) in currentTaskList" :key="index" :id='"task_"+index'>
+					<image v-if="item.isUnlock" class="my-column-cu-image"
+						src="../../../static/common/modal/unLock.png"></image>
+					<image v-else-if="index>=1&&currentTaskList[index-1].isUnlock&&currentTaskList[index-1].isPassed"
+						class="my-column-cu-image" src="../../../static/common/modal/canUnlock.png">
+					</image>
+					<image v-else class="my-column-cu-image" src="../../../static/common/modal/lock.png">
+					</image>
+					<view class="content" style="height: 130px;">
+						<view class="text-15px text-bold text-cut text-left "
+							style="margin-left: 48rpx; width: 360rpx;">
+							{{index+1}}. {{item.name}}
+						</view>
+
+						<view class="text-13px text-grey text-left" style="margin: 20rpx 20rpx 0 86rpx;">
+							{{item.explain}}
+						</view>
+
+						<button v-if="item.isAcc" :disabled="!(currentJumpTask!=null&&index==currentJumpTask.index)"
+							class="cu-btn make-bg-bPurple text-white margin-top margin-bottom"
+							@click="onCalibration(index,item)">确认</button>
+						<button v-else :disabled="!(currentJumpTask!=null&&index==currentJumpTask.index)"
+							class="cu-btn make-bg-bPurple text-white margin-top margin-bottom"
+							@click="onCalibrationGyro(index,item)">开始</button>
+					</view>
+
+					<image class="my-column-cu-image" style="left: 130rpx;top: 40rpx; width: 50rpx;height: 50rpx;"
+						:src="(currentJumpTask!=null&&index==currentJumpTask.index)?'/static/devicesOther/radio-b.png':'/static/devicesOther/radio-g.png'"
+						mode="aspectFit"></image>
+
+				</view>
+			</view>
+		</scroll-view>
+
+	</view>
+</template>
+
+<script>
+	import {
+		mapState,
+		mapMutations
+	} from 'vuex'
+	export default {
+		data() {
+			return {
+				taskIntoView: '',
+				taskScrollTop: 0,
+				currentJumpTask: {
+					index: 0
+				},
+				currentTaskList: [{
+						name: 'y轴-设备垂直方向',
+						isUnlock: false,
+						isPassed: false,
+						explain: '设备垂直桌面静止后,点击确认按钮',
+						isAcc: true
+					},
+					{
+						name: 'z轴-设备方向键方向',
+						isUnlock: false,
+						isPassed: false,
+						explain: '设备方向键向上静止于桌面后,点击确认按钮',
+						isAcc: true
+					},
+					{
+						name: 'x轴-侧边按钮方向',
+						isUnlock: false,
+						isPassed: false,
+						explain: '侧边按钮垂直向上静止后,点击确认按钮',
+						isAcc: true
+					},
+					{
+						name: 'y轴-左旋转',
+						isUnlock: false,
+						isPassed: false,
+						explain: '垂直桌面方向进行绕Y轴左旋转,点击确认按钮',
+						isAcc: false
+					}
+				],
+				currentBLEData: null,
+				outBLEData: null,
+
+				currentGyroXArray: [],
+				currentGyroYArray: [],
+				currentGyroZArray: [],
+				bMatchGyro: false,
+
+				currentInterval: null
+			}
+		},
+		onLoad() {
+			//测试socket
+			console.log('test*******************************');
+			// this.$testWS.connectSocket(() => {
+			// 	this.$testWS.sendSocketMessage('unity');
+			// });
+
+			//监听蓝牙回调
+			uni.$on('callbackCloseBLE', this.callbackCloseBLE);
+			uni.$on('updateBLEDeviceData', this.callbackUpdateBLEData);
+
+			// #ifndef APP-PLUS
+			this.currentInterval = setInterval(() => {
+				this.callbackUpdateBLEData({
+					acc: {
+						ax: Math.random() * 2,
+						ay: Math.random() * 2,
+						az: Math.random() * 2
+					},
+					gyro: {
+						gx: Math.random(),
+						gy: Math.random(),
+						gz: Math.random()
+					}
+				})
+			}, 100);
+			// #endif
+			// #ifdef APP-PLUS
+			//打开加速计
+			this.onWriteBLEConnectionValue({
+				value: "3"
+			});
+			// #endif
+
+
+
+
+		},
+		onUnload() {
+			//*****注释蓝牙操作******
+			uni.$off('callbackCloseBLE', this.callbackCloseBLE);
+			uni.$off('updateBLEDeviceData', this.callbackUpdateBLEData);
+			// #ifdef APP-PLUS
+			//打开加速计
+			this.onWriteBLEConnectionValue({
+				value: "4"
+			});
+			// #endif
+
+		},
+		computed: mapState(['convertAcc', 'convertGyro']),
+		methods: {
+			...mapMutations(['onWriteBLEConnectionValue', 'onAccAndGyroConvertDataReset', 'onConvertDeviceData','onAccAndGyroConvertDataSave']),
+			onBack() {
+				uni.navigateBack({
+					delta: 1
+				})
+			},
+			/**
+			 * 蓝牙断开连接时候
+			 */
+			callbackCloseBLE() {
+				console.log('callbackCloseBLE');
+			},
+			//设备回调事件
+			callbackUpdateBLEData(data) {
+				//如果在监听状态时候隐藏页面,返回
+				this.currentBLEData = data;
+
+				//如果开始校准旋转方向
+				if (this.bMatchGyro) {
+					this.onUpdateGyroData();
+				}
+
+				//模拟数据转化
+				this.onConvertDeviceData({
+					data: this.currentBLEData,
+					callback: (outData) => {
+						this.outBLEData = {
+							acc: outData.convertAcc,
+							gyro: outData.convertGyro
+						}
+					}
+				});
+
+			},
+			updateTaskScroll() {
+				if (this.currentJumpTask != null) {
+					let _index = this.currentJumpTask.index - 1 < 0 ? 0 : this.currentJumpTask.index - 1;
+					this.$nextTick(() => {
+						this.taskIntoView = "task_" + _index;
+					});
+					this.taskIntoView = '' //不清空再次跳到锚点位置会不起作用
+				}
+
+			},
+			onResetCalibration() {
+				this.currentJumpTask.index = 0;
+				for (let i = 0; i < this.currentTaskList.length; i++) {
+					this.currentTaskList[i].isUnlock = false;
+				}
+
+				this.onAccAndGyroConvertDataReset();
+
+				if (this.currentInterval) {
+					clearInterval(this.currentInterval)
+					this.currentInterval = null;
+				}
+
+			},
+			onCalibration(index, item) {
+				console.log(index, JSON.stringify(item));
+				item.isUnlock = true;
+				this.currentJumpTask.index = index + 1;
+				//这里处理校准设备方向处理,convertAcc 是一个 x,y,z 数组
+				if (0 === index) {
+					//校准y轴方向
+					//获取匹配当前接近1的数据,三个轴同时匹配
+					let {
+						name,
+						value
+					} = this.onMatchAccData();
+					this.convertAcc[1].match = name;
+					this.convertAcc[1].direction = value > 0 ? 1 : -1;
+				} else if (1 === index) {
+					//校准z轴方向
+					let {
+						name,
+						value
+					} = this.onMatchAccData();
+					this.convertAcc[2].match = name;
+					this.convertAcc[2].direction = value > 0 ? 1 : -1;
+				} else if (2 === index) {
+					//校准x轴方向
+					let {
+						name,
+						value
+					} = this.onMatchAccData();
+					this.convertAcc[0].match = name;
+					this.convertAcc[0].direction = value > 0 ? 1 : -1;
+				}
+				this.updateTaskScroll();
+			},
+			onCalibrationGyro(index, item) {
+				item.isUnlock = true;
+				this.currentJumpTask.index = index + 1;
+				if (3 === index) {
+					//校准y轴旋转方向-左旋转
+					this.onStartMatchGyro();
+					uni.showToast({
+						title: '校准中',
+						icon: 'loading',
+						mask: true,
+						duration: 2000
+					})
+				}
+				this.updateTaskScroll();
+			},
+			onStartMatchGyro() {
+				this.currentGyroValue = 0;
+				this.bMatchGyro = true;
+				this.currentGyroXArray = [];
+				this.currentGyroYArray = [];
+				this.currentGyroZArray = [];
+			},
+			onMatchAccData() {
+				let _data = {
+					name: 'none',
+					value: 0
+				}
+				// console.log(JSON.stringify(this.currentBLEData));
+				//返回一个大于0.9的数据的轴
+				if (Math.abs(this.currentBLEData.acc.ax) > 0.6) {
+					_data.name = 'ax'
+					_data.value = this.currentBLEData.acc.ax;
+					return _data;
+				}
+				if (Math.abs(this.currentBLEData.acc.ay) > 0.6) {
+					_data.name = 'ay'
+					_data.value = this.currentBLEData.acc.ay;
+					return _data;
+				}
+				if (Math.abs(this.currentBLEData.acc.az) > 0.6) {
+					_data.name = 'az'
+					_data.value = this.currentBLEData.acc.az;
+					return _data;
+				}
+				// console.log(_data);
+				return _data;
+			},
+			onUpdateGyroData() {
+				let _temp = 50;
+				if (Math.abs(this.currentBLEData.gyro.gx) < _temp &&
+					Math.abs(this.currentBLEData.gyro.gy) < _temp &&
+					Math.abs(this.currentBLEData.gyro.gz) < _temp)
+					return;
+
+				//这里不确定是哪个轴,
+				this.currentGyroXArray.push(this.currentBLEData.gyro.gx);
+				this.currentGyroYArray.push(this.currentBLEData.gyro.gy);
+				this.currentGyroZArray.push(this.currentBLEData.gyro.gz);
+
+				//取到10个数,停止。
+				if (this.currentGyroXArray.length > 20) {
+					this.bMatchGyro = false;
+					//判断左旋时候,确定当前轴的值
+					let _data = {
+						name: 'none',
+						value: 0
+					}
+					let currentGyroXValue = 0,
+						currentGyroYValue = 0,
+						currentGyroZValue = 0,
+						currentMaxGyro = 0;
+					for (let i = 0; i < this.currentGyroXArray.length; i++) {
+						currentGyroXValue += this.currentGyroXArray[i];
+						currentGyroYValue += this.currentGyroYArray[i];
+						currentGyroZValue += this.currentGyroZArray[i];
+					}
+
+
+					if (Math.abs(currentGyroXValue) > Math.abs(currentGyroYValue)) {
+						_data.name = 'gx';
+						_data.value = currentGyroXValue;
+						currentMaxGyro = currentGyroXValue;
+					} else {
+						_data.name = 'gy';
+						_data.value = currentGyroYValue;
+						currentMaxGyro = currentGyroYValue;
+					}
+
+					if (Math.abs(currentGyroZValue) > Math.abs(currentMaxGyro)) {
+						_data.name = 'gz';
+						_data.value = currentGyroZValue;
+						currentMaxGyro = currentGyroZValue;
+					}
+					//定y为旋转轴,即 convertGyro 下标 1
+					this.convertGyro[1].match = _data.name;
+					//以左旋转为校准轴,如果当前左旋值大于0.即设置direction -1;
+					this.convertGyro[1].direction = _data.value > 0 ? -1 : 1;
+					
+					console.log('convertGyro=',JSON.stringify(_data))
+					uni.showToast({
+						title: '校准完成'
+					})
+					
+					this.onAccAndGyroConvertDataSave();
+				}
+			}
+		}
+	}
+</script>
+
+<style>
+
+</style>

+ 176 - 146
pages/personal-page/personal/personal.vue

@@ -8,7 +8,6 @@
 			<!-- #ifdef H5 || MP-WEIXIN -->
 			@clickLeft="showClickEvent()"
 			<!-- #endif -->
-
 			color="#FFFFFF" fixed="true" :border="false">
 			<view slot="left">
 				<view class=" flex align-center margin-left">
@@ -254,8 +253,11 @@
 				<view class="example-title">从左侧滑出</view>
 				<button @click="showDrawer">显示抽屉</button>
 			</view> -->
-			<view class="example">
+			<!-- <view class="example">
 				<button @click="showPopup('signIn',null)">显示 每日签到</button>
+			</view> -->
+			<view class="example" style="margin-top: 10rpx;">
+				<button @click="onNavToDirection">跳转校准页面</button>
 			</view>
 			<view style="height: 100rpx;"></view>
 		</scroll-view>
@@ -264,7 +266,7 @@
 		<view class="flex flex-direction justify-center align-center task-up-button">
 			<image style="width: 156rpx; height: 32rpx;" src="../../../static/personal/slideUp.png" @tap="showModal"
 				data-target="slideUpModal"></image>
-			<view style="width: 100%;,height: 36rpx; background-color: #FFFFFF; color: #FFFFFF;">|</view>
+			<view style="width: 100%;height: 36rpx; background-color: #FFFFFF; color: #FFFFFF;"></view>
 		</view>
 
 		<!-- 右下角导航栏 -->
@@ -853,6 +855,12 @@
 			});
 			//钱包信息
 			this.getUserWallets();
+			
+			//测试socket
+			// console.log('test*******************************');
+			// this.$testWS.connectSocket(()=>{
+			// 	this.$testWS.sendSocketMessage('unity');
+			// });
 		},
 		onShow() {
 			_self.bHide = false;
@@ -915,9 +923,9 @@
 			// 计算屏幕剩余高度  填补剩余高度
 			let phoneHeight = this.systemInfo.windowHeight;
 
-			console.log('计算屏幕剩余高度 ===:', phoneHeight);
+			console.log('计算屏幕剩余高度 ===:', phoneHeight,this.systemInfo);
 			// 计算组件的高度
-			_self.scrollviewHight = phoneHeight - this.navHeight - this.tabbarHeight - 16;
+			_self.scrollviewHight = phoneHeight - this.navHeight - this.tabbarHeight - 16 - this.systemInfo.statusBarHeight;
 			// let view = uni.createSelectorQuery().select('#nav-bar');
 			// view.boundingClientRect(data => {
 			// 	// console.log('data===:', data);
@@ -969,7 +977,9 @@
 				'gStopSimulateBLEUpdate',
 				'getActionJumpTask',
 				'setActionJumpTask', 'getLevelList',
-				'getUserWallets', 'setGoldAndDiamond'
+				'getUserWallets', 'setGoldAndDiamond',
+				'onConvertDeviceData',
+				'showDrawerById','showPopupById'
 			]),
 			BasicsSteps() {
 				this.basics = this.basics == this.basicsList.length - 1 ? 0 : this.basics + 1
@@ -1357,8 +1367,22 @@
 					//这个是普通打击模式
 					this.$refs.boxingPostRef.onBLEHandleUpdate(data);
 				} else if (this.BLEConnectDevice.usageMode == "ropeSkipping") {
-					//跳绳蓝牙反馈
-					this.$refs.actionJumpRef.onBLERopeUpdate(data);
+					
+					this.onConvertDeviceData({
+						data: data,
+						callback: (outData) => {
+							// this.outBLEData = {
+							// 	acc: outData.convertAcc,
+							// 	gyro: outData.convertGyro
+							// }
+							// console.log(JSON.stringify(outData),JSON.stringify(data));
+							data.acc = outData.convertAcc;
+							data.gyro = outData.convertGyro;
+							//跳绳蓝牙反馈
+							this.$refs.actionJumpRef.onBLERopeUpdate(data);
+							
+						}
+					});
 
 				}
 
@@ -2557,145 +2581,145 @@
 
 			},
 			showDrawer() {
-				uni.getSubNVueById('personal-drawer').show('slide-in-left', 200);
+				// uni.getSubNVueById('personal-drawer').show('slide-in-left', 200);
+				// {id:'personal-drawer'}
+				this.showDrawerById();
 			},
 			showPopup(type, item) {
 				console.log(type, item);
-				switch (type) {
-					case 'levelReward':
-						uni.$emit('reward-popup', {
-							title: '奖励',
-							content: '',
-							type: type,
-							item: {
-								gold: item.rewardGold,
-								diamond: item.rewardDiamond,
-								honor: item.rewardHonor
-							},
-							operationItem: item
-						});
-						break;
-					case 'prompt':
-						// 向 popup 传递消息
-						uni.$emit('reward-popup', {
-							title: '奖励',
-							content: '',
-							type: type,
-							item: {
-								gold: item.rewardGold,
-								diamond: item.rewardDiamond,
-								honor: item.rewardHonor.explain
-							},
-							operationItem: item
-						});
-						break;
-					case 'unlock':
-						// 向 popup 传递消息
-						uni.$emit('reward-popup', {
-							title: '解锁关卡',
-							content: '',
-							type: type,
-							item: {
-								consumeGold: item.consumeGold,
-								consumeDiamond: item.consumeDiamond
-							},
-							operationItem: item
-						});
-						break;
-					case 'signIn':
-						// 向 popup 传递消息
-						uni.$emit('reward-popup', {
-							title: '每日签到',
-							content: '',
-							type: type,
-							lists: [{
-									name: 'gold',
-									width: 28,
-									height: 28,
-									url: '../../../static/common/sideBar/sGold.png',
-									selectedUrl: '../../../static/common/subNVue/sign/sign-grey-gold@2x.png',
-									explain: '',
-									value: 20,
-									isSelect: true
-								},
-								{
-									name: 'diamond',
-									width: 28,
-									height: 28,
-									url: '../../../static/common/sideBar/sDiamond.png',
-									selectedUrl: '../../../static/common/subNVue/sign/sign-grey-diamond@2x.png',
-									explain: '',
-									value: 20,
-									isSelect: true
-								},
-								{
-									name: 'gold',
-									width: 28,
-									height: 28,
-									url: '../../../static/common/sideBar/sGold.png',
-									selectedUrl: '../../../static/common/subNVue/sign/sign-grey-gold@2x.png',
-									explain: '',
-									value: 20,
-									isSelect: true
-								},
-								{
-									name: 'gold',
-									width: 28,
-									height: 28,
-									url: '../../../static/common/sideBar/sGold.png',
-									selectedUrl: '../../../static/common/subNVue/sign/sign-grey-gold@2x.png',
-									explain: '',
-									value: 20,
-									isSelect: false
-								},
-								{
-									name: 'diamond',
-									width: 28,
-									height: 28,
-									url: '../../../static/common/sideBar/sDiamond.png',
-									selectedUrl: '../../../static/common/subNVue/sign/sign-grey-diamond@2x.png',
-									explain: '',
-									value: 20,
-									isSelect: false
-								},
-								{
-									name: 'gold',
-									width: 28,
-									height: 28,
-									url: '../../../static/common/sideBar/sGold.png',
-									selectedUrl: '../../../static/common/subNVue/sign/sign-grey-gold@2x.png',
-									explain: '',
-									value: 20,
-									isSelect: false
-								},
-								{
-									name: 'gold',
-									width: 28,
-									height: 28,
-									url: '../../../static/common/sideBar/sGold.png',
-									selectedUrl: '../../../static/common/subNVue/sign/sign-grey-gold@2x.png',
-									explain: '',
-									value: 20,
-									isSelect: false
-								}
-							]
-						});
-						break;
-
-					default:
-						uni.showToast({
-							title: 'showPopup 类型为空',
-						})
-						break;
-				}
-
-				// #ifdef APP-PLUS
-				const subNVue = uni.getSubNVueById('personal-popup')
-				subNVue.show('zoom-out', 250)
-				// #endif
-
-
+				this.showPopupById({type,item});
+				// switch (type) {
+				// 	case 'levelReward':
+				// 		uni.$emit('reward-popup', {
+				// 			title: '奖励',
+				// 			content: '',
+				// 			type: type,
+				// 			item: {
+				// 				gold: item.rewardGold,
+				// 				diamond: item.rewardDiamond,
+				// 				honor: item.rewardHonor
+				// 			},
+				// 			operationItem: item
+				// 		});
+				// 		break;
+				// 	case 'prompt':
+				// 		// 向 popup 传递消息
+				// 		uni.$emit('reward-popup', {
+				// 			title: '奖励',
+				// 			content: '',
+				// 			type: type,
+				// 			item: {
+				// 				gold: item.rewardGold,
+				// 				diamond: item.rewardDiamond,
+				// 				honor: item.rewardHonor
+				// 			},
+				// 			operationItem: item
+				// 		});
+				// 		break;
+				// 	case 'unlock':
+				// 		// 向 popup 传递消息
+				// 		uni.$emit('reward-popup', {
+				// 			title: '解锁关卡',
+				// 			content: '',
+				// 			type: type,
+				// 			item: {
+				// 				consumeGold: item.consumeGold,
+				// 				consumeDiamond: item.consumeDiamond
+				// 			},
+				// 			operationItem: item
+				// 		});
+				// 		break;
+				// 	case 'signIn':
+				// 		// 向 popup 传递消息
+				// 		uni.$emit('reward-popup', {
+				// 			title: '每日签到',
+				// 			content: '',
+				// 			type: type,
+				// 			lists: [{
+				// 					name: 'gold',
+				// 					width: 28,
+				// 					height: 28,
+				// 					url: '../../../static/common/sideBar/sGold.png',
+				// 					selectedUrl: '../../../static/common/subNVue/sign/sign-grey-gold@2x.png',
+				// 					explain: '',
+				// 					value: 20,
+				// 					isSelect: true
+				// 				},
+				// 				{
+				// 					name: 'diamond',
+				// 					width: 28,
+				// 					height: 28,
+				// 					url: '../../../static/common/sideBar/sDiamond.png',
+				// 					selectedUrl: '../../../static/common/subNVue/sign/sign-grey-diamond@2x.png',
+				// 					explain: '',
+				// 					value: 20,
+				// 					isSelect: true
+				// 				},
+				// 				{
+				// 					name: 'gold',
+				// 					width: 28,
+				// 					height: 28,
+				// 					url: '../../../static/common/sideBar/sGold.png',
+				// 					selectedUrl: '../../../static/common/subNVue/sign/sign-grey-gold@2x.png',
+				// 					explain: '',
+				// 					value: 20,
+				// 					isSelect: true
+				// 				},
+				// 				{
+				// 					name: 'gold',
+				// 					width: 28,
+				// 					height: 28,
+				// 					url: '../../../static/common/sideBar/sGold.png',
+				// 					selectedUrl: '../../../static/common/subNVue/sign/sign-grey-gold@2x.png',
+				// 					explain: '',
+				// 					value: 20,
+				// 					isSelect: false
+				// 				},
+				// 				{
+				// 					name: 'diamond',
+				// 					width: 28,
+				// 					height: 28,
+				// 					url: '../../../static/common/sideBar/sDiamond.png',
+				// 					selectedUrl: '../../../static/common/subNVue/sign/sign-grey-diamond@2x.png',
+				// 					explain: '',
+				// 					value: 20,
+				// 					isSelect: false
+				// 				},
+				// 				{
+				// 					name: 'gold',
+				// 					width: 28,
+				// 					height: 28,
+				// 					url: '../../../static/common/sideBar/sGold.png',
+				// 					selectedUrl: '../../../static/common/subNVue/sign/sign-grey-gold@2x.png',
+				// 					explain: '',
+				// 					value: 20,
+				// 					isSelect: false
+				// 				},
+				// 				{
+				// 					name: 'gold',
+				// 					width: 28,
+				// 					height: 28,
+				// 					url: '../../../static/common/sideBar/sGold.png',
+				// 					selectedUrl: '../../../static/common/subNVue/sign/sign-grey-gold@2x.png',
+				// 					explain: '',
+				// 					value: 20,
+				// 					isSelect: false
+				// 				}
+				// 			]
+				// 		});
+				// 		break;
+
+				// 	default:
+				// 		uni.showToast({
+				// 			title: 'showPopup 类型为空',
+				// 		})
+				// 		break;
+				// }
 
+				// // #ifdef APP-PLUS
+				// const subNVue = uni.getSubNVueById('personal-popup')
+				// subNVue.show('zoom-out', 250)
+				// // #endif
 			},
 
 			/**
@@ -2905,6 +2929,12 @@
 			unregisterPopupEvent() {
 				uni.$off('reward-popup-page')
 				uni.$off('drawer-page')
+			},
+			
+			onNavToDirection(){
+				uni.navigateTo({
+					url:'../directionOfDetection/directionOfDetection'
+				})
 			}
 		}
 	};
@@ -3566,17 +3596,17 @@
 	.task-up-button {
 		z-index: 10;
 
-		/* #ifndef APP-PLUS-NVUE */
+		/* #ifndef APP-PLUS */
 		position: absolute;
 		/* #endif */
-		/* #ifdef APP-PLUS-NVUE */
+		/* #ifdef APP-PLUS */
 		position: fixed;
 		/* #endif */
 		bottom: -10px;
 		right: 0;
 		left: 0;
 		margin: auto;
-		width: 750rpx;
+		width: 100%;
 		height: 68rpx;
 	}
 </style>

+ 15 - 11
platform/app-plus/subNVue/drawer.nvue

@@ -1,9 +1,8 @@
 <template>
 	<div>
-		<scroller  :style="{ height: systemInfo.windowHeight + 'px' }">
+		<scroller :style="{ height: systemInfo.windowHeight + 'px' }">
 			<view class="drawerBg">
-				<image style="width: 750rpx;height: 672rpx;"
-					src="../../../static/sidebar_white.png"></image>
+				<image style="width: 750rpx;height: 672rpx;" src="../../../static/sidebar_white.png"></image>
 			</view>
 			<view class="blank-space"></view>
 			<view class="flex justify-center align-center ">
@@ -11,7 +10,7 @@
 					<image class="avatar-img bg-black" mode="aspectFit" :src="avatarUrl">
 					</image>
 				</view>
-			
+
 				<view class="flex flex-direction-row align-center margin-12px " @tap="onNavEditInfoPage">
 					<text class="text-22px text-bold">{{userName}}
 					</text>
@@ -54,7 +53,7 @@
 	} from 'vuex';
 	export default {
 		computed: mapState(['bCanvasShow', 'token', 'userName', 'avatarUrl', 'days', 'signature', 'weight',
-			'height','systemInfo'
+			'height', 'systemInfo'
 		]),
 		data() {
 			return {
@@ -78,11 +77,11 @@
 			// }
 		},
 		methods: {
-			...mapMutations(['loginUserInfo', 'onLuanchLogin', 'delectToken']),
+			...mapMutations(['loginUserInfo', 'onLuanchLogin', 'delectToken','showPopupById']),
 			hideDrawer() {
 				uni.getCurrentSubNVue().hide('auto')
 			},
-			clickitem(e,_pageType) {
+			clickitem(e, _pageType) {
 				// uni.$emit('drawer-page', e);
 				this.onNavListItem(_pageType);
 			},
@@ -102,7 +101,12 @@
 					this.onNavMyPage();
 					return;
 				}
-				// return;
+				if(pageType == "signBoard")
+				{	
+					this.hideDrawer();
+					this.showPopupById({type:'signIn',item:null});
+					return;
+				}
 				let url = '';
 				switch (pageType) {
 					case "recently":
@@ -126,7 +130,7 @@
 					complete: () => {}
 				});
 			},
-			
+
 			/**
 			 * 退出登录
 			 */
@@ -163,8 +167,8 @@
 		justify-content: center;
 		align-items: center;
 	}
-	
-	
+
+
 
 	.blank-space {
 		height: 150rpx;

+ 43 - 17
platform/app-plus/subNVue/reward-popup.nvue

@@ -11,7 +11,9 @@
 					src="../../../static/common/subNVue/bg-light.png">
 				</image>
 				<view class="position-absolute-center">
-					<image class="reward-image" mode="aspectFit" :src="lists[levelRewardIndex].url">
+					<image class="reward-image"
+						:style="{width:lists[levelRewardIndex].width+'px',height:lists[levelRewardIndex].height+'px'}"
+						mode="aspectFit" :src="lists[levelRewardIndex].url">
 					</image>
 				</view>
 
@@ -37,14 +39,14 @@
 				</image>
 			</view>
 
-			<view class="prompt-mid">
+			<view class="prompt-mid" style="height: 622rpx; ">
 				<block v-for="(item, index) in lists" :key="index">
 					<view class="justify-center align-center" style="height: 230rpx; width: 160rpx; margin:5rpx;">
-						<view class="prompt-cell-bg"></view>
-						<image class="position-absolute-center-top" style="height:260rpx;"
+						<view class="prompt-cell-bg" ></view>
+						<image class="position-absolute-center-top" style="height:200rpx;"
 							src="../../../static/common/subNVue/prompt-bg@2x.png"></image>
-						<view class="position-absolute-center" style="height:200rpx;">
-							<image style="" :style="{width:item.width+'px',height:item.height+'px'}" mode="aspectFit"
+						<view class="position-absolute-center-top" style="height:140rpx;top: 40rpx;">
+							<image :style="{width:item.width+'px',height:item.height+'px'}" mode="aspectFit"
 								:src="item.url">
 							</image>
 							<view class="position-absolute-center-bottom">
@@ -71,14 +73,14 @@
 			</view>
 		</view>
 		<!-- 解锁关卡 -->
-		<view v-if="currentType == 'unlock'" class="reward-container border-1rpx-black" style="height: 1000rpx;">
+		<view v-if="currentType == 'unlock'" class="reward-container" style="height: 1000rpx;">
 			<view class="position-absolute-center-top" style="top: 20rpx;">
 				<image style="width: 656rpx; height: 224rpx;" mode="aspectFit"
 					src="../../../static/common/subNVue/prompt-bg-title@2x.png">
 				</image>
 			</view>
 
-			<view class="prompt-mid flex-direction-column">
+			<view class="prompt-mid flex-direction-column" style="height: 622rpx">
 				<view class="" style="height: 230rpx; width: 500rpx; margin:5rpx;">
 					<view class="position-absolute-center">
 						<image class="" style="height:296rpx;width: 296rpx"
@@ -212,6 +214,25 @@
 					url: '../../../static/common/subNVue/prompt-qm@2x.png',
 					explain: '未知'
 				}],
+				rewardList: [{
+					name: 'reward-gold',
+					width: 98,
+					height: 98,
+					url: '../../../static/common/subNVue/reward-gold.png',
+					explain: ''
+				}, {
+					name: 'reward-diamond',
+					width: 98,
+					height: 98,
+					url: '../../../static/common/subNVue/reward-diamond.png',
+					explain: ''
+				}, {
+					name: 'reward-medal',
+					width: 118,
+					height: 135,
+					url: '../../../static/common/subNVue/big-medal.png',
+					explain: ''
+				}],
 				currentType: 'none',
 
 				/**
@@ -255,9 +276,9 @@
 						vm.lists.push(vm.promptList[3]);
 					}
 
-					if (_item.honor) {
+					if (_item.honor && _item.honor.type != 0) {
 						let temp = Object.assign({}, vm.promptList[2]);
-						temp.explain = _item.honor + '';
+						temp.explain = _item.honor.name + '';
 						vm.lists.push(temp);
 					} else {
 						vm.lists.push(vm.promptList[3]);
@@ -270,19 +291,19 @@
 				} else if (vm.currentType == "levelReward") {
 					let _item = data.item;
 					if (_item.gold && _item.gold != 0) {
-						let temp = Object.assign({}, vm.promptList[0]);
+						let temp = Object.assign({}, vm.rewardList[0]);
 						temp.explain = _item.gold + '';
 						vm.lists.push(temp);
 					}
 
 					if (_item.diamond && _item.diamond != 0) {
-						let temp = Object.assign({}, vm.promptList[1]);
+						let temp = Object.assign({}, vm.rewardList[1]);
 						temp.explain = _item.diamond + '';
 						vm.lists.push(temp);
 					}
 
 					if (_item.honor && _item.honor.type != 0) {
-						let temp = Object.assign({}, vm.promptList[2]);
+						let temp = Object.assign({}, vm.rewardList[2]);
 						temp.explain = _item.honor.explain + '';
 						vm.lists.push(temp);
 					}
@@ -321,9 +342,10 @@
 					operationItem: this.operationItem
 				})
 				if (this.currentType == 'levelReward') {
-					this.levelRewardIndex ++;
-					if(this.levelRewardIndex>=this.lists.length){
+					if (this.levelRewardIndex == this.lists.length - 1) {
 						this.hidePupup();
+					} else {
+						this.levelRewardIndex++;
 					}
 				} else {
 					this.hidePupup();
@@ -331,8 +353,12 @@
 
 			},
 			hidePupup() {
-				const subNVue = uni.getCurrentSubNVue();
-				subNVue.hide("auto", 250);
+				// const subNVue = uni.getCurrentSubNVue();
+				// subNVue.hide("auto", 250);
+				uni.getCurrentSubNVue().hide('auto',250);
+				setTimeout(()=>{
+					this.currentType = 'none';
+				},250);
 			}
 		}
 	}

+ 6 - 2
util/util-js/action/jump.js

@@ -160,10 +160,14 @@ ActionJump.prototype.detectorNewStep = function(resultant, linearX, linearY, lin
 					this.peakOfWaveArray.push(_temp);
 					if (value > this.peakOfWaveMaxValue)
 						this.peakOfWaveMaxValue = value;
+						
+					console.log("peakOfWave=",value,this.peakOfWaveMaxValue);
 				} else if (bType == 'valleyOfWave') {
 					this.valleyOfWaveArray.push(_temp);
 					if (value < this.valleyOfWaveMinValue)
 						this.valleyOfWaveMinValue = value;
+					
+					console.log("valleyOfWave=",value,this.valleyOfWaveMinValue);
 				}
 				this.highestCount = 0;
 				//陀螺仪部分
@@ -261,7 +265,7 @@ ActionJump.prototype.detectorNewStep = function(resultant, linearX, linearY, lin
 						this.resetAll();
 
 
-						console.log("this.jumpOpts.startCount111:", this.jumpOpts.startCount);
+						console.log("resetAll:", this.jumpOpts.startCount);
 					}
 
 				}
@@ -274,7 +278,7 @@ ActionJump.prototype.detectorNewStep = function(resultant, linearX, linearY, lin
 				this.event.trigger('resultant', {
 					type: "stop"
 				});
-				console.log("this.jumpOpts.startCount222:", this.jumpOpts.startCount);
+				console.log("timeOfPeakCount >=30");
 				this.resetAll();
 			}
 		}

+ 259 - 2
util/util-js/store.js

@@ -354,8 +354,114 @@ const store = new Vuex.Store({
 		multiPersonList: [],
 		singlePersonList: [],
 
+		/**
+		 * 校准识别部分
+		 */
+		convertAcc: [{
+			type: 'x',
+			match: 'ax', //默认匹配一一对应
+			direction: 1,
+		}, {
+			type: 'y',
+			match: 'ay',
+			direction: 1,
+		}, {
+			type: 'z',
+			match: 'az',
+			direction: 1,
+		}],
+		convertGyro: [{
+			type: 'x',
+			match: 'gx', //默认匹配一一对应
+			direction: 1,
+		}, {
+			type: 'y',
+			match: 'gy',
+			direction: 1,
+		}, {
+			type: 'z',
+			match: 'gz',
+			direction: 1,
+		}],
+
 	},
 	mutations: {
+		/**
+		 * 蓝牙解析后的数据,转化成对应的坐标系方向
+		 * @param {Object} context
+		 */
+		onConvertDeviceData(state, context) {
+			let {
+				data,
+				callback = null
+			} = context;
+			let {
+				acc,
+				gyro,
+			} = data;
+			//根据已校准的数据转化对应的轴
+			let outAcc = {
+				ax: acc[state.convertAcc[0].match] * state.convertAcc[0].direction,
+				ay: acc[state.convertAcc[1].match] * state.convertAcc[1].direction,
+				az: acc[state.convertAcc[2].match] * state.convertAcc[2].direction
+			};
+			let outGyro = {
+				gx: gyro[state.convertGyro[0].match] * state.convertGyro[0].direction,
+				gy: gyro[state.convertGyro[1].match] * state.convertGyro[1].direction,
+				gz: gyro[state.convertGyro[2].match] * state.convertGyro[2].direction
+			}
+			if (callback)
+				callback({
+					convertAcc: outAcc,
+					convertGyro: outGyro
+				});
+
+		},
+		onAccAndGyroConvertDataGet(state){
+			const convertAcc = uni.getStorageSync('convertAcc');
+			if (convertAcc) {
+				state.convertAcc = convertAcc;
+			}
+			const convertGyro = uni.getStorageSync('convertGyro');
+			if (convertGyro) {
+				state.convertGyro = convertGyro;
+			}
+		},
+		onAccAndGyroConvertDataSave(state){
+			uni.setStorageSync('convertAcc', state.convertAcc);
+			uni.setStorageSync('convertGyro', state.convertGyro);
+		},
+		onAccAndGyroConvertDataReset(state) {
+			state.convertAcc = [{
+				type: 'x',
+				match: 'ax', //默认匹配一一对应
+				direction: 1,
+			}, {
+				type: 'y',
+				match: 'ay',
+				direction: 1,
+			}, {
+				type: 'z',
+				match: 'az',
+				direction: 1,
+			}];
+			state.convertGyro = [{
+				type: 'x',
+				match: 'gx', //默认匹配一一对应
+				direction: 1,
+			}, {
+				type: 'y',
+				match: 'gy',
+				direction: 1,
+			}, {
+				type: 'z',
+				match: 'gz',
+				direction: 1,
+			}];
+			//重置一下数据保存
+			this.commit('onAccAndGyroConvertDataSave');
+		},
+
 		/**
 		 * 设置当前操作的任务记录到本地
 		 * @param {Object} state
@@ -1756,7 +1862,7 @@ const store = new Vuex.Store({
 		},
 		onWriteBLEConnectionValue(state, context) {
 			//#ifdef H5
-			console.warn("h5不支持蓝牙:",'onWriteBLEConnectionValue');
+			console.warn("h5不支持蓝牙:", 'onWriteBLEConnectionValue');
 			return;
 			//#endif
 			let {
@@ -3132,7 +3238,158 @@ const store = new Vuex.Store({
 			} = context;
 			state.cGold = gold;
 			state.cDiamond = diamond;
-		}
+		},
+		
+		/**
+		 * 抽屉和弹出框
+		 */
+		hideDrawerById(state,context) {
+			// let { id } = context;
+			//personal-drawer
+			uni.getSubNVueById('personal-drawer').hide('slide-in-left', 200);
+		},
+		showDrawerById(state,context) {
+			// let { id } = context;
+			//personal-drawer
+			uni.getSubNVueById('personal-drawer').show('slide-in-left', 200);
+		},
+		showPopupById(state,context) {
+			let { type, item } = context;
+			console.log(type, item);
+			switch (type) {
+				case 'levelReward':
+					uni.$emit('reward-popup', {
+						title: '奖励',
+						content: '',
+						type: type,
+						item: {
+							gold: item.rewardGold,
+							diamond: item.rewardDiamond,
+							honor: item.rewardHonor
+						},
+						operationItem: item
+					});
+					break;
+				case 'prompt':
+					// 向 popup 传递消息
+					uni.$emit('reward-popup', {
+						title: '奖励',
+						content: '',
+						type: type,
+						item: {
+							gold: item.rewardGold,
+							diamond: item.rewardDiamond,
+							honor: item.rewardHonor
+						},
+						operationItem: item
+					});
+					break;
+				case 'unlock':
+					// 向 popup 传递消息
+					uni.$emit('reward-popup', {
+						title: '解锁关卡',
+						content: '',
+						type: type,
+						item: {
+							consumeGold: item.consumeGold,
+							consumeDiamond: item.consumeDiamond
+						},
+						operationItem: item
+					});
+					break;
+				case 'signIn':
+					// 向 popup 传递消息
+					uni.$emit('reward-popup', {
+						title: '每日签到',
+						content: '',
+						type: type,
+						lists: [{
+								name: 'gold',
+								width: 28,
+								height: 28,
+								url: '../../../static/common/sideBar/sGold.png',
+								selectedUrl: '../../../static/common/subNVue/sign/sign-grey-gold@2x.png',
+								explain: '',
+								value: 20,
+								isSelect: true
+							},
+							{
+								name: 'diamond',
+								width: 28,
+								height: 28,
+								url: '../../../static/common/sideBar/sDiamond.png',
+								selectedUrl: '../../../static/common/subNVue/sign/sign-grey-diamond@2x.png',
+								explain: '',
+								value: 20,
+								isSelect: true
+							},
+							{
+								name: 'gold',
+								width: 28,
+								height: 28,
+								url: '../../../static/common/sideBar/sGold.png',
+								selectedUrl: '../../../static/common/subNVue/sign/sign-grey-gold@2x.png',
+								explain: '',
+								value: 20,
+								isSelect: true
+							},
+							{
+								name: 'gold',
+								width: 28,
+								height: 28,
+								url: '../../../static/common/sideBar/sGold.png',
+								selectedUrl: '../../../static/common/subNVue/sign/sign-grey-gold@2x.png',
+								explain: '',
+								value: 20,
+								isSelect: false
+							},
+							{
+								name: 'diamond',
+								width: 28,
+								height: 28,
+								url: '../../../static/common/sideBar/sDiamond.png',
+								selectedUrl: '../../../static/common/subNVue/sign/sign-grey-diamond@2x.png',
+								explain: '',
+								value: 20,
+								isSelect: false
+							},
+							{
+								name: 'gold',
+								width: 28,
+								height: 28,
+								url: '../../../static/common/sideBar/sGold.png',
+								selectedUrl: '../../../static/common/subNVue/sign/sign-grey-gold@2x.png',
+								explain: '',
+								value: 20,
+								isSelect: false
+							},
+							{
+								name: 'gold',
+								width: 28,
+								height: 28,
+								url: '../../../static/common/sideBar/sGold.png',
+								selectedUrl: '../../../static/common/subNVue/sign/sign-grey-gold@2x.png',
+								explain: '',
+								value: 20,
+								isSelect: false
+							}
+						]
+					});
+					break;
+		
+				default:
+					uni.showToast({
+						title: 'showPopup 类型为空',
+					})
+					break;
+			}
+		
+			// #ifdef APP-PLUS
+			//personal-popup
+			const subNVue = uni.getSubNVueById('personal-popup')
+			subNVue.show('zoom-out', 250)
+			// #endif
+		},
 	}
 })
 

+ 37 - 0
util/util-js/webSocket.js

@@ -0,0 +1,37 @@
+var socketOpen = false;
+var socketMsgQueue = [];
+
+const connectSocket = function(callback) {
+	console.warn('connectSocket打开!');
+	uni.connectSocket({
+		url: 'wss://www.yuyekeji.cn/node/'
+	});
+	uni.onSocketOpen(function(res) {
+		socketOpen = true;
+		console.log('WebSocket连接已打开!');
+		for (var i = 0; i < socketMsgQueue.length; i++) {
+			sendSocketMessage(socketMsgQueue[i]);
+		}
+		socketMsgQueue = [];
+
+		if (callback)
+			callback();
+	});
+	uni.onSocketError(function(res) {
+		console.log('WebSocket连接打开失败,请检查!');
+	});
+}
+const sendSocketMessage = function sendSocketMessage(msg) {
+	if (socketOpen) {
+		uni.sendSocketMessage({
+			data: msg
+		});
+	} else {
+		socketMsgQueue.push(msg);
+	}
+}
+
+export default {
+	connectSocket,
+	sendSocketMessage
+}