Browse Source

修复跳的功能,修改签到

slambb 4 years ago
parent
commit
605064e54a

+ 7 - 0
common/config.js

@@ -86,6 +86,13 @@ const URL = {
 	ADDFIRENDINFO: `${host}/user_info/friend_add`,
 	DELETEFIRENDINFO: `${host}/user_info/friend_delete`,
 	GETFRIENDLIST: `${host}/user_info/get_friend_list`,
+	
+	/**
+	 * 20210902
+	 * 用户签到相关部分
+	 */
+	GETSIGNINLIST: `${host}/user_info/get_sign_in_list`,
+	USERSIGNIN: `${host}/user_info/user_sign_in`,
 
 	//游戏页面部分
 	//获取全部游戏

+ 119 - 61
components/modal/action-jump/action-jump.vue

@@ -253,7 +253,16 @@
 				//pk模式下操作
 				leftShowCurCount: 0,
 				rightShowCurCount: 0,
-				isleftPlayer: true
+				isleftPlayer: true,
+
+				/**
+				 * 是否允许绘制
+				 */
+				canOnDraw: false,
+				/**
+				 * 是否去到下一个关卡
+				 */
+				canGoNext: false
 			}
 		},
 		watch: {
@@ -296,6 +305,7 @@
 			...mapMutations(['onWriteBLEConnectionValue', 'onConvertDeviceData']),
 			onListenActionJump() {
 				let _self = this;
+				console.log("*****************onListenActionJump*****************************");
 				_self.actionJumpObj = new ActionJump();
 				_self.actionJumpObj.addEventListener('resultant', (e) => {
 					if (e.type == 'jump') {
@@ -306,7 +316,17 @@
 						this.listenStateDataOfJump(e);
 					} else if (e.type == 'stop') {
 						this.onClearData();
+						this.actionJumpObj.resetAll();
+						if (this.canOnDraw) {
+							this.canOnDraw = false;
+							this.onDraw("tipHit");
+						}
+						if (this.canGoNext) {
+							this.canGoNext = false;
+							this.startJumpGame();
+						}
 						// console.log('stop');
+						//这里处理生成下一个
 					}
 				})
 			},
@@ -486,7 +506,7 @@
 				// 	this.setCountdown(1);
 				// }, 1000);
 
-				this.onDraw();
+				this.onDraw("tipHit");
 			},
 			spawnJumpPrefabsFromType(index, _jumpType) {
 
@@ -561,7 +581,7 @@
 				}
 				this.actionJumpCanvas.draw();
 			},
