ソースを参照

Merge branch 'master' of http://81.70.224.233:10080/yichael/ProAdvanced

# Conflicts:
#	common/config.js
#	manifest.json
#	pages/game-page/game-play-sub/subGame/subGame.nvue
#	pages/personal-page/personal/personal.vue
#	util/util-js/o0ProjectRelease0.1.js
#	util/util-js/store.js
slambb 3 年 前
コミット
1329ec0661

+ 16 - 6
common/config.js

@@ -11,7 +11,7 @@ const active = "dev";
 //测试地址,阿里云服务器
 // const host = "https://www.9527fun.cn/api_dev"
 //本地测试地址
-const host = "http://192.168.0.109:9090/api_dev"
+const host = "http://192.168.1.12: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"
@@ -20,15 +20,12 @@ const host = "http://192.168.0.109:9090/api_dev"
 const URL = {
 	//验证token,获取服务器返回的信息
 	VERIFICATION: `${host}/program/Verification_Info`,
-	
 	/**
 	 * @deprecated since version 2.4.15
 	 */
 	SMSLOGIN: `${host}/program/SMS_login`,
 	//根据不同类型账号注册登录
 	SMSLOGINFROMTYPE: `${host}/program/SMS_login_from_type`,
-	
-	
 	/**
 	 * @deprecated since version 2.4.10
 	 */
@@ -112,6 +109,10 @@ const URL = {
 	FITNESSPROGRAM: `${host}/fitness_program/add`,
 
 	FITNESSPROGRAMGET: `${host}/fitness_program/get`,
+	
+	//获取用户击打数据
+	USERDATA_GETHITCOUNT:`${host}/tPlat/userData/getHitCount`,
+	USERDATA_UPLOADHITCOUNT:`${host}/tPlat/userData/uploadHitCount`,
 
 	/**
 	 * 7-28 好友操作部分
@@ -130,16 +131,25 @@ const URL = {
 	USERSIGNIN: `${host}/user_info/user_sign_in`,
 
 	//游戏页面部分
-	//获取全部游戏
+	/**
+	 * 获取全部游戏
+	 * @deprecated
+	 */
 	GAMELIST: `${host}/game/list`,
 	//获取游戏详情
 	GAMEDETAIL: `${host}/game/detail`,
-	//获取推荐列表
+	/**
+	 * 获取推荐列表
+	 * @deprecated
+	 */
 	GAMERECOMMEND: `${host}/game/recommend_list`,
 	GAMERECOMMENDBYPLATFORM: `${host}/game/recommend_list_platform`,
 	//获取游戏类目
 	GAMECATEGORY: `${host}/game/game_category_list`,
 	//根据游戏类目获取游戏列表
+	/**
+	 * @deprecated
+	 */
 	GAMELIST_FROM_CATEGORY: `${host}/game/list_from_category`,
 	GAMELIST_FROM_CATEGORY_PLATFORM: `${host}/game/list_from_category_platform`,
 

+ 3 - 2
components/modal/action-hit/action-hit.vue

@@ -1,4 +1,3 @@
-11
 <!-- 新版本拳击区域部分文件 -->
 <template>
 	<view style="width: 750rpx;">
@@ -123,7 +122,9 @@
 			<button @click="onJumpType(1)">left</button>
 			<button @click="onJumpType(2)">right</button>
 		</view>
+		
 		<!-- #endif -->
+		
 	</view>
 
 </template>
@@ -1324,7 +1325,7 @@
 				} else if (gameData.direction == "rightPunch") {
 					this.eliminateJumpPrefab(2);
 				}
-
+			
 				this.BLEAccIndex++;
 			},
 			onClearData() {

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

@@ -163,7 +163,7 @@
 	} from 'vuex';
 
 	export default {
-		computed: mapState(['systemInfo','bOldDeviceType']),
+		computed: mapState(['systemInfo', 'bOldDeviceType']),
 		components: {
 
 		},
@@ -444,6 +444,7 @@
 						//发送给game,在game里面处理判断
 						this.listenStateDataOfJump(e);
 					} else if (e.type == 'stop') {
+						console.log("stop");
 						this.onClearData();
 						this.actionJumpObj.resetAll();
 
@@ -470,7 +471,7 @@
 							console.log(e.data);
 						} else if (e.logType == 'error') {
 							console.error(e.data);
-						} else if(e.logType == 'warn'){
+						} else if (e.logType == 'warn') {
 							console.warn(e.data);
 						}
 					}
@@ -956,8 +957,9 @@
 				this.xA = 0;
 				this.yA = 0;
 				this.zA = 0;
-
-				this.actionJumpObj.resetAll();
+				console.log("onClear");
+				if (this.actionJumpObj)
+					this.actionJumpObj.resetAll();
 			},
 
 			/**
@@ -1098,6 +1100,7 @@
 				}
 			},
 			onGameOver(type) {
+				console.log("onGameOver")
 				this.isGameOver = true;
 				//处理参数
 				this.onClear();
@@ -1135,6 +1138,7 @@
 			},
 			//pk模式下结束游戏关卡
 			onPKModeGameOver(type) {
+				console.log("onPKModeGameOver");
 				this.isGameOver = true;
 				//处理参数
 				this.onClear();
@@ -1186,6 +1190,7 @@
 			},
 
 			onActionJumpPlay() {
+				console.log("onActionJumpPlay");
 				this.onClear();
 				this.onClearData();
 				this.startJumpGame();
@@ -1199,11 +1204,12 @@
 				this.faultCount = 0;
 				this.eliminationCount = 0;
 			},
-			
+
 			/**
 			 * 停止并清空数据
 			 */
