slambb 3 gadi atpakaļ
vecāks
revīzija
4ec8817373

+ 17 - 4
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.0.109:9090/api_dev"
+const host = "http://192.168.1.10: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"
@@ -112,6 +112,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 +134,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>
@@ -1282,7 +1283,7 @@
 				} else if (gameData.direction == "rightPunch") {
 					this.eliminateJumpPrefab(2);
 				}
-
+			
 				this.BLEAccIndex++;
 			},
 			onClearData() {

+ 25 - 25
manifest.json

@@ -2,8 +2,8 @@
     "name" : "哔蹦",
     "appid" : "__UNI__2635DF5",
     "description" : "",
-    "versionName" : "2.5.25",
-    "versionCode" : 22052201,
+    "versionName" : "2.5.34",
+    "versionCode" : 22080502,
     "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" : ""
                     }
                 }
             }

+ 63 - 33
pages/game-page/game-play-sub/subGame/subGame.nvue

@@ -1,7 +1,7 @@
 <template>
 	<view>
 		<!-- :src="url" src = 'http://192.168.0.112:7456/build/index.html' :src="LocationGameUrl" -->
-		<!-- @receivedtitle="onReceivedTitle"   @pagefinish="onPageFinish"-->
+		<!-- @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"
 				@onPostMessage="handlePostMessage" @error="onError"></web-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() {
 
@@ -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,9 +614,12 @@
 						});
 					}
 				} else if (temp.funName == "bindHitBoxingPost") {
+					/**
+					 * 返回拳击柱的绑定状态
+					 */
 					console.log("bindHitBoxingPost");
-
 					if (this.ConnectBindingDevice) {
+						uni.$off('updateBLEDeviceData', this.gWatchBLEUpdate);
 						uni.$on('updateBLEDeviceData', this.gWatchBLEUpdate);
 						//hotman 沙袋情景
 						this.gCreateSandbagAlgorithm();
@@ -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 ==
@@ -652,11 +651,13 @@
 							this._createEquipmentBasedOnBoxingPostHit();
 						} else if (this.BLEConnectDevice.usageMode == "hotman") {
 							//hotman 沙袋情景  
-							this.gCreateFilterObj();
+							// this.gCreateFilterObj();
+							this.gCreateSandbagAlgorithm();
 						}
 					} else if (this.BLEConnectDevice.deviceType == "mySelf") {
 						//处理手机本身情况下
 						if (this.globalAcc) {
+							uni.$off('watchAcceleration', this.gWatchHitBoxingAcc);
 							uni.$on('watchAcceleration', this.gWatchHitBoxingAcc);
 						} else {
 							//开启手机加速计
@@ -665,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") {
@@ -683,12 +685,15 @@
 						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();
@@ -732,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);
@@ -745,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;
@@ -839,7 +847,8 @@
 							// console.log(res);
 							if (res.type == 'hit') {
 								// console.log('gUpdateFilter callback:',res)
-
+								//记录打击次数
+								this.addSandbagHitCount({count:1});
 								let temp = {
 									direction: res.direction,
 									angle: res.angle,
@@ -873,13 +882,34 @@
 					})
 				} else if (this.BLEConnectDevice.usageMode == "hotman") {
 					//hotman 沙袋情景 todo
-					this.gUpdateFilter({
+					// this.gUpdateFilter({
+					// 	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);
+					// 		}
+					// 	}
+					// });
+					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,

+ 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;
+							}
+						});
 					}
 				);
 			},

+ 47 - 3
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,7 +189,7 @@
 												hiddenType: 'firstInstallation'
 											})">计划</button>
 			</view> -->
-
+			
 			<view style="height: 50rpx;"></view>
 		</scroll-view>
 
@@ -536,7 +547,8 @@
 			'cDiamond', 'cGold',
 			'finallySelectFriendInfo',
 			'currentJumpTask', 'singlePersonList', 'multiPersonList',