-			onDraw() {
+			onDraw(type) {
 				this.actionJumpCanvas.clearRect(0, 0, this.canvasW, 114);
 
 				//计算一个对象
@@ -580,7 +600,8 @@
 				_drawObj.bgStartXAllNormal = this.canvasW / 2 - (this.spawnArray.length * 50) / 2;
 				_drawObj.bgStartXHasTip = this.canvasW / 2 - (this.spawnArray.length * 50 + 40) / 2;
 
-				let _currentBgStartX = this.index == this.spawnArray.length ? _drawObj.bgStartXAllNormal : _drawObj
+				let _currentBgStartX = this.index == this.spawnArray.length || type == "normal" ? _drawObj
+					.bgStartXAllNormal : _drawObj
 					.bgStartXHasTip;
 				// console.log("_drawObj.startX:", _drawObj.startX, _drawObj.width / 2);
 
@@ -603,7 +624,7 @@
 
 					let _addData = 0;
 					//大图提示后面要加上大图占的位置,为大图宽度减小图( 90 - 50 )
-					if (i >= this.index) {
+					if (i >= this.index && type !== "normal") {
 						_addData = 40;
 					}
 
@@ -625,7 +646,7 @@
 
 					let _currentPos = 0;
 					let _currentCenterPos = 0;
-					if (i == this.index) {
+					if (i == this.index && type !== "normal") {
 						_currentPos = (_currentBgStartX + _pos * 90 - i * 40) *
 							this
 							.spawnArray[i]
@@ -702,7 +723,7 @@
 						this.startJumpGame();
 					} else {
 						//绘制新触发状态
-						this.onDraw();
+						this.onDraw('tipHit');
 					}
 					//成功
 					this.setEliminationCount(1);
@@ -771,7 +792,7 @@
 				//处理参数
 				this.onClear();
 				this.onClearData();
-				this._changePlay();
+				this.bJumpPlay = false;
 				/**
 				 * 判断胜利和失败
 				 */
@@ -807,7 +828,7 @@
 				//处理参数
 				this.onClear();
 				this.onClearData();
-				this._changePlay();
+				this.bJumpPlay = false;
 
 				this.$emit('gameOver', {
 					type: 'pkMode'
@@ -836,6 +857,7 @@
 				this._changePlay(true);
 			},
 			onClearActionJumpData() {
+				console.log("onClearActionJumpData");
 				this.onClear();
 				this.onClearData();
 			},
@@ -909,68 +931,102 @@
 
 				let {
 					currentMaxValue,
-					oGyroValue
+					oGyroValue,
+					peakOfWaveMaxValue,
+					valleyOfWaveMinValue
 				} = data
 				console.log('stateDataOfJump:', JSON.stringify(data));
-				if (currentMaxValue == 0) {
-					//JumpType.NORMAL = 0
-					if (_jumpType == 0) {
-						// console.log('1====', data);
+				let _rotateLimit = 10;
+				let _jumpLimit = 10;
+				
+				switch (_jumpType) {
+					case 0:
+						//JumpType.NORMAL = 0
+						_tempState[0].bTrigger = true;
 						this.eliminateJumpPrefabFormTemp(_tempState);
-					}
-					//JumpType.RIGHT_ROTATE = 4
-					else if (_jumpType == 4 && (!this.isY && oGyroValue < 0 || this.isY && oGyroValue > 0)) {
-						// console.log('right1:', oGyroValue);
-						_tempState[4].bTrigger = true;
+						break;
+					case 1:
+						if (currentMaxValue < -_jumpLimit || valleyOfWaveMinValue < - 20) {
+							//left jump
+							_tempState[1].bTrigger = true;
+						}
 						this.eliminateJumpPrefabFormTemp(_tempState);
-					}
-					//JumpType.LEFT_ROTATE = 3
-					else if (_jumpType == 3 && (!this.isY && oGyroValue > 0 || this.isY && oGyroValue < 0)) {
-						// console.log('left1:', oGyroValue);
-						_tempState[3].bTrigger = true;
+						break;
+					case 2:
+						if (currentMaxValue > _jumpLimit || peakOfWaveMaxValue > 20) {
+							//right jump
+							_tempState[2].bTrigger = true;
+						}
 						this.eliminateJumpPrefabFormTemp(_tempState);
-					}
-
-				} else {
-					// console.log('2====', data);
-					if (currentMaxValue < -5) {
-						//left jump
-						_tempState[1].bTrigger = true;
-					} else if (currentMaxValue > 5) {
-						//right jump
-						_tempState[2].bTrigger = true;
-					}
-
-					if (this.isY) {
-						//如果是检测到旋转跳
-						if (oGyroValue > 5) {
-							// console.log('y right:', oGyroValue);
+						break;
+					case 4:
+						if (oGyroValue > _rotateLimit) {
 							_tempState[4].bTrigger = true;
-						} else if (oGyroValue < -5) {
-							// console.log('y left:', oGyroValue);
-							_tempState[3].bTrigger = true;
 						}
-					} else {
-						//如果是检测到旋转跳
-						if (oGyroValue < -5) {
-							// console.log('x right:', oGyroValue);
-							_tempState[4].bTrigger = true;
-						} else if (oGyroValue > 5) {
-							// console.log('x left:', oGyroValue);
+						this.eliminateJumpPrefabFormTemp(_tempState);
+						break;
+					case 3:
+						if (oGyroValue < -_rotateLimit) {
 							_tempState[3].bTrigger = true;
 						}
-					}
-
-					this.eliminateJumpPrefabFormTemp(_tempState);
+						this.eliminateJumpPrefabFormTemp(_tempState);
+						break;
+					default:
+						console.log('没有对应的_jumpType', _jumpType);
+						break;
 				}
+				
+				// if (currentMaxValue == 0) {
+					
+				// } else {
+				// 	// console.log('2====', data);
+
+				// 	if (this.isY) {
+				// 		//如果是检测到旋转跳
+				// 		if (oGyroValue > _rotateLimit) {
+				// 			// console.log('y right:', oGyroValue);
+				// 			_tempState[4].bTrigger = true;
+				// 		} else if (oGyroValue < -_rotateLimit) {
+				// 			// console.log('y left:', oGyroValue);
+				// 			_tempState[3].bTrigger = true;
+				// 		}
+				// 		if (valleyOfWaveMinValue < -_jumpLimit) {
+				// 			//left jump
+				// 			_tempState[1].bTrigger = true;
+				// 		} else if (peakOfWaveMaxValue > _jumpLimit) {
+				// 			//right jump
+				// 			_tempState[2].bTrigger = true;
+				// 		}
+				// 	} else {
+				// 		//如果是检测到旋转跳
+				// 		if (oGyroValue < -5) {
+				// 			// console.log('x right:', oGyroValue);
+				// 			_tempState[4].bTrigger = true;
+				// 		} else if (oGyroValue > 5) {
+				// 			// console.log('x left:', oGyroValue);
+				// 			_tempState[3].bTrigger = true;
+				// 		}
+				// 		if (valleyOfWaveMinValue < -_jumpLimit) {
+				// 			//left jump
+				// 			_tempState[1].bTrigger = true;
+				// 		} else if (peakOfWaveMaxValue > _jumpLimit) {
+				// 			//right jump
+				// 			_tempState[2].bTrigger = true;
+				// 		}
+				// 	}
+
+				// 	this.eliminateJumpPrefabFormTemp(_tempState);
+				// }
 			},
 			eliminateJumpPrefabFormTemp(_tempState) {
 				//如果消除完,需要重新生成
 				let _temp = this.spawnArray[this.index];
 				let bSuccess = false;
-				console.log(JSON.stringify(_tempState));
+				// console.log(JSON.stringify(_tempState));
 				for (let i = 0; i < _tempState.length; i++) {
 					let _state = _tempState[i];
+					if (_state.bTrigger)
+						console.log(JSON.stringify(_state));
 					//如果当前的跳类型和预制目标一样
 					if (_state.jumpCode == _temp.jumpCode && _state.bTrigger) {
 						//成功
@@ -986,10 +1042,12 @@
 					if (this.index >= this.spawnArray.length) {
 						clearInterval(this.countdownInterval);
 						this.countdownInterval = null;
-						this.startJumpGame();
+						this.canGoNext = true;
+						this.onDraw("normal");
 					} else {
 						//绘制新触发状态
-						this.onDraw();
+						this.canOnDraw = true;
+						this.onDraw("normal");
 					}
 					//成功
 					this.setEliminationCount(1);
@@ -1066,11 +1124,11 @@
 				this.actionJumpObj.updateJump(_temp);
 
 
-				if (this.BLEAccIndex > 150) {
-					this.onClearData();
-					this.bJump = false;
-					return;
-				}
+				// if (this.BLEAccIndex > 150) {
+				// 	this.onClearData();
+				// 	this.bJump = false;
+				// 	return;
+				// }
 				this.BLEAccIndex++;
 			},
 			onClearData() {

+ 2 - 2
manifest.json

@@ -77,12 +77,12 @@
                 "androidStyle" : "default",
                 "android" : {
                     "xxhdpi" : "",
-                    "xhdpi" : "D:/uniapp资源/splash.png"
+                    "xhdpi" : "D:/BaiduYunDownload/uniapp资源/splash.png"
                 }
             },
             "icons" : {
                 "android" : {
-                    "xhdpi" : "D:/uniapp资源/icon.png"
+                    "xhdpi" : "D:/BaiduYunDownload/uniapp资源/icon.png"
                 }
             }
         },

+ 31 - 10
pages/personal-page/personal/personal.vue

@@ -2,7 +2,8 @@
 	<view class="bg-person " :class="bEFHitShake?' screen-jitter ':''">
 		<!-- :title="title" @clickRight="onNavAppInfo() title="PK模式"" -->
 		<!-- 自定义导航栏 backgroundColor="rgba(164, 136, 220, 1)"  @clickRight="onSyncData" @clickRight="onTestShare"-->
-		<uni-nav-bar id="nav-bar" status-bar="true" backgroundColor="rgba(153, 150, 252, 255)" <!-- #ifdef APP-PLUS -->
+		<uni-nav-bar id="nav-bar" status-bar="true" backgroundColor="rgba(153, 150, 252, 255)"
+			<!-- #ifdef APP-PLUS -->
 			@clickLeft="showDrawer()"
 			<!-- #endif -->
 			<!-- #ifdef H5 || MP-WEIXIN -->
@@ -267,9 +268,13 @@
 				<button @click="onGetBluetoothConnectView()">显示 bluetoothConnect</button>
 			</view>
  -->
+ 
 			<view class="example" style="margin-top: 10rpx;">
 				<button @click="onNavToDirection">跳转校准页面</button>
 			</view>
+			<!-- <view class="example">
+				<button @click="onUserSignIn()">签到</button>
+			</view> -->
 			<view style="height: 100rpx;"></view>
 		</scroll-view>
 
@@ -766,6 +771,7 @@
 				 * 任务参数
 				 */
 				modalHeight: 300,
+
 			};
 		},
 		onLoad() {
@@ -882,6 +888,9 @@
 			// });
 			//复制一个默认参数
 			this.defaultAJData = Object.assign({}, this.AJData);
+
+			//用户签到列表
+			this.getSignInList();
 		},
 		onShow() {
 			_self.bHide = false;
@@ -952,7 +961,7 @@
 			//第一步提示设置计划,之后在回调registerPopupEvent 中处理
 			this.showGuide('plan', null);
 			// if (!this.bNewGuide) {
-				
+
 			// } else {
 			// 	//添加设备绑腿提示
 			// 	//guide.nvue 里面存储
@@ -1008,7 +1017,8 @@
 				'setActionJumpTask', 'getLevelList',
 				'getUserWallets', 'setGoldAndDiamond',
 				'onConvertDeviceData',
-				'showDrawerById', 'showPopupById', 'showGuideById'
+				'showDrawerById', 'showPopupById', 'showGuideById',
+				'getSignInList', 'onUserSignIn'
 			]),
 			BasicsSteps() {
 				this.basics = this.basics == this.basicsList.length - 1 ? 0 : this.basics + 1
@@ -1058,6 +1068,12 @@
 					if (this.currentMode == "pkMode") {
 						this.$refs.actionJumpRef.onPKModeGameOver("timeUp");
 					} else {
+						uni.showToast({
+							title: '时间到,游戏结束。',
+							icon: 'none',
+							duration: 2000,
+							mask: true
+						})
 						this.$refs.actionJumpRef.onGameOver("timeUp");
 					}
 
@@ -2141,8 +2157,11 @@
 
 						} else if (1 === this.currentModeIndex) {
 							//todo actionJump
-							this.$refs.actionJumpRef.onClearActionJumpData();
-
+							if (this.currentMode == "calorieMode") {
+								this.$refs.actionJumpRef.onGameOver("none");
+							} else {
+								this.$refs.actionJumpRef.onPKModeGameOver("none");
+							}
 						}
 						//停止蓝牙加速计
 						this.onWriteBLEConnectionValue({
@@ -2309,21 +2328,21 @@
 			},
 
 			onGetActionJumpView() {
-				
+
 				this.$nextTick(() => {
 					this.toView = "actionJumpID"
 				});
 				this.toView = '' //不清空再次跳到锚点位置会不起作用
-				
-				setTimeout(()=>{
+
+				setTimeout(() => {
 					_self.$refs.actionJumpRef.onGetActionJumpPlayView((data) => {
 						console.log(JSON.stringify(data));
 						// #ifdef APP-PLUS
 						_self.showGuide('actionJumpPlay', data);
 						// #endif
 					});
-				},200)
-				
+				}, 200)
+
 			},
 			onGetBluetoothConnectView() {
 
@@ -2982,6 +3001,8 @@
 										);
 								}
 
+							} else if (data.messageType == 'signIn') {
+								this.onUserSignIn();
 							}
 							break;
 						default:

+ 24 - 13
platform/app-plus/subNVue/reward-popup.nvue

@@ -145,14 +145,14 @@
 				<view class="flex-wrap flex-direction-row flex-sub justify-center">
 					<block v-for="(item, index) in lists" :key="index">
 						<view class="justify-center align-center" style="height: 148rpx; width: 116rpx; margin:5rpx;">
-							<view class="prompt-cell-bg" style="height: 148rpx;" :style="{opacity:item.isSelect?1:0.5}">
+							<view class="prompt-cell-bg" style="height: 148rpx;" :style="{opacity:item.isSelect?0.5:1}">
 							</view>
 							<view class="position-absolute-center" style="height:148rpx;">
 								<image style="" :style="{width:item.width+'px',height:item.height+'px'}"
-									mode="aspectFit" :src="item.isSelect?item.url:item.selectedUrl">
+									mode="aspectFit" :src="item.isSelect?item.selectedUrl:item.url">
 								</image>
-								<text class="text-14px text-center"
-									style="height: 14px;line-height: 14px; margin-top:12rpx;">{{item.explain}}+20</text>
+								<text class="text-14px text-center " :class="item.isSelect?'text-gray':''"
+									style="height: 14px;line-height: 14px; margin-top:12rpx;">{{item.value}}</text>
 
 							</view>
 
@@ -174,8 +174,13 @@
 				</image>
 			</view>
 			<view class="position-absolute-center-bottom" style="bottom: 200rpx;">
-				<button class="make-bg-bPurple prompt-button" @click="buttonMessage('confirm')"><text
-						class="text-white text-18px">点击领取</text> </button>
+				<block v-if="isSignIn">
+					<button class="prompt-button" style="border: none;" type="default" disabled="true"><text class="text-18px text-gray">已签到领取</text> </button>
+				</block>
+				<block v-else>
+					<button class="make-bg-bPurple prompt-button" @click="buttonMessage('confirm')"><text
+							class="text-white text-18px">签到领取</text> </button>
+				</block>
 			</view>
 		</view>
 
@@ -215,9 +220,9 @@
 
 
 		</view>
-	
-	
-	
+
+
+
 	</view>
 </template>
 
@@ -292,7 +297,10 @@
 					consumeTime: 0,
 					hit: 0,
 					miss: 0
-				}
+				},
+
+				//isSignIn
+				isSignIn: false
 			}
 		},
 		created() {
@@ -337,6 +345,9 @@
 					vm.unlockItem.consumeDiamond = data.item.consumeDiamond;
 				} else if (vm.currentType == 'signIn') {
 					vm.lists = data.lists;
+					//判断是否签到完
+					vm.isSignIn = data.isSignIn || vm.lists[vm.lists.length-1].flag == 1;
+					
 				} else if (vm.currentType == "levelReward") {
 					let _item = data.item;
 					if (_item.gold && _item.gold != 0) {
@@ -359,9 +370,9 @@
 
 					vm.levelRewardIndex = 0;
 					console.log(vm.lists);
-				}else if(vm.currentType == "pkFinish"){
-					vm.pkFinishItem = Object.assign({},data.item);
-					console.log('vm.pkFinishItem:',vm.pkFinishItem);
+				} else if (vm.currentType == "pkFinish") {
+					vm.pkFinishItem = Object.assign({}, data.item);
+					console.log('vm.pkFinishItem:', vm.pkFinishItem);
 				}
 
 			})