-			onStopAndClearAction(){
+			onStopAndClearAction() {
+				console.log("onStopAndClearAction");
 				this.onClear();
 				this.onClearData();
 				this.bJumpPlay = false;
@@ -1213,7 +1219,7 @@
 				this.roundingCount = 0;
 				this.faultCount = 0;
 				this.eliminationCount = 0;
-				
+
 				this.jumpCalorie = 0;
 			},
 
@@ -1469,7 +1475,7 @@
 						oGyroZ: gz
 					},
 					//输入当前轴,旧设备使用Y轴,即为true
-					bYAxis: this.bOldDeviceType?true:false,
+					bYAxis: this.bOldDeviceType ? true : false,
 				};
 				this.actionJumpObj.updateJump(_temp);
 				this.BLEAccIndex++;

+ 25 - 25
manifest.json

@@ -2,8 +2,8 @@
     "name" : "哔蹦",
     "appid" : "__UNI__2635DF5",
     "description" : "",
-    "versionName" : "2.5.33",
-    "versionCode" : 22070701,
+    "versionName" : "2.5.35",
+    "versionCode" : 22080802,
     "transformPx" : false,
     /* 5+App特有相关 */
     "app-plus" : {
@@ -83,38 +83,38 @@
                 "androidStyle" : "default",
                 "android" : {
                     "xxhdpi" : "",
-                    "xhdpi" : "/Users/apple/Desktop/splash.png"
+                    "xhdpi" : ""
                 }
             },
             "icons" : {
                 "android" : {
-                    "xhdpi" : "unpackage/res/icons/96x96.png",
-                    "hdpi" : "unpackage/res/icons/72x72.png",
-                    "xxhdpi" : "unpackage/res/icons/144x144.png",
-                    "xxxhdpi" : "unpackage/res/icons/192x192.png"
+                    "xhdpi" : "",
+                    "hdpi" : "",
+                    "xxhdpi" : "",
+                    "xxxhdpi" : ""
                 },
                 "ios" : {
-                    "appstore" : "unpackage/res/icons/1024x1024.png",
+                    "appstore" : "",
                     "ipad" : {
-                        "app" : "unpackage/res/icons/76x76.png",
-                        "app@2x" : "unpackage/res/icons/152x152.png",
-                        "notification" : "unpackage/res/icons/20x20.png",
-                        "notification@2x" : "unpackage/res/icons/40x40.png",
-                        "proapp@2x" : "unpackage/res/icons/167x167.png",
-                        "settings" : "unpackage/res/icons/29x29.png",
-                        "settings@2x" : "unpackage/res/icons/58x58.png",
-                        "spotlight" : "unpackage/res/icons/40x40.png",
-                        "spotlight@2x" : "unpackage/res/icons/80x80.png"
+                        "app" : "",
+                        "app@2x" : "",
+                        "notification" : "",
+                        "notification@2x" : "",
+                        "proapp@2x" : "",
+                        "settings" : "",
+                        "settings@2x" : "",
+                        "spotlight" : "",
+                        "spotlight@2x" : ""
                     },
                     "iphone" : {
-                        "app@2x" : "unpackage/res/icons/120x120.png",
-                        "app@3x" : "unpackage/res/icons/180x180.png",
-                        "notification@2x" : "unpackage/res/icons/40x40.png",
-                        "notification@3x" : "unpackage/res/icons/60x60.png",
-                        "settings@2x" : "unpackage/res/icons/58x58.png",
-                        "settings@3x" : "unpackage/res/icons/87x87.png",
-                        "spotlight@2x" : "unpackage/res/icons/80x80.png",
-                        "spotlight@3x" : "unpackage/res/icons/120x120.png"
+                        "app@2x" : "",
+                        "app@3x" : "",
+                        "notification@2x" : "",
+                        "notification@3x" : "",
+                        "settings@2x" : "",
+                        "settings@3x" : "",
+                        "spotlight@2x" : "",
+                        "spotlight@3x" : ""
                     }
                 }
             }

+ 81 - 70
pages/game-page/game-play-sub/subGame/subGame.nvue

@@ -1,9 +1,9 @@
 <template>
 	<view>
-		<!-- :src="url" src = 'http://192.168.0.112:7456/build/index.html' :src="LocationGameUrl"  :src="'http://' + LocationGameUrl + '/'" -->
-		<!-- @receivedtitle="onReceivedTitle"   @pagefinish="onPageFinish"-->
+		<!-- :src="url" src = 'http://192.168.0.112:7456/build/index.html' :src="LocationGameUrl" -->
+		<!-- @receivedtitle="onReceivedTitle"   @pagefinish="onPageFinish" http://192.168.31.223:7456/-->
 		<view class="web-view">
-			<web-view class="web-view-child" :src="url"  ref="webview" @pagestart="onPageStart"
+			<web-view class="web-view-child" src='http://192.168.1.12:7456/' ref="webview" @pagestart="onPageStart"
 				@onPostMessage="handlePostMessage" @error="onError"></web-view>
 		</view>
 
@@ -164,6 +164,12 @@
 					});
 
 					uni.$off('updateBLEDeviceData', _self.gWatchBLEUpdate);
