Sfoglia il codice sorgente

1.修复nvue子窗体为销毁问题
2.修改跳逻辑等

slambb 3 anni fa
parent
commit
d6ec61c64b

+ 2 - 2
manifest.json

@@ -2,8 +2,8 @@
     "name" : "哔蹦",
     "appid" : "__UNI__2635DF5",
     "description" : "",
-    "versionName" : "2.4.28",
-    "versionCode" : 21101902,
+    "versionName" : "2.4.29",
+    "versionCode" : 21102002,
     "transformPx" : false,
     /* 5+App特有相关 */
     "app-plus" : {

+ 6 - 0
pages/personal-page/personal/personal.vue

@@ -1028,6 +1028,7 @@
 				'getUserWallets', 'setGoldAndDiamond',
 				'onConvertDeviceData',
 				'showDrawerById', 'showPopupById', 'showGuideById',
+				'closeDrawerById', 'closePopupById','closeGuideById',
 				'getSignInList', 'onUserSignIn',
 				'setGuideUnlockState'
 			]),
@@ -3301,6 +3302,11 @@
 				})
 			},
 			unregisterPopupEvent() {
+				//注销相应的nvue
+				this.closeDrawerById();
+				this.closePopupById();
+				this.closeGuideById();
+				
 				uni.$off('reward-popup-page')
 				uni.$off('drawer-page')
 				uni.$off('guide-popup-page')

+ 5 - 5
platform/app-plus/subNVue/drawer.nvue

@@ -11,7 +11,7 @@
 					</image>
 				</view>
 
-				<view class="flex flex-direction-row align-center margin-12px " >
+				<view class="flex flex-direction-row align-center margin-12px ">
 					<text class="text-22px text-bold">{{userName}}
 					</text>
 					<image style="width: 34rpx;height: 34rpx; margin-left: 22rpx;" src="/static/sideEdit.png"></image>
@@ -92,7 +92,7 @@
 			},
 			// 跳转编辑信息页面
 			onNavEditInfoPage() {
-				this.hideDrawer(()=>{
+				this.hideDrawer(() => {
 					uni.navigateTo({
 						url: '../../my-page/userInfo/userInfo',
 						success: res => {},
@@ -103,7 +103,7 @@
 			},
 			//侧边栏对应页面跳转
 			onNavListItem(pageType) {
-				this.hideDrawer(()=>{
+				this.hideDrawer(() => {
 					if (pageType == "my") {
 						this.onNavMyPage();
 						return;
@@ -150,7 +150,7 @@
 					mask: true,
 					duration: 5000
 				})
-				this.hideDrawer(()=>{
+				this.hideDrawer(() => {
 					// 清除token,退回首页
 					this.delectToken({
 						success: (res) => {
@@ -161,7 +161,7 @@
 						}
 					});
 				});
-				
+
 
 			}
 		}

+ 9 - 6
platform/app-plus/subNVue/guide.nvue

@@ -40,9 +40,11 @@
 					<view class="flex-sub mask-bg-07"></view>
 					<view class="position-relative align-center"
 						style="width: 248rpx;height: 104rpx; background-color: rgba(0,0,0,0.7);">
-						<image  class="position-absolute-center" style="width: 248rpx;height: 104rpx; top: 18rpx;"
-								src="../../../static/modal/level-tip/level-tip-bg-orange.png"></image>
-						<view style="margin-top: 38rpx; width: 72rpx; height: 12rpx; background-color: #FFFFFF; border-radius: 18px;"></view>
+						<image class="position-absolute-center" style="width: 248rpx;height: 104rpx; top: 18rpx;"
+							src="../../../static/modal/level-tip/level-tip-bg-orange.png"></image>
+						<view
+							style="margin-top: 38rpx; width: 72rpx; height: 12rpx; background-color: #FFFFFF; border-radius: 18px;">
+						</view>
 					</view>
 					<view class="flex-sub mask-bg-07"></view>
 				</view>
@@ -72,7 +74,7 @@
 			<!-- top: 55px; 相当于 上间隔 -->
 			<view class="mask-bg-07" :style="{height:guideHeight+'px'}"></view>
 			<!-- 中心位置 225 -->
-			<view style="width: 750rpx;height: 284px;" >
+			<view style="width: 750rpx;height: 284px;">
 				<view style="height: 220px;" class="mask-bg-07">
 					<view class="position-absolute-center-bottom">
 						<image style="width: 488rpx;height: 366rpx;"
@@ -181,7 +183,8 @@
 				<image
 					:style="{ width: unlockLevelInfo.firstWidth  + 'rpx', height: unlockLevelInfo.firstHeight  + 'rpx' ,transform:'scaleX('+unlockLevelInfo.firstDirection +')' }"
 					:src="unlockLevelInfo.firstImage"></image>
-				<view v-if="!unlockLevelInfo.secondHidden" class="flex flex-direction-row align-center justify-center margin-17px">
+				<view v-if="!unlockLevelInfo.secondHidden"
+					class="flex flex-direction-row align-center justify-center margin-17px">
 					<text class="game-number">2</text>
 					<text class="text-16px text-left text-white "
 						style="width:476rpx;">{{unlockLevelInfo.secondText}}</text>
@@ -253,7 +256,7 @@
 					secondWidth: 68,
 					secondHeight: 68,
 					secondHidden: true,
-					},
+				},
 
 				directionJumpInfo: {
 					title: '解锁左右跳',

+ 53 - 89
util/util-js/action/jump-0.2.js

@@ -64,53 +64,31 @@ var jumpOpts = {
 var ActionJump = function ActionJump() {
 
 	this.jumpOpts = jumpOpts;
-	//其他波峰波谷参数相关数组记录
-	this.peakOfWaveArray = [];
 	this.peakOfWaveMaxValue = 0;
-	this.valleyOfWaveArray = [];
 	this.valleyOfWaveMinValue = 0;
-
-	this.peakOfWaveArrayValue = [];
-	this.valleyOfWaveArrayValue = [];
-
-	this.peakOfWaveArrayValueLinear = [];
-	this.valleyOfWaveArrayValueLinear = [];
-
-
 	this.highestCount = 0;
 	//陀螺仪
 	this.oriGyroYArray = [];
-
-	this.isJumpTop = false;
-
 	this.event = new Event();
-
-
 	this.frameCapacity = 6;
 	this.frame = [];
 	this.frameLength = 5;
 	this.frameOffset = 0;
-
-	this.frameHitCapacity = 11;
-	this.frameHit = []; //打击后的n帧
-
 	for (var i = 0; i < this.frameCapacity; ++i) {
 		var o = new Object();
-		// o.acc = [0, 0, 0];
-		// o.gyr = [0, 0, 0];
 		o.maxValue = 0;
 		o.gyroValue = 0;
 		o.resultant = 0;
 		this.frame.push(o);
 	}
-
-
 }
 ActionJump.prototype.addEventListener = function(type, listener) {
 	this.event.addEventListener(type, listener);
 };
 
-
+/**
+ * 更新数据
+ */
 ActionJump.prototype.updateJump = function() {
 	let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
 	//使用三个轴的数据,计算重力轴的加速度。最后减去重力的加速度值
@@ -140,11 +118,8 @@ ActionJump.prototype.updateJump = function() {
 
 
 /*
- * 检测步子,并开始计步
- * 1.传入数据
- * 2.如果检测到了波峰,并且符合时间差以及阈值的条件,则判定为1步
- * 3.符合时间差条件,波峰波谷差值大于initialValue,则将该差值纳入阈值的计算中
- * */
+ *计算跳逻辑
+ */
 ActionJump.prototype.detectorNewStep = function(resultant, linearX, linearY, linearZ, oriX, oriY, oriZ, _runIndex,
 	_oGyroY) {
 	let _judgmentValue = oriZ;
@@ -152,28 +127,38 @@ ActionJump.prototype.detectorNewStep = function(resultant, linearX, linearY, lin
 	let limitResultant = 20;
 	if (!this.jumpOpts.bStopJump) {
 		if (resultant > limitResultant && !this.jumpOpts.bUpState) {
-			// console.log("开始判断时候:" + resultant);
 			this.jumpOpts.bUpState = true;
-			this.isJumpTop = false;
 			this.highestCount = 0;
 			//陀螺仪部分
-			this.oriGyroYArray = [];
-			this.peakOfWaveArrayValue = [];
-			this.valleyOfWaveArrayValue = [];
-			this.peakOfWaveArrayValueLinear = [];
-			this.valleyOfWaveArrayValueLinear = [];
-			this.jumpOpts.startCount = 0;
+			// this.oriGyroYArray = [];
 			//开始更新。加入时间判断
 			this.jumpOpts.startTime = new Date().getTime();
 			this.event.trigger('resultant', {
 				type: "log",
-				logType:'normal',
-				data: "开始时间:"+this.jumpOpts.startTime
+				logType: 'normal',
+				data: "开始时间:" + this.jumpOpts.startTime
 			});
+			for (let i = 0; i < this.frame.length; i++) {
+				this.frame[i].maxValue = 0;
+				this.frame[i].gyroValue = 0;
+				this.frame[i].resultant = 0;
+			}
 		}
 		if (this.jumpOpts.bUpState) {
+			let currTime = new Date().getTime(); //当前时间
+			let diffTime = currTime - this.jumpOpts.startTime; //当前时间减最初时间,得到当前时间差
+			// if (diffTime > 500) {
+			// 	//如果超时重置一下参数
+			// 	this.jumpOpts.startTime = new Date().getTime();
+			// 	for (let i = 0; i < this.frame.length; i++) {
+			// 		this.frame[i].maxValue = 0;
+			// 		this.frame[i].gyroValue = 0;
+			// 		this.frame[i].resultant = 0;
+			// 	}
+			// };
+
 			let newFrame = this.frame[(this.frameOffset + this.frameLength) % this.frameCapacity];
-			
+
 			if (_judgmentValue > 2) {
 				newFrame.maxValue = _judgmentValue;
 				if (_judgmentValue > this.peakOfWaveMaxValue)
@@ -183,67 +168,57 @@ ActionJump.prototype.detectorNewStep = function(resultant, linearX, linearY, lin
 				if (_judgmentValue < this.valleyOfWaveMinValue)
 					this.valleyOfWaveMinValue += _judgmentValue;
 			}
-			if (Math.abs(_oGyroY) > 5){
-				this.oriGyroYArray.push(_oGyroY);
+			if (Math.abs(_oGyroY) > 5) {
+				// this.oriGyroYArray.push(_oGyroY);
 				newFrame.gyroValue = _oGyroY;
 			}
 			newFrame.resultant = resultant;
-				
-			let currTime = new Date().getTime(); //当前时间
-			let diffTime = currTime - this.jumpOpts.startTime; //当前时间减最初时间,得到当前时间差
-			// if (diffTime > 200){
-			// 	this.jumpOpts.bUpState = false;
-			// 	this.event.trigger('resultant', {
-			// 		type: "log",
-			// 		logType:'normal',
-			// 		data: "超时:"+diffTime
-			// 	});
-			// 	return;
-			// };
+
 			//出现极值后
 			// Math.abs(linearZ) < 7 &&
 			if (Math.abs(resultant) < 7) {
 				this.event.trigger('resultant', {
 					type: "log",
-					logType:'normal',
-					data: '出现极值后:'+ resultant+",时间:"+diffTime
+					logType: 'normal',
+					data: '出现极值后:' + resultant + ",时间:" + diffTime
 				});
 				// if (diffTime < 150){
-					// this.jumpOpts.bUpState = false;
-					// return;
+				// this.jumpOpts.bUpState = false;
+				// return;
 				// };
 				// this.event.trigger('resultant', {
 				// 	type: "log",
 				// 	logType:'normal',
 				// 	data: "************触发成功************"
 				// });
-				
+
 				this.highestCount++;
-				if (this.highestCount >= 1) {
+				if (this.highestCount >= 2) {
 					//达到最高点,
 					this.jumpOpts.bStopJump = true;
 					this.jumpOpts.bUpdateTimeOfPeakCount = true;
 
-					let _currentMaxValue = 0;
+					// let _currentMaxValue = 0;
 
-					if (Math.abs(this.peakOfWaveMaxValue) > Math.abs(this.valleyOfWaveMinValue)) {
-						_currentMaxValue = this.peakOfWaveMaxValue;
-					} else {
-						_currentMaxValue = this.valleyOfWaveMinValue;
-					}
+					// if (Math.abs(this.peakOfWaveMaxValue) > Math.abs(this.valleyOfWaveMinValue)) {
+					// 	_currentMaxValue = this.peakOfWaveMaxValue;
+					// } else {
+					// 	_currentMaxValue = this.valleyOfWaveMinValue;
+					// }
 
-					let allOGyroValue = 0;
-					for (let i = 0; i < this.oriGyroYArray.length; i++) {
-						allOGyroValue += this.oriGyroYArray[i];
-					}
-					allOGyroValue /= this.oriGyroYArray.length;
-					
-					let _frameMaxValue = 0,_frameGyroValue = 0;
+					// let allOGyroValue = 0;
+					// for (let i = 0; i < this.oriGyroYArray.length; i++) {
+					// 	allOGyroValue += this.oriGyroYArray[i];
+					// }
+					// allOGyroValue /= this.oriGyroYArray.length;
+
+					let _frameMaxValue = 0,
+						_frameGyroValue = 0;
 					for (let i = 0; i < this.frame.length; i++) {
 						_frameMaxValue += this.frame[i].maxValue;
 						_frameGyroValue += this.frame[i].gyroValue;
 					}
-					console.log("frame:"+_frameMaxValue + " == "+ _frameGyroValue);
+					console.log("frame:" + _frameMaxValue + " == " + _frameGyroValue);
 
 					//后面通用使用这个类型传输数据
 					this.event.trigger('resultant', {
@@ -251,13 +226,11 @@ ActionJump.prototype.detectorNewStep = function(resultant, linearX, linearY, lin
 						currentMaxValue: _frameMaxValue,
 						peakOfWaveMaxValue: this.peakOfWaveMaxValue,
 						valleyOfWaveMinValue: this.valleyOfWaveMinValue,
-						oGyroValue: _frameGyroValue/this.frame.length,
+						oGyroValue: _frameGyroValue / this.frame.length,
 						resultant: resultant,
 						name: "highestCountEnd"
 					});
 					// this.jumpOpts.bUpState = false;
-					
-					
 					// this.jumpOpts.bStopJump = false;
 					this.event.trigger('resultant', {
 						type: "stop"
@@ -269,7 +242,7 @@ ActionJump.prototype.detectorNewStep = function(resultant, linearX, linearY, lin
 				this.frameOffset -= this.frameCapacity;
 			}
 		}
-	}else if (this.jumpOpts.bUpdateTimeOfPeakCount ) {
+	} else if (this.jumpOpts.bUpdateTimeOfPeakCount) {
 		// console.log("结束判断时候:" + resultant);
 		this.jumpOpts.timeOfPeakCount++;
 		//todo 如果直跳,可以调节更小的 limitTimeOfPeakCount 30
@@ -288,25 +261,16 @@ ActionJump.prototype.detectorNewStep = function(resultant, linearX, linearY, lin
 	}
 }
 
-ActionJump.prototype.setBUpState = function(value){
+ActionJump.prototype.setBUpState = function(value) {
 	this.jumpOpts.bUpState = value;
 }
 
 
 //重置对应的参数
 ActionJump.prototype.resetAll = function() {
-	// console.log('******************* resetAll ******************');
-	this.peakOfWaveArray = [];
 	this.peakOfWaveMaxValue = 0;
-	this.valleyOfWaveArray = [];
 	this.valleyOfWaveMinValue = 0;
 	this.highestCount = 0;
-
-
-	this.jumpOpts.continueDownFormerCount = 0;
-	this.jumpOpts.continueDownCount = 0;
-	this.jumpOpts.continueUpFormerCount = 0;
-	this.jumpOpts.continueUpCount = 0;
 }
 
 if (typeof module === "object" && typeof module.exports === "object") {

+ 16 - 0
util/util-js/store.js

@@ -3336,6 +3336,11 @@ const store = new Vuex.Store({
 			//personal-drawer
 			uni.getSubNVueById('personal-drawer').show('slide-in-left', 200);
 		},
+		closeDrawerById(state, context){
+			const subNVue = uni.getSubNVueById('personal-drawer');
+			subNVue.close();
+			console.log('销毁侧滑栏子窗体');
+		},
 		showPopupById(state, context) {
 			let {
 				type,
@@ -3410,6 +3415,11 @@ const store = new Vuex.Store({
 			subNVue.show('zoom-out', 250)
 			// #endif
 		},
+		closePopupById(state, context){
+			const subNVue = uni.getSubNVueById('personal-popup')
+			subNVue.close();
+			console.log('销毁奖励子窗体');
+		},
 		showGuideById(state, context) {
 			let {
 				type,
@@ -3425,6 +3435,12 @@ const store = new Vuex.Store({
 			const subNVue = uni.getSubNVueById('personal-guide')
 			subNVue.show('fade-in', 250)
 		},
+		
+		closeGuideById(){
+			const subNVue = uni.getSubNVueById('personal-guide')
+			subNVue.close();
+			console.log('销毁新手指引子窗体');
+		},
 		/**
 		 * 获取签到列表
 		 * @param {Object} state