+ 79 - 59
util/util-js/action/jump.js

@@ -68,6 +68,8 @@ var jumpOpts = {
 	valleyOfWave: 0,
 	//检测到极快的波动的次数
 	timeOfPeakCount: 0,
+	//开始添加
+	bUpdateTimeOfPeakCount: false,
 	//开始更新的次数
 	startCount: 0,
 	//停止跳
@@ -89,6 +91,8 @@ var ActionJump = function ActionJump() {
 	//陀螺仪
 	this.oriGyroYArray = [];
 
+	this.isJumpTop = false;
+
 	this.event = new Event();
 
 }
@@ -133,7 +137,6 @@ ActionJump.prototype.updateJump = function() {
  * */
 ActionJump.prototype.detectorNewStep = function(resultant, linearX, linearY, linearZ, oriX, oriY, oriZ, _runIndex,
 	_oGyroY) {
-	let bUpdate = true;
 	let _judgmentValue = oriZ;
 	if (this.jumpOpts.gravityOld == 0) {
 		this.jumpOpts.gravityOld = _judgmentValue;
@@ -146,72 +149,87 @@ ActionJump.prototype.detectorNewStep = function(resultant, linearX, linearY, lin
 				value
 			} = this.detectorPeakOfWaveAndValleyOfWave(_judgmentValue, this.jumpOpts.gravityOld);
 			if (bState) {
-				this.jumpOpts.bUpState = true;
-				let _temp = {
-					type: bType,
-					oldValue: value,
-					value: resultant,
-					lastIndex: _runIndex - 1
-				};
-				this.event.trigger('resultant', _temp);
-				bUpdate = false;
+				if (!this.jumpOpts.bUpState) {
+					this.jumpOpts.bUpState = true;
+					this.isJumpTop = false;
+					this.highestCount = 0;
+					//陀螺仪部分
+					this.oriGyroYArray = [];
+					this.jumpOpts.startCount = 0;
+				}
+				// let _temp = {
+				// 	type: bType,
+				// 	oldValue: value,
+				// 	// value: resultant,
+				// 	lastIndex: _runIndex - 1
+				// };
+				// this.event.trigger('resultant', _temp);
 				//记录最高点和最低点数组
 				if (bType == 'peakOfWave') {
-					this.peakOfWaveArray.push(_temp);
-					if (value > this.peakOfWaveMaxValue)
-						this.peakOfWaveMaxValue = value;
-						
-					console.log("peakOfWave=",value,this.peakOfWaveMaxValue);
+					this.peakOfWaveArray.push(value);
+					// if (value > this.peakOfWaveMaxValue)
+					this.peakOfWaveMaxValue += value;
 				} else if (bType == 'valleyOfWave') {
-					this.valleyOfWaveArray.push(_temp);
-					if (value < this.valleyOfWaveMinValue)
-						this.valleyOfWaveMinValue = value;
-					
-					console.log("valleyOfWave=",value,this.valleyOfWaveMinValue);
+					this.valleyOfWaveArray.push(value);
+					// if (value < this.valleyOfWaveMinValue)
+					this.valleyOfWaveMinValue += value;
 				}
-				this.highestCount = 0;
-				//陀螺仪部分
-				this.oriGyroYArray = [];
-
-				this.jumpOpts.startCount = 0;
-
 
 			}
 
 			if (this.jumpOpts.bUpState) {
+				if(Math.abs(_oGyroY)>10)
+					this.oriGyroYArray.push(_oGyroY);
+				// this.jumpOpts.startCount++;
+				// if (this.jumpOpts.startCount >= 7 ) {
+				// 	console.log("startCount peakOfWaveArray", JSON.stringify(this.peakOfWaveArray));
+				// 	console.log("startCount valleyOfWaveArray", JSON.stringify(this.valleyOfWaveArray));
+				// 	if (this.peakOfWaveArray.length !== 0 || this.valleyOfWaveArray.length !== 0) {
+				// 		let _currentMaxValue = 0;
+				// 		if (this.peakOfWaveMaxValue > 5) {
+				// 			_currentMaxValue = this.peakOfWaveMaxValue;
+				// 		} else if (this.valleyOfWaveMinValue < -5) {
+				// 			_currentMaxValue = this.valleyOfWaveMinValue;
+				// 		}
+				// 		let allOGyroValue = 0;
+				// 		for (let i = 0; i < this.oriGyroYArray.length; i++) {
+				// 			allOGyroValue += this.oriGyroYArray[i];
+				// 		}
+				// 		allOGyroValue /= this.oriGyroYArray.length;
+				// 		//这里相当于处理识别到跳,但是没有判断出什么动作。
+				// 		this.event.trigger('resultant', {
+				// 			type: "stateDataOfJump",
+				// 			currentMaxValue: _currentMaxValue,
+				// 			oGyroValue: allOGyroValue,
+				// 			resultant: resultant,
+				// 			name: "startCountEnd"
+				// 		});
+				// 	}
+
+				// // 如果加过一定数量。判断没有触发,重置状态
+				// this.jumpOpts.bUpState = false;
+				// 	this.jumpOpts.bStopJump = true;
+				// 	this.jumpOpts.bUpdateTimeOfPeakCount = true;
+				// 	this.resetAll();
+				// }
 
-				this.oriGyroYArray.push(_oGyroY);
-
-				this.jumpOpts.startCount++;
-				if (this.jumpOpts.startCount >= 15) {
-					//如果加过一定数量。判断没有触发,重置状态
-					this.jumpOpts.bUpState = false;
-					this.resetAll();
-					this.jumpOpts.startCount = 0;
-
-					let allOGyroValue = 0;
-					for (let i = 0; i < this.oriGyroYArray.length; i++) {
-						allOGyroValue += this.oriGyroYArray[i];
-					}
-					allOGyroValue /= this.oriGyroYArray.length;
-
-					//这里相当于处理识别到跳,但是没有判断出什么动作。
-					this.event.trigger('resultant', {
-						type: "stateDataOfJump",
-						currentMaxValue: 0,
-						oGyroValue: allOGyroValue,
-						resultant: resultant
-					});
-				}
 
 				//出现极值后
 				if (Math.abs(linearZ) < 7 && Math.abs(resultant) < 7) {
+					// this.isJumpTop = true;
 					this.highestCount++;
 					if (this.highestCount >= 2) {
 						//达到最高点,
 						this.jumpOpts.bStopJump = true;
+						this.jumpOpts.bUpdateTimeOfPeakCount = true;
+						// this.isJumpTop = false;
 
 						let _currentMaxValue = 0;
+						console.log("highestCount peakOfWaveArray", JSON.stringify(this.peakOfWaveArray));
+						console.log("highestCount valleyOfWaveArray", JSON.stringify(this.valleyOfWaveArray));
+						console.log("达到最高点时候数值 Max:", this.peakOfWaveMaxValue, " min:", this.valleyOfWaveMinValue);
+						//(Math.abs(this.peakOfWaveMaxValue) > 5 && Math.abs(this.valleyOfWaveMinValue) - Math
+						//  .abs(this.peakOfWaveMaxValue) < 10) ||
 						if (Math.abs(this.peakOfWaveMaxValue) > Math.abs(this.valleyOfWaveMinValue)) {
 							_currentMaxValue = this.peakOfWaveMaxValue;
 						} else {
@@ -256,21 +274,19 @@ ActionJump.prototype.detectorNewStep = function(resultant, linearX, linearY, lin
 						this.event.trigger('resultant', {
 							type: "stateDataOfJump",
 							currentMaxValue: _currentMaxValue,
+							peakOfWaveMaxValue: this.peakOfWaveMaxValue,
+							valleyOfWaveMinValue: this.valleyOfWaveMinValue,
 							oGyroValue: allOGyroValue,
-							resultant: resultant
+							resultant: resultant,
+							name: "highestCountEnd"
 						});
-
-						// bUpdate = false;
 						this.jumpOpts.bUpState = false;
-						this.resetAll();
-
-
-						console.log("resetAll:", this.jumpOpts.startCount);
+						// this.resetAll();
 					}
 
 				}
 			}
-		} else {
+		} else if (this.jumpOpts.bUpdateTimeOfPeakCount) {
 			this.jumpOpts.timeOfPeakCount++;
 			if (this.jumpOpts.timeOfPeakCount >= 30) {
 				this.jumpOpts.timeOfPeakCount = 0;
@@ -280,8 +296,10 @@ ActionJump.prototype.detectorNewStep = function(resultant, linearX, linearY, lin
 				});
 				console.log("timeOfPeakCount >=30");
 				this.resetAll();
+				this.jumpOpts.bUpdateTimeOfPeakCount = false;
 			}
 		}
+
 		// 		let result = Math.atan2(averX, averZ) * 180 / (Math.PI);
 		// 		result = Math.round(result);
 		// 		let curAngle = result > 0 ? result : (360 + result);
@@ -314,7 +332,7 @@ ActionJump.prototype.detectorPeakOfWaveAndValleyOfWave = function(newValue, oldV
 		this.jumpOpts.continueDownCount++;
 	}
 	if (!this.jumpOpts.isDirectionUp && this.jumpOpts.lastStatus && this.jumpOpts.continueUpFormerCount >= 2 && Math
-		.abs(oldValue) >= 5) {
+		.abs(oldValue) > 4) {
 		this.jumpOpts.peakOfWave = oldValue;
 		return {
 			value: oldValue,
@@ -322,7 +340,7 @@ ActionJump.prototype.detectorPeakOfWaveAndValleyOfWave = function(newValue, oldV
 			bState: true
 		};
 	} else if (!this.jumpOpts.lastStatus && this.jumpOpts.isDirectionUp && this.jumpOpts.continueDownFormerCount >=
-		2 && Math.abs(oldValue) >= 5) {
+		2 && Math.abs(oldValue) > 4) {
 		this.jumpOpts.valleyOfWave = oldValue;
 		return {
 			value: oldValue,
@@ -351,6 +369,8 @@ ActionJump.prototype.resetAll = function() {
 	this.jumpOpts.continueDownCount = 0;
 	this.jumpOpts.continueUpFormerCount = 0;
 	this.jumpOpts.continueUpCount = 0;
+
+	// this.jumpOpts.gravityOld = 0;
 }
 
 if (typeof module === "object" && typeof module.exports === "object") {

+ 116 - 79
util/util-js/store.js

@@ -384,6 +384,12 @@ const store = new Vuex.Store({
 			direction: 1,
 		}],
 
+		/**
+		 * 签到列表
+		 */
+		signInList: [],
+		isSignIn:false,
+
 	},
 	mutations: {
 		/**
@@ -1063,7 +1069,8 @@ const store = new Vuex.Store({
 						let tempTime = date.formatDate(nDate);
 						state.remainingDays = date.datedifference(tempTime, res.data.endTime) + 1;
 
-						console.log("state.remainingDays======",tempTime,res.data.endTime, state.remainingDays);
+						console.log("state.remainingDays======", tempTime, res.data.endTime, state
+							.remainingDays);
 					}
 					// showArcbar
 					if (callback) {
@@ -3302,83 +3309,7 @@ const store = new Vuex.Store({
 					});
 					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
-							}
-						]
-					});
+					this.commit("onSendSignInPopup",context);
 					break;
 				case 'pkFinish':
 					// 向 popup 传递消息
@@ -3404,7 +3335,7 @@ const store = new Vuex.Store({
 			subNVue.show('zoom-out', 250)
 			// #endif
 		},
-		showGuideById(state, context){
+		showGuideById(state, context) {
 			let {
 				type,
 				item
@@ -3418,7 +3349,113 @@ const store = new Vuex.Store({
 			});
 			const subNVue = uni.getSubNVueById('personal-guide')
 			subNVue.show('fade-in', 250)
+		},
+
+		getSignInList(state, callback) {
+			reqUtil
+				.requestData(config.URL.GETSIGNINLIST, {})
+				.then(
+					res => {
+						if (res.code == 0) {
+							console.log('GETSIGNINLIST:' + JSON.stringify(res.data));
+							state.signInList = res.data.signInList;
+							state.isSignIn = res.data.isSignIn;
+							if (callback)
+								callback(res.data);
+						}
+					},
+					e => {
+						console.log(e);
+					}
+				);
+		},
+		onUserSignIn(state, callback) {
+			reqUtil
+				.requestData(config.URL.USERSIGNIN, {})
+				.then(
+					res => {
+						console.log('USERSIGNIN:' + JSON.stringify(res));
+						if (res.code == 0) {
+							state.cGold = res.data.userGold;
+							state.cDiamond = res.data.userDiamond;
+							uni.showToast({
+								title: '签到成功',
+								mask: true
+							})
+							//根据dayType 计算最近一个flag
+							for(let i=0;i<state.signInList.length;i++){
+								if(res.data.signIn.dayType == state.signInList[i].dayType){
+									state.signInList[i] = Object.assign({},state.signInList[i],res.data.signIn);
+									break;
+								}
+							}
+							state.isSignIn = true;
+							if (callback)
+								callback(res.data);
+						} else if (res.code == 901) {
+							uni.showToast({
+								title: '今天已签到',
+								mask: true
+							})
+						}
+					},
+					e => {
+						console.log(e);
+					}
+				);
+		},
+		onSendSignInPopup(state,context){
+			let {
+				type,
+				item
+			} = context;
+			let _reward = [{
+					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
+				}
+			];
+			
+			let list = state.signInList;
+			let lists = [];
+			for (let i = 0; i < list.length; i++) {
+				if (0 !== list[i].gold) {
+					lists.push(Object.assign({}, _reward[0], {
+						value: list[i].gold
+					}))
+				} else if (0 !== list[i].diamond) {
+					lists.push(Object.assign({}, _reward[1], {
+						value: list[i].diamond
+					}))
+				}
+				lists[i].isSelect = list[i].flag == 1?true:false;
+			}
+			
+			// 向 popup 传递消息
+			uni.$emit('reward-popup', {
+				title: '每日签到',
+				content: '',
+				type: type,
+				lists: lists,
+				isSignIn:state.isSignIn
+			});
 		}
+
 	}
 })