+					
+					if (0 === _self.currentModeIndex) {
+						//拳击柱
+						_self.uploadUserData_hitCount();
+					} 
+					
 				} //关闭跳绳模式指令
 				else if (_self.BLEConnectDevice && _self.BLEConnectDevice.deviceType == "BLERope") {
 					console.warn("还没设置关闭跳绳模式")
@@ -210,7 +216,7 @@
 			...mapMutations(['addlocalCalorie', 'syncRequestEvent', 'onWriteBLEConnectionValue',
 				'gCreateFilterObj', 'gUpdateFilter', 'B_OpenRopeSkipping', 'B_CloseRopeSkipping',
 				'gStopSimulateBLEUpdate', 'gStartSimulateBLEUpdate', 'gUpdateSandbagAlgorithm',
-				'gCreateSandbagAlgorithm', 'onConvertDeviceData'
+				'gCreateSandbagAlgorithm', 'onConvertDeviceData','addSandbagHitCount','uploadUserData_hitCount'
 			]),
 			navBack() {
 
@@ -307,7 +313,7 @@
 			 * 初始化发送数据给游戏
 			 */
 			sendGameInit() {
-
+				console.log("this.avatarUrl:",this.avatarUrl);
 				this.urlToBase64(this.avatarUrl, (toBase64Url) => {
 					let device = null;
 					/**
@@ -385,6 +391,7 @@
 					return;
 				}
 				let initStr = JSON.stringify(data);
+				// console.log(functionName);
 				this.$refs.webview.evalJs("onWebViewMessage(" + initStr + ")");
 			},
 			sendMessageToWebview() {
@@ -422,7 +429,6 @@
 					// 	score: 1230,
 					// 	cityCode: '110101',
 					// };
-
 					//2. calorieBurned 处理卡路里
 					// 记录卡路里到本地
 					this.addlocalCalorie(gameData.calorieBurned);
@@ -441,6 +447,7 @@
 								bMaxLimit: true
 							}
 							console.log('_temp =====', _temp);
+							
 							reqUtil.requestData(config.URL.UPLOADRANKING, _temp, "POST").then(res => {
 									console.log('UPLOADRANKING =====', res);
 									if (res.code == 0) {
@@ -536,17 +543,8 @@
 					}
 
 				} else if (temp.funName == "openAccelerometer") {
-					//打开加速计s
-					// if (this.globalGameAcc) {
-					// 	uni.$on('watchAcceleration', this.gWatchAcceleration);
-					// } else {
-					// 	AccAndOri.bindAcc((accId) => {
-					// 		this.$store.state.globalGameAcc = accId;
-					// 		console.log("开启的:globalGameAcc=",this.globalGameAcc);
-					// 		uni.$on('watchAcceleration', this.gWatchAcceleration);
-					// 	});
-					// }
 					if (this.globalAcc) {
+						uni.$off('watchAcceleration', this.gWatchAcceleration);
 						uni.$on('watchAcceleration', this.gWatchAcceleration);
 					} else {
 						uni.$emit("bindAcc", {
@@ -554,6 +552,7 @@
 								console.log("开启的:globalAcc=", accId);
 								this.bGameOpenListen = true;
 								this.$store.state.globalAcc = accId;
+								uni.$off('watchAcceleration', this.gWatchAcceleration);
 								uni.$on('watchAcceleration', this.gWatchAcceleration);
 							}
 						});
@@ -568,30 +567,27 @@
 				} else if (temp.funName == "openOrientation") {
 					//打开陀螺仪
 					if (this.globalOri) {
+						uni.$off('watchOrientation', this.gWatchOrientation);
 						uni.$on('watchOrientation', this.gWatchOrientation);
 					} else {
-						// AccAndOri.bindOri((oriId) => {
-						// 	this.$store.state.globalOri = oriId;
-						// 	uni.$on('watchOrientation', this.gWatchOrientation);
-						// });
 						uni.$emit("bindOri", {
 							callback: (oriId) => {
 								console.log("开启的:globalOri=", oriId);
 								this.bGameOpenListen = true;
 								this.$store.state.globalOri = oriId;
+								uni.$off('watchOrientation', this.gWatchOrientation);
 								uni.$on('watchOrientation', this.gWatchOrientation);
 							}
 						});
 					}
 				} else if (temp.funName == "closeOrientation") {
-
-					// uni.$off('watchOrientation', this.gWatchOrientation);
 					uni.$off('watchOrientation', this.gWatchOrientation);
 					uni.$emit("unBindOri", this.globalOri);
 					this.$store.state.globalOri = null;
 
 				} else if (temp.funName == "bindBoxingPost") {
 					if (this.globalAcc) {
+						uni.$off('watchAcceleration', this.gWatchBoxingAcc);
 						uni.$on('watchAcceleration', this.gWatchBoxingAcc);
 					} else {
 						uni.$emit("bindAcc", {
@@ -599,12 +595,12 @@
 								console.log("bindBoxingPost开启的:globalAcc=", accId);
 								this.bGameOpenListen = true;
 								this.$store.state.globalAcc = accId;
+								uni.$off('watchAcceleration', this.gWatchBoxingAcc);
 								uni.$on('watchAcceleration', this.gWatchBoxingAcc);
 							}
 						});
 					}
 				} else if (temp.funName == "unbindBoxingPost") {
-
 					uni.$off('watchAcceleration', this.gWatchBoxingAcc);
 					uni.$emit("unBindAcc", this.globalAcc);
 					this.$store.state.globalAcc = null;
@@ -618,15 +614,18 @@
 						});
 					}
 				} else if (temp.funName == "bindHitBoxingPost") {
+					/**
+					 * 返回拳击柱的绑定状态
+					 */
 					console.log("bindHitBoxingPost");
-
-					// if (this.ConnectBindingDevice) {
-					// 	uni.$on('updateBLEDeviceData', this.gWatchBLEUpdate);
-					// 	//hotman 沙袋情景
-					// 	this.gCreateSandbagAlgorithm();
-					// 	this.gStartSimulateBLEUpdate();
-					// 	return;
-					// }
+					if (this.ConnectBindingDevice) {
+						uni.$off('updateBLEDeviceData', this.gWatchBLEUpdate);
+						uni.$on('updateBLEDeviceData', this.gWatchBLEUpdate);
+						//hotman 沙袋情景
+						this.gCreateSandbagAlgorithm();
+						this.gStartSimulateBLEUpdate();
+						return;
+					}
 
 					if (!this.BLEConnectDevice) return;
 					//用设备来区分,开启什么加速计;
@@ -636,14 +635,14 @@
 						this.onWriteBLEConnectionValue({
 							value: "3"
 						});
-						setTimeout(() => {
-							//设置加速计b:20ms a:10ms
-							this.onWriteBLEConnectionValue({
-								value: config.refreshRate
-							});
-
-						}, 2000)
+						// setTimeout(() => {
+						// 	//设置加速计b:20ms a:10ms
+						// 	this.onWriteBLEConnectionValue({
+						// 		value: config.refreshRate
+						// 	});
 
+						// }, 2000)
+						uni.$off('updateBLEDeviceData', this.gWatchBLEUpdate);
 						uni.$on('updateBLEDeviceData', this.gWatchBLEUpdate);
 
 						if (this.BLEConnectDevice.usageMode == "phone" || this.BLEConnectDevice.usageMode ==
@@ -658,6 +657,7 @@
 					} else if (this.BLEConnectDevice.deviceType == "mySelf") {
 						//处理手机本身情况下
 						if (this.globalAcc) {
+							uni.$off('watchAcceleration', this.gWatchHitBoxingAcc);
 							uni.$on('watchAcceleration', this.gWatchHitBoxingAcc);
 						} else {
 							//开启手机加速计
@@ -666,6 +666,7 @@
 									console.log("bindHitBoxingPost开启的:globalAcc=", accId);
 									this.bGameOpenListen = true;
 									this.$store.state.globalAcc = accId;
+									uni.$off('watchAcceleration', this.gWatchHitBoxingAcc);
 									uni.$on('watchAcceleration', this.gWatchHitBoxingAcc);
 									if (this.BLEConnectDevice.usageMode == "phone" || this.BLEConnectDevice
 										.usageMode == "general") {
@@ -684,17 +685,20 @@
 						this.B_OpenRopeSkipping();
 						this._createActionJumpOnBoxingPostHit();
 						//监听蓝牙回调
+						uni.$off('updateBLEDeviceData', this.gWatchBLEUpdate);
 						uni.$on('updateBLEDeviceData', this.gWatchBLEUpdate);
 					}
 
 
 				} else if (temp.funName == "unbindHitBoxingPost") {
-
-					// if (this.ConnectBindingDevice) {
-					// 	uni.$off('updateBLEDeviceData', this.gWatchBLEUpdate);
-					// 	this.gStopSimulateBLEUpdate();
-					// 	return;
-					// }
+					/**
+					 * 解绑拳击柱的绑定状态
+					 */
+					if (this.ConnectBindingDevice) {
+						uni.$off('updateBLEDeviceData', this.gWatchBLEUpdate);
+						this.gStopSimulateBLEUpdate();
+						return;
+					}
 
 					if (this.BLEConnectDevice && this.BLEConnectDevice.deviceType == "BLEHandle") {
 						//开启设备回调 3/4关闭
@@ -733,10 +737,12 @@
 				} else if (temp.funName == "log") {
 					console.log(gameData);
 				} else if (temp.funName == "addDeviceUpdateListener") {
+					uni.$off('updateBLEDeviceData', this.BLECallback);
 					uni.$on('updateBLEDeviceData', this.BLECallback);
 				} else if (temp.funName == "closeDeviceUpdateListener") {
 					uni.$off('updateBLEDeviceData', this.BLECallback);
 				} else if (temp.funName == "addDeviceJsonUpdateListener") {
+					uni.$off('updateBLEDeviceJson', this.BLEJsonCallback);
 					uni.$on('updateBLEDeviceJson', this.BLEJsonCallback);
 				} else if (temp.funName == "closeDeviceJsonUpdateListener") {
 					uni.$off('updateBLEDeviceJson', this.BLEJsonCallback);
@@ -746,6 +752,7 @@
 					this.bMyAttitudeListen = true;
 					this.gStartSimulateBLEUpdate();
 					//监听蓝牙回调
+					uni.$off('updateBLEDeviceData', this.gWatchBLEUpdate);
 					uni.$on('updateBLEDeviceData', this.gWatchBLEUpdate);
 				} else if (temp.funName == "onStopAccAndGyro") {
 					this.bMyAttitudeListen = false;
@@ -832,30 +839,31 @@
 					return;
 				}
 
-				// if (this.ConnectBindingDevice) {
-				// 	//hotman 沙袋情景 todo
-				// 	this.gUpdateSandbagAlgorithm({
-				// 		data: data,
-				// 		callback: (res) => {
-				// 			// console.log(res);
-				// 			if (res.type == 'hit') {
-				// 				// console.log('gUpdateFilter callback:',res)
-
-				// 				let temp = {
-				// 					direction: res.direction,
-				// 					angle: res.angle,
-				// 					name: res.name,
-				// 					ename: res.ename,
-				// 					value: res.hit,
-				// 					mass: 10, //质量
-				// 					hitPower: res.hit //计算的力
-				// 				}
-				// 				this.sendMessage("onBoxingPostHit", temp);
-				// 			}
-				// 		}
-				// 	});
-				// 	return;
-				// }
+				if (this.ConnectBindingDevice) {
+					//hotman 沙袋情景 todo
+					this.gUpdateSandbagAlgorithm({
+						data: data,
+						callback: (res) => {
+							// console.log(res);
+							if (res.type == 'hit') {
+								// console.log('gUpdateFilter callback:',res)
+								//记录打击次数
+								this.addSandbagHitCount({count:1});
+								let temp = {
+									direction: res.direction,
+									angle: res.angle,
+									name: res.name,
+									ename: res.ename,
+									value: res.hit,
+									mass: 10, //质量
+									hitPower: res.hit //计算的力
+								}
+								this.sendMessage("onBoxingPostHit", temp);
+							}
+						}
+					});
+					return;
+				}
 
 				if (this.BLEConnectDevice.usageMode == "phone" || this.BLEConnectDevice.usageMode == "general") {
 					//手机情景或者自由模式
@@ -899,6 +907,9 @@
 						callback: (res) => {
 							// console.log(res);
 							if (res.type == 'hit') {
+								// console.log('gUpdateFilter callback:',res)
+								//记录打击次数
+								this.addSandbagHitCount({count:1});
 								let temp = {
 									direction: res.direction,
 									angle: res.angle,
@@ -1046,10 +1057,10 @@
 						hitPower: 10 //计算的力
 					}
 					if (e.type == 'stateDataOfJump') {
-						console.log("game stateDataOfJump");
+						// console.log("game stateDataOfJump");
 						this.sendMessage("onBoxingPostHit", temp);
 					} else if (e.type == 'stop') {
-						console.log("game stop");
+						// console.log("game stop");
 						this.onClearData();
 						// this.sendMessage("onBoxingPostHit", temp);
 					}

+ 12 - 0
pages/personal-page/devices-hardware/devices-hardware.vue

@@ -440,6 +440,18 @@
 					},
 					e => {
 						console.log(e);
+						uni.hideToast();
+						uni.showModal({
+							title: '连接失败',
+							content: '验证错误,请重新连接设备。'
+						})
+						//关闭当前连接
+						_self.onOnlyCloseBLEConnection({
+							getSuccess: () => {
+								_self.currentItem = null;
+								_self.saveObj = null;
+							}
+						});
 					}
 				);
 			},

+ 49 - 15
pages/personal-page/personal/personal.vue

@@ -38,6 +38,17 @@
 					<!-- 计划显示 区域 topScrollHight :style="{ height: + '100%' }"-->
 					<scroll-view scroll-y="true" style="height: 100%; width: 100%;">
 						<view class="plan-view">
+							<view class="text-white text-center" style="background-color: RGBA(30, 30, 85, 1);  z-index: 10;">今日击打次数:{{sandbagHitCount}}</view>
+							
+							<!-- #ifdef H5 -->
+							<button @click="onAddSandbagHitCount()">add</button>
+							<button @click="onReset()">onReset</button>
+							<button @click="getUserData_hitCount()">getUserData_hitCount</button>
+							<button @click="uploadUserData_hitCount()">uploadUserData_hitCount</button>
+							
+							<!-- #endif -->
+							
+							
 							<!-- pk模式下的跳绳 v-if="1 === currentModeIndex"-->
 							<view v-if="currentMode == 'pkMode'" class="position-relative"
 								style="height: 128rpx; background-color: RGBA(30, 30, 85, 1);  z-index: 10;">
@@ -178,14 +189,8 @@
 												hiddenType: 'firstInstallation'
 											})">计划</button>
 			</view> -->
-			<!-- <view class="example">
-				<view class="text-white">1.连接设备 。</view>
-				<view class="text-white">2.输入cocos本地ip地址,切换到游戏列表点击开始游戏。</view>
-				<view class="text-white">游戏地址::http://{{LocationGameUrl}}/build/index.html</view>
-			</view>
-			<input class="bg-white" @input="onKeyInput" :value="LocationGameUrl"/>
-			<view style="height: 550rpx;"></view> -->
 			
+			<view style="height: 50rpx;"></view>
 		</scroll-view>
 
 		<!-- 底部中间上滑按钮 -->
@@ -542,7 +547,8 @@
 			'cDiamond', 'cGold',
 			'finallySelectFriendInfo',
 			'currentJumpTask', 'singlePersonList', 'multiPersonList',
-			'guideUnlockState'
+			'guideUnlockState',
+			'sandbagHitCount'
 		]),
 		components: {
 			// uniNavBar,
@@ -868,6 +874,9 @@
 			uni.$on("onLog", this.onLog);
 			//人物列表变化处理监听
 			uni.$on("onSwitchTaskList", this.onSwitchTaskList);
+			
+			//获取对应的用户数据,并且设置记录的打击数据
+			this.getUserData_hitCount();
 		},
 		onShow() {
 			_self.bHide = false;
@@ -932,9 +941,6 @@
 				uni.$emit("onShowFirstInstallation");
 			}
 			// #endif
-			
-			//读取一个本地ip记录
-			this.onGetLocationGameUrl();
 		},
 		onReady() {
 			//限制开始点击播放
@@ -1013,7 +1019,9 @@
 				'getSignInList', 'onUserSignIn',
 				'setGuideUnlockState',
 				'resetActionJumpTask',
-				'onSetLocationGameUrl','onGetLocationGameUrl'
+				'getUserData_hitCount',
+				'uploadUserData_hitCount','getUserData_hitCount',
+				'addSandbagHitCount',
 			]),
 			BasicsSteps() {
 				this.basics = this.basics == this.basicsList.length - 1 ? 0 : this.basics + 1
@@ -2448,7 +2456,7 @@
 			},
 
 			onKeyInput: function(event) {
-				this.onSetLocationGameUrl(event.target.value);
+				this.$store.state.LocationGameUrl = event.target.value
 			},
 			onNavFcGame() {
 				// console.log(0);
@@ -2512,6 +2520,14 @@
 						this.AJData.otherScore = obj.eliminationCount - obj.faultCount;
 					}
 				}