-			'guideUnlockState'
+			'guideUnlockState',
+			'sandbagHitCount'
 		]),
 		components: {
 			// uniNavBar,
@@ -862,6 +874,9 @@
 			uni.$on("onLog", this.onLog);
 			//人物列表变化处理监听
 			uni.$on("onSwitchTaskList", this.onSwitchTaskList);
+			
+			//获取对应的用户数据,并且设置记录的打击数据
+			this.getUserData_hitCount();
 		},
 		onShow() {
 			_self.bHide = false;
@@ -1003,7 +1018,10 @@
 				'closeDrawerById', 'closePopupById', 'closeGuideById',
 				'getSignInList', 'onUserSignIn',
 				'setGuideUnlockState',
-				'resetActionJumpTask'
+				'resetActionJumpTask',
+				'getUserData_hitCount',
+				'uploadUserData_hitCount','getUserData_hitCount',
+				'addSandbagHitCount',
 			]),
 			BasicsSteps() {
 				this.basics = this.basics == this.basicsList.length - 1 ? 0 : this.basics + 1
@@ -2502,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);
 
 			},
@@ -2565,6 +2591,10 @@
 				})
 				// console.log('onSetActionJumpData'+JSON.stringify(this.AJData)+JSON.stringify(_item));
 			},
+			/**
+			 * 游戏结束
+			 * @param {Object} data
+			 */
 			onActionJumpGameOver(data) {
 				let {
 					isOffEvent = false
@@ -2578,6 +2608,12 @@
 					console.log('onActionJumpGameOver 任务结束');
 
 					this.bGamePlaying = false;
+					
+					//同步到数据库
+					if (0 === this.currentModeIndex) {
+						//拳击柱
+						this.uploadUserData_hitCount();
+					} 
 				}
 
 
@@ -3147,6 +3183,14 @@
 					firstInstallation: false
 				});
 				this.setGuideUnlockState(guideUnlockState);
+			},
+			
+			
+			onAddSandbagHitCount(){
+				this.addSandbagHitCount({count:1});
+			},
+			onReset(){
+				this.$store.state.sandbagHitCount = 0;
 			}
 		}
 	};

+ 88 - 4
util/util-js/store.js

@@ -284,7 +284,7 @@ const store = new Vuex.Store({
 		 * 比如拳击模块体验下,设置 0
 		 * 跳绳为主的模式体验下,设置 1
 		 */
-		currentModeIndex: 1,
+		currentModeIndex: 0,
 
 		//蓝牙变量操作
 		/**
@@ -330,6 +330,9 @@ const store = new Vuex.Store({
 		sandbagAlgorithm: null,
 		sandbagAlgorithmLastTime: new Date().getTime(),
 
+		//记录一个沙包打击数量
+		sandbagHitCount: 0,
+		netSandbagHitCount: 0,
 
 		/**
 		 * 蓝牙参数对象
@@ -2064,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的函数
 		},
@@ -2104,12 +2107,14 @@ const store = new Vuex.Store({
 			} = 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, data.ms );
+			let [hit, dir] = state.sandbagAlgorithm.Update(-ay, az, -gz, -gy, data.ms);
 			if (dir != undefined) {
 				let temp = state.sandbagAlgorithm.getTempValue(dir);
 				if (callback) {
 					callback(temp);
 				}
+
+				// let hitCount = temp.hitCount;
 			}
 		},
 
@@ -3338,7 +3343,7 @@ const store = new Vuex.Store({
 				state.singlePersonList = state.levels.singlePersonMap[_levelType - 1];
 			else
 				state.singlePersonList = [];
-				
+
 			if (state.levels.multiPersonMap && state.levels.multiPersonMap.length >= _levelType)
 				state.multiPersonList = state.levels.multiPersonMap[_levelType - 1];
 			else
@@ -3618,6 +3623,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);
+					}
+				);
 		}
 
 	}