+				//调用
+				if (0 === this.currentModeIndex) {
+					//拳击柱
+					this.onAddSandbagHitCount();
+				} 
+				// else if (1 === this.currentModeIndex) {
+				// 	//跳
+				// }
 				// console.log(this.AJData.myUsageTime, this.AJData.otherUsageTime);
 
 			},
@@ -2575,6 +2591,10 @@
 				})
 				// console.log('onSetActionJumpData'+JSON.stringify(this.AJData)+JSON.stringify(_item));
 			},
+			/**
+			 * 游戏结束
+			 * @param {Object} data
+			 */
 			onActionJumpGameOver(data) {
 				let {
 					isOffEvent = false
@@ -2588,6 +2608,12 @@
 					console.log('onActionJumpGameOver 任务结束');
 
 					this.bGamePlaying = false;
+					
+					//同步到数据库
+					if (0 === this.currentModeIndex) {
+						//拳击柱
+						this.uploadUserData_hitCount();
+					} 
 				}
 
 
@@ -2841,10 +2867,10 @@
 					if (0 === this.currentModeIndex) {
 						this.$refs.actionHitRef.onStopAndClearAction(true);
 						//用于刷新 drawBg
-						this.$refs.actionHitRef.onDrawBg(true);
+						// this.$refs.actionHitRef.onDrawBg(true);
 					} else if (1 === this.currentModeIndex) {
 						this.$refs.actionJumpRef.onStopAndClearAction(true);
-						this.$refs.actionJumpRef.onDrawBg(true);
+						// this.$refs.actionJumpRef.onDrawBg(true);
 					}
 				})
 
@@ -3157,6 +3183,14 @@
 					firstInstallation: false
 				});
 				this.setGuideUnlockState(guideUnlockState);
+			},
+			
+			
+			onAddSandbagHitCount(){
+				this.addSandbagHitCount({count:1});
+			},
+			onReset(){
+				this.$store.state.sandbagHitCount = 0;
 			}
 		}
 	};

BIN
static/modal/boxing-post/left-hook-h@2x.png


BIN
static/modal/boxing-post/left-hook-m@2x.png


BIN
static/modal/boxing-post/right-hook-h@2x.png


BIN
static/modal/boxing-post/right-hook-m@2x.png


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

@@ -112,7 +112,7 @@ ActionJump.prototype.updateJump = function() {
 		bYAxis
 	} = data;
 	//oGyroX 在用的过程中方向相反,所以添加负号
-	let _tempAxisData = bYAxis ? oGyroY : -oGyroX;
+	let _tempAxisData = bYAxis ? oGyroY : -oGyroY;//-oGyroX; 直接解析数据时候,调整
 	this.detectorNewStep(data.resultant, lAccX, lAccY, lAccZ, oAccX, oAccY, oAccZ, data.runIndex, _tempAxisData);
 };
 
@@ -219,7 +219,7 @@ ActionJump.prototype.detectorNewStep = function(resultant, linearX, linearY, lin
 						_frameMaxValue += this.frame[i].maxValue;
 						_frameGyroValue += this.frame[i].gyroValue;
 					}
-					console.log("frame:" + _frameMaxValue + " == " + _frameGyroValue);
+					// console.log("frame:" + _frameMaxValue + " == " + _frameGyroValue);
 
 					//后面通用使用这个类型传输数据
 					this.event.trigger('resultant', {

+ 22 - 35
util/util-js/o0ProjectRelease0.1.js

@@ -127,18 +127,17 @@ module.exports = {
 			newFrame.shakeSlope = Math.max(newFrame.shakeFixed - lastFrame.shakeFixed, 0);
 			///////////////////////////////////////////////////////////////
 
-			// (newFrame.accSlope >= 15 || lastFrame.accSlope >= 20) &&
-			// (newFrame.shakeSlope >= 20 || lastFrame.shakeSlope >= 40)
-			
 			var direction = undefined;
-			let _threshold = [15,20,20,40];//判定的阈值
+
+			//15 20 20 40 , 13 17 17 35
+			let slopeArr = [15, 20, 20, 40];
 			if (lastFrame.hit == 0 &&
 				last2Frame.hit == 0 &&
 				last3Frame.hit == 0 &&
 				last4Frame.hit == 0 &&
 				last5Frame.hit == 0 &&
-				(newFrame.accSlope >= _threshold[0] || lastFrame.accSlope >= _threshold[1]) &&
-				(newFrame.shakeSlope >= _threshold[2] || lastFrame.shakeSlope >= _threshold[3])) {
+				(newFrame.accSlope >= slopeArr[0] || lastFrame.accSlope >= slopeArr[1]) &&
+				(newFrame.shakeSlope >= slopeArr[2] || lastFrame.shakeSlope >= slopeArr[3])) {
 				newFrame.hit = 1;
 				if (this.frameHit.length < this.frameHitCapacity && this.frameHit.length !=
 					0) { //判断到第二次hit,但还未输出第一次hit的方向,强制输出方向
@@ -189,47 +188,38 @@ module.exports = {
 			let directionPunch = "all",
 				name = "击中",
 				ename = "hit";
-
-			//min , max
-			let pLeftBetween = [105, 180];
-			let pStraightBetween = [75, 105];
-			let pRightBetween = [0, 75];
-
-			if (curAngle >= pStraightBetween[0] && curAngle < pStraightBetween[1]) {
+			let positiveMidSlope = [72.5,107.5];//min max
+			let negativeMidSlope = [252.5,287.5];//min max
+			if (curAngle < positiveMidSlope[1] && curAngle >= positiveMidSlope[0]) {
 				directionPunch = "straightPunch";
 				name = "正向的直拳";
 				ename = "front-straight";
-			} else if (curAngle >= pRightBetween[0] && curAngle < pRightBetween[1]) {
+			} else if (curAngle < positiveMidSlope[0] && curAngle >= 0) {
 				directionPunch = "rightPunch";
 				name = "正向的右拳";
 				ename = "front-right";
-			} else if (curAngle >= pLeftBetween[0] && curAngle <= pLeftBetween[1]) {
+			} else if (curAngle <= 180 && curAngle >= positiveMidSlope[1]) {
 				directionPunch = "leftPunch";
 				name = "正向的左拳";
 				ename = "front-left";
 			}
 			//相反方向击打
 			//正方向
-			else {
-				let mAngle = curAngle - 180;
-
-				if (mAngle > pRightBetween[0] && mAngle <= pRightBetween[1]) {
-					directionPunch = "rightPunch";
-					name = "负向的右拳";
-					ename = "back-right";
-				} else if (mAngle > pStraightBetween[0] && mAngle <= pStraightBetween[1]) {
-					directionPunch = "straightPunch";
-					name = "负向的直拳";
-					ename = "back-straight";
-				} else if (mAngle > pLeftBetween[0] && mAngle <= pLeftBetween[1]) {
-					directionPunch = "leftPunch";
-					name = "负向的左拳";
-					ename = "back-left";
-				}
+			else if (curAngle <= negativeMidSlope[1] && curAngle > negativeMidSlope[0]) {
+				directionPunch = "straightPunch";
+				name = "负向的直拳";
+				ename = "back-straight";
+			} else if (curAngle <= negativeMidSlope[0] && curAngle > 180) {
+				directionPunch = "rightPunch";
+				name = "负向的右拳";
+				ename = "back-right";
+			} else if (curAngle <= 360 && curAngle > negativeMidSlope[1]) {
+				directionPunch = "leftPunch";
+				name = "负向的左拳";
+				ename = "back-left";
 			}
 
 
-
 			this.quitHitCount++;
 
 			let temp = {
@@ -245,9 +235,6 @@ module.exports = {
 				name: name,
 				ename: ename
 			}
-
-			console.log("hit:" + JSON.stringify(temp));
-
 			return temp;
 
 		}

+ 106 - 36
util/util-js/store.js

@@ -320,7 +320,7 @@ const store = new Vuex.Store({
 		//本地游戏地址
 		// http://192.168.0.112:7456/build/index.html
 		// http://127.0.0.1:7456/build/index.html
-		LocationGameUrl: "192.168.0.109:7456",
+		LocationGameUrl: "http://110.43.54.43/t8/",
 
 		//快速打击对象
 		filter: null,
@@ -330,6 +330,9 @@ const store = new Vuex.Store({
 		sandbagAlgorithm: null,
 		sandbagAlgorithmLastTime: new Date().getTime(),
 
+		//记录一个沙包打击数量
+		sandbagHitCount: 0,
+		netSandbagHitCount: 0,
 
 		/**
 		 * 蓝牙参数对象
@@ -433,19 +436,6 @@ const store = new Vuex.Store({
 
 	},
 	mutations: {
-
-		onSetLocationGameUrl(state, value) {
-			uni.setStorageSync('LocationGameUrl', value);
-			state.LocationGameUrl = value;
-		},
-		//获取本地任务对象
-		onGetLocationGameUrl(state) {
-			//如果存在本地任务
-			const value = uni.getStorageSync('LocationGameUrl');
-			if (value) {
-				state.LocationGameUrl = value;
-			}
-		},
 		/**
 		 * 蓝牙解析后的数据,转化成对应的坐标系方向
 		 * @param {Object} context
@@ -2077,7 +2067,7 @@ const store = new Vuex.Store({
 				gy,
 				gz
 			} = data.gyro;
-
+			// console.log(ax);
 			state.filter.Update(new o0.Vector3(ax, ay, az), msGap, new o0.Vector3(gx, gy, gz),
 				callback); //我自己的更新acc的函数
 		},
@@ -2088,7 +2078,6 @@ const store = new Vuex.Store({
 		 */
 		gCreateSandbagAlgorithm(state) {
 			state.sandbagAlgorithm = null;
-			state.deviceMs = 1;
 			state.sandbagAlgorithmLastTime = new Date().getTime();
 			state.sandbagAlgorithm = new o0ProjectRelease.SandbagAlgorithm();
 			console.log("gCreateSandbagAlgorithm");
@@ -2104,18 +2093,7 @@ const store = new Vuex.Store({
 				data,
 				callback = null
 			} = context;
-			
-			let {
-				min,
-				s,
-				ms
-			} = data;
-			let msGap = ms - state.deviceMs;
-			state.deviceMs = ms;
-			while (msGap < 0) {
-				msGap += 1000;
-			}
-			
+
 			let {
 				ax,
 				ay,
@@ -2127,15 +2105,17 @@ const store = new Vuex.Store({
 				gy,
 				gz
 			} = data.gyro;
-
 			// ax / 10, az / 10, gz, -gx, data.ms ----- old
 			// ay / 10, -az / 10, gy, gz, data.ms
-			let [hit, dir] = state.sandbagAlgorithm.Update(ay, -az, gz, gy, msGap);
+			// let [hit, dir] = state.sandbagAlgorithm.Update(-ay, az, -gz, -gy, data.ms);
+			let [hit, dir] = state.sandbagAlgorithm.Update(ax, az, gz, -gx, data.ms);
 			if (dir != undefined) {
 				let temp = state.sandbagAlgorithm.getTempValue(dir);
 				if (callback) {
 					callback(temp);
 				}
+
+				// let hitCount = temp.hitCount;
 			}
 		},
 
@@ -2740,16 +2720,27 @@ const store = new Vuex.Store({
 					let min = BLE.hex2int(resValue.substr(32, 2));
 					//秒
 					let s = BLE.hex2int(resValue.substr(34, 2));
+
+
+
+					// ax / 10, az / 10, gz, -gx, data.ms ----- old
+					// let [hit, dir] = state.sandbagAlgorithm.Update(-ay, az, -gz, -gy, data.ms);
+
 					box["handle"] = BLE.hexToString(handle);
 					box["acc"] = {
-						ax,
-						ay,
-						az
+						ax: -ay,
+						ay: -ax,
+						az: az
 					};
+					// box["acc"] = {
+					// 	-ay,
+					// 	-ax, //ay,
+					// 	az
+					// };
 					box["gyro"] = {
-						gx,
-						gy,
-						gz
+						gx: gy,
+						gy: gx,
+						gz: -gz
 					};
 
 					box["min"] = min;
@@ -3644,6 +3635,85 @@ const store = new Vuex.Store({
 				lists: lists,
 				isSignIn: state.isSignIn
 			});
+		},
+		/**
+		 * 记录沙袋打击计数
+		 * @param {Object} state
+		 * @param {Object} count
+		 */
+		setSandbagHitCount(state, count) {
+			// uni.setStorageSync('sandbagHitCount', count);
+			state.sandbagHitCount = count;
+		},
+		addSandbagHitCount(state, context) {
+			let {
+				count
+			} = context;
+			let addCount = Number(state.sandbagHitCount) + Number(count);
+			// console.log("addCount:" + addCount);
+			state.sandbagHitCount = addCount;
+			uni.setStorageSync('sandbagHitCount', state.sandbagHitCount);
+		},
+		getSandbagHitCount(state) {
+			const value = uni.getStorageSync('sandbagHitCount');
+			if (value) {
+				state.sandbagHitCount = value;
+			} else {
+				state.sandbagHitCount = 0;
+			}
+		},
+		/**
+		 * 获取用户等hitcount数据
+		 * 同步沙袋计数
+		 * @param {Object} state
+		 */
+		getUserData_hitCount(state) {
+			//获取本地数据
+			this.commit("getSandbagHitCount");
+			reqUtil
+				.requestData(config.URL.USERDATA_GETHITCOUNT, {}, 'POST')
+				.then(
+					res => {
+						console.log('USERDATA_GETHITCOUNT:' + JSON.stringify(res));
+						if (res.code == 0) {
+							if (res.data.isReset) {
+								this.commit("setSandbagHitCount", 0);
+							} else {
+								if (res.data.hitCount > state.sandbagHitCount) {
+									this.commit("setSandbagHitCount", res.data.hitCount);
+									state.netSandbagHitCount = res.data.hitCount;
+								} else if (res.data.hitCount < state.sandbagHitCount) {
+									//获取时候,小于本地记录的,则同步到网络
+									this.commit("uploadUserData_hitCount");
+								}
+							}
+
+						}
+					},
+					e => {
+						console.log(e);
+					}
+				);
+		},
+		uploadUserData_hitCount(state) {
+			//如果拳击数没变化,则不用上传
+			if (state.netSandbagHitCount == state.sandbagHitCount) return;
+			reqUtil
+				.requestData(config.URL.USERDATA_UPLOADHITCOUNT, {
+					hitCount: state.sandbagHitCount
+				}, 'POST')
+				.then(
+					res => {
+						console.log('USERDATA_UPLOADHITCOUNT:' + JSON.stringify(res));
+						if (res.code == 0) {
+							this.commit("setSandbagHitCount", res.data.hitCount)
+							state.netSandbagHitCount = res.data.hitCount;
+						}
+					},
+					e => {
+						console.log(e);
+					}
+				);
 		}
 
 	}