Ver código fonte

1.添加新特效
2.修改新手提示
3.修复邮箱登录bug

slambb 4 anos atrás
pai
commit
9f7797169e

+ 8 - 1
common/config.js

@@ -20,8 +20,15 @@ const host = "https://www.9527fun.cn/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
 	 */

+ 121 - 31
components/modal/action-jump/action-jump.vue

@@ -43,7 +43,7 @@
 				<view id="ActionJumpPlay" class="flex" style="position: relative;" @click="onControllerPlay">
 					<image style="width: 110px;height: 110px;" src="../../../static/modal/action-jump/midButton.png">
 					</image>
-			
+
 					<image v-if="!bJumpPlay" class="mid-absolute" style=" width: 28rpx;height: 28rpx;"
 						src="../../../static/modal/action-jump/midPlay.png">
 					</image>
@@ -73,15 +73,20 @@
 			</view> -->
 
 		</view>
-		<canvas canvas-id="actionJumpCanvas" :style="{ width: canvasW + 'px', height: canvasH + 'px' }"></canvas>
+		<view class="position-relative">
+			<canvas canvas-id="actionJumpCanvas" :style="{ width: canvasW + 'px', height: canvasH + 'px' }"></canvas>
+			<canvas class="position-absolute-center" canvas-id="effectCanvas"
+				:style="{ width: canvasW + 'px', height: '164px' }"></canvas>
+		</view>
+
 		<view class="flex align-center justify-center" style="width: 750rpx;">
 			<view class="flex justify-center align-center" style="height: 120rpx; width: 444rpx; ">
-				<view  class="text-12px text-white text-center">
+				<view class="text-12px text-white text-center">
 					{{taskDescribe}}
 				</view>
 			</view>
 		</view>
-		
+
 
 		<!-- <view style="height: 41px;"></view> -->
 
@@ -105,7 +110,6 @@
 			<view style="font-size: 14px;">e:{{eliminationCount}}</view>
 			<view style="font-size: 14px;">f:{{faultCount}}</view>
 		</view> -->
-
 	</view>
 
 </template>
@@ -116,6 +120,8 @@
 		CONDITIONPASSED
 	} from "@/util/util-js/enum.js"
 
+	import Firework from "@/util/util-js/effect/firework.js"
+
 	import {
 		mapState,
 		mapMutations
@@ -281,7 +287,27 @@
 				/**
 				 * 是否显示关卡提示
 				 */
-				bTipLevel: false
+				bTipLevel: false,
+
+				/**
+				 * 烟花相关
+				 */
+				// firework collection
+				fireworks: [],
+				fireworkImage: null,
+				loop: null,
+				count: 100,
+				effectCanvas: null,
+				effectCurrentSpawn: null,
+				effectSpawnPosX: 0,
+				/**
+				 * 管理三个绘制
+				 */
+				bDrawBg: false,
+				bDrawJump: false,
+				bKeepBg: false,
+				bKeepType: '',
+				bDrawBoomEffect: false
 			}
 		},
 		watch: {
@@ -310,7 +336,7 @@
 		created() {
 			let _self = this;
 			this.actionJumpCanvas = uni.createCanvasContext("actionJumpCanvas", this);
-			// console.log("this.actionJumpCanvas:", this.actionJumpCanvas);
+			this.effectCanvas = uni.createCanvasContext("effectCanvas", this);
 			// this.SystemInfo = this.systemInfo; // uni.getSystemInfoSync();
 			this.canvasW = this.systemInfo.windowWidth; // 画布宽度
 			this.canvasH = 114;
@@ -425,6 +451,17 @@
 						_self.cankao = image;
 					}
 				});
+
+				/**
+				 * 烟花照片
+				 */
+				uni.getImageInfo({
+					src: "../../../static/modal/action-jump/boom.png",
+					success: function(image) {
+						_self.fireworkImage = image;
+					}
+				});
+
 			},
 			/**
 			 * 重置生成数组,重置倒计时
@@ -602,12 +639,15 @@
 			},
 			//单纯的绘制八个背景
 			onDrawBg() {
+				this.bDrawBg = true;
+				this.bKeepBg = true;
 				this.actionJumpCanvas.clearRect(0, 0, this.canvasW, this.canvasH);
 				let _currentBgStartX = this.canvasW / 2;
 				let count = 4;
 				for (let i = 0; i < count; i++) {
 					let _currentStartPos = _currentBgStartX - i * 50 - 50;
-					this.actionJumpCanvas.drawImage(this.jumpNormalImage.path, _currentStartPos, 0, 50, 114);
+					this.actionJumpCanvas.drawImage(this.jumpNormalImage.path, _currentStartPos, 0, 50,
+						114);
 					let _currentEndPos = _currentBgStartX + i * 50;
 					this.actionJumpCanvas.drawImage(this.jumpNormalImage.path, _currentEndPos, 0, 50, 114);
 
@@ -615,8 +655,10 @@
 				this.actionJumpCanvas.draw();
 			},
 			onDraw(type) {
+				this.bDrawJump = true;
+				this.bKeepBg = false;
+				this.bKeepType = type;
 				this.actionJumpCanvas.clearRect(0, 0, this.canvasW, 114);
-
 				//计算一个对象
 				let _drawObj = {
 					path: null,
@@ -667,7 +709,8 @@
 						//绘制前背景
 						for (let i = 0; i < count; i++) {
 							let _currentStartPos = _currentBgStartX - _frontBgData - i * 50 - 10;
-							this.actionJumpCanvas.drawImage(this.jumpNormalImage.path, _currentStartPos, 0, 50, 114)
+							this.actionJumpCanvas.drawImage(this.jumpNormalImage.path, _currentStartPos, 0,
+								50, 114)
 
 						}
 					}
@@ -691,6 +734,9 @@
 
 						//57 - 40/2 是取画布中心y点,减去图标本身高的一半的值
 						this.actionJumpCanvas.drawImage(_temp.path, _currentCenterPos - 7.5, 37, 40, 40);
+
+						//这里记录一个生成点,后面用于生成特效
+						this.effectSpawnPosX = _currentCenterPos - 8;
 					} else {
 						_currentPos = (_currentBgStartX + _addData + _pos *
 								50) * this
@@ -703,6 +749,7 @@
 
 						//44.5 是取画布中心y点,减去图标本身高的一半的值
 						this.actionJumpCanvas.drawImage(_temp.path, _currentCenterPos, 44.5, 25, 25);
+
 					}
 
 					this.actionJumpCanvas.restore();
@@ -711,10 +758,12 @@
 						//绘制结束位置
 						// console.log("count:", count);
 						for (let i = 0; i < count; i++) {
-							let _currentEndPos = _currentBgStartX + _addData + (this.spawnArray.length + i) * 50;
+							let _currentEndPos = _currentBgStartX + _addData + (this.spawnArray.length +
+								i) * 50;
 
 							// console.log("end _currentEndPos:", _currentEndPos);
-							this.actionJumpCanvas.drawImage(this.jumpNormalImage.path, _currentEndPos, 0, 50, 114)
+							this.actionJumpCanvas.drawImage(this.jumpNormalImage.path, _currentEndPos, 0,
+								50, 114)
 
 						}
 
@@ -723,6 +772,21 @@
 
 				this.actionJumpCanvas.draw();
 			},
+			onDrawEffect(_temp) {
+				//根据当前消除的生成一个
+				// console.log("生成的_temp:" + JSON.stringify(_temp));
+				let spawnTemp = this.midJump;
+				if (_temp.icon == 'directionJump') {
+					spawnTemp = this.directionJump;
+				} else if (_temp.icon == 'rotateJump') {
+					spawnTemp = this.rotateJump;
+				}
+				let tempFirework = new Firework(this.fireworkImage,
+					spawnTemp, _temp.scaleX, this.effectSpawnPosX, 0, this.canvasW, 164);
+				this.fireworks.push(tempFirework);
+				this.bDrawBoomEffect = true;
+				this.onInitFirework();
+			},
 			onClear() {
 				this.resetJumpGame();
 
@@ -736,6 +800,40 @@
 				this.actionJumpObj.resetAll();
 			},
 
+			/**
+			 * 统一绘制 效果 背景,交互,烟花
+			 */
+			onInitFirework() {
+				if (this.loop != null) {
+					return;
+				}
+
+				this.loop = setInterval(() => {
+					if (!this.bDrawBoomEffect) {
+						clearInterval(this.loop);
+						this.loop = null;
+						// console.log("结束绘制");
+						this.effectCanvas.clearRect(0, 0, this.canvasW, 164);
+						this.effectCanvas.draw();
+						return;
+					}
+					this.effectCanvas.clearRect(0, 0, this.canvasW, 164);
+					if (this.bDrawBoomEffect) {
+						// loop over each firework, draw it, update it
+						var i = this.fireworks.length;
+						while (i--) {
+							this.fireworks[i].draw(this.effectCanvas, () => {
+								this.fireworks.splice(i, 1);
+								if (this.fireworks.length == 0) {
+									this.bDrawBoomEffect = false;
+								}
+							});
+
+						}
+					}
+					this.effectCanvas.draw();
+				}, 30)
+			},
 			onJumpType(event) {
 				// console.log("onJumpType:", event);
 				if (this.isGameOver || !this.bJumpPlay) return;
@@ -743,13 +841,20 @@
 			},
 
 			// update (dt) {}
-
+			//模拟测试调用
 			eliminateJumpPrefab(_jumpType) {
 				let _temp = this.spawnArray[this.index];
+				// let _temp = this.jumpTypeArray[Math.floor(Math.random()*4) ];
+				//这里更新特效
+				// this.onDrawEffect(_temp);
+				// return;
 				//如果当前的跳类型和预制目标一样
 				if (_jumpType == _temp.jumpCode) {
 					_temp.bTrigger = true;
 					this.index++;
+					//这里更新特效
+					let _endTemp = Object.assign({}, _temp);
+					this.onDrawEffect(_endTemp);
 					if (this.index >= this.spawnArray.length) {
 						clearInterval(this.countdownInterval);
 						this.countdownInterval = null;
@@ -921,7 +1026,7 @@
 			},
 
 			getCurrentJumpType() {
-				let _temp = this.spawnArray[this.index];;
+				let _temp = this.spawnArray[this.index];
 				return _temp.jumpCode;
 			},
 
@@ -1075,6 +1180,8 @@
 					// console.log("bSuccess:", bSuccess);
 					_temp.bTrigger = true;
 					this.index++;
+					//这里更新特效
+					this.onDrawEffect(_temp);
 					if (this.index >= this.spawnArray.length) {
 						clearInterval(this.countdownInterval);
 						this.countdownInterval = null;
@@ -1192,23 +1299,6 @@
 </script>
 
 <style lang="scss">
-	// .action-jump-parent {
-	// 	border: 1rpx solid #ffaa7f;
-	// 	position: relative;
-	// 	display: flex;
-	// 	justify-content: center;
-	// 	overflow: hidden;
-	// 	top: 0;
-	// 	width: 100%;
-	// }
-
-	// .action-jump-container {
-	// 	width: 100%;
-	// 	height: 114px;
-	// 	border: 1rpx solid #000000;
-	// 	position: relative;
-	// }
-
 	.mid-absolute {
 		position: absolute;
 		top: 0;

+ 2 - 2
manifest.json

@@ -2,8 +2,8 @@
     "name" : "哔蹦",
     "appid" : "__UNI__2635DF5",
     "description" : "",
-    "versionName" : "2.4.14",
-    "versionCode" : 21092704,
+    "versionName" : "2.4.17",
+    "versionCode" : 21092903,
     "transformPx" : false,
     /* 5+App特有相关 */
     "app-plus" : {

+ 9 - 0
pages.json

@@ -314,6 +314,15 @@
             }
             
         }
+        ,{
+            "path" : "pages/platform-page/guide/guide-level-scroll",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "",
+                "enablePullDownRefresh": false
+            }
+            
+        }
     ],
 	"subPackages": [{
 		"root": "pages/personal-page",

+ 6 - 5
pages/login-page/login/login.vue

@@ -134,7 +134,7 @@
 								<view>通过微信注册</view>
 							</view>
 						</view>
-						<view  v-if="appleOauth" class="btn-apple-confirm" @tap="onAppleReg">
+						<view v-if="appleOauth" class="btn-apple-confirm" @tap="onAppleReg">
 							<image style="width: 48rpx;height: 48rpx;margin-right: 5px;"
 								src="../../../static/img/apple.png"></image>
 							<view>通过Apple注册</view>
@@ -605,9 +605,10 @@
 					duration: 10000,
 					mask: true
 				})
-				reqUtil.requestData(config.URL.SMSLOGIN, {
-					"phoneNumber": _self.phoneNumber,
-					"code": _self.inputCode
+				reqUtil.requestData(config.URL.SMSLOGINFROMTYPE, {
+					"account": _self.bMobileLogin ? _self.phoneNumber : _self.mailboxNumber,
+					"code": _self.inputCode,
+					"type": _self.bMobileLogin ? 0 : 1
 				}).then(res => {
 						console.log('requestData GETCODE =====', res);
 						uni.hideToast();
@@ -1026,7 +1027,7 @@
 		height: 64rpx;
 		/* background-color: rgba(151, 151, 255, 1); */
 		border: 1px solid #000000;
-		
+
 		border-radius: 8px;
 		display: flex;
 		justify-content: center;

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

@@ -264,9 +264,7 @@
 			<view class="example">
 				<button @click="onGetActionJumpView()">显示 onGetActionJumpView</button>
 			</view>
-		<view class="example">
-			<button @click="onGetBluetoothConnectView()">显示 bluetoothConnect</button>
-		</view>
+		
  -->
 
 			<!-- 	<view class="example">
@@ -278,6 +276,11 @@
 			<view class="example" style="margin-top: 10rpx;">
 				<button @click="onNavToDirection">跳转校准页面</button>
 			</view>
+			<view class="example">
+				<button @click="onGetBluetoothConnectView({
+												hiddenType: 'firstInstallation'
+											})">显示 bluetoothConnect</button>
+			</view>
 			<!-- <view class="example">
 				<button @click="onUserSignIn()">签到</button>
 			</view> -->
@@ -1855,10 +1858,13 @@
 					//2.检测是否连接设备 || this.BLEConnectDevice.ename !== 'BT04'
 					if (this.cIndex == -1) {
 						//没有连接设备,提示去连接设备
-						uni.showToast({
-							title: '请连接蓝牙设备',
-							icon: 'none'
-						})
+						// uni.showToast({
+						// 	title: '请连接蓝牙设备',
+						// 	icon: 'none'
+						// })
+						this.onGetBluetoothConnectView({
+							hiddenType: 'none'
+						});
 						// this.toView = "addDeviceView";
 						return;
 					}
@@ -2010,7 +2016,7 @@
 			},
 			//检测是否符合要求,没有的话进行新手提示
 			onPersonalCheck(data) {
-
+				// #ifdef APP-PLUS
 				if (1 === this.currentModeIndex) {
 					if (this.currentJumpTask == null) {
 
@@ -2073,6 +2079,8 @@
 						return;
 					}
 				}
+				// #endif
+
 
 				this.onStartCheck(data);
 			},
@@ -3089,12 +3097,12 @@
 				this.setActionJumpTask(this.tempSelectedLevel);
 
 				this.hideModal();
-				setTimeout(()=>{
+				setTimeout(() => {
 					// 自动调用开始游戏
 					this.onPersonalCheck({
 						bStartCountDown: true
 					});
-				},300);
+				}, 300);
 
 			},
 			registerPopupEvent() {
@@ -3229,6 +3237,7 @@
 												hiddenType: 'firstInstallation'
 											});
 										}, 100)
+										console.log('提示连接手柄')
 									}
 								}
 							} else if (data.messageType == 'bluetoothConnect') {
@@ -3244,6 +3253,7 @@
 											this.showGuide('level-button-tip', {
 												hiddenType: 'firstInstallation'
 											});
+											console.log('提示连接关卡')
 										}, 100)
 									} else if (data.hiddenType == 'firstDisconnectBluetooth') {
 										this.fabClick();

+ 150 - 0
pages/platform-page/guide/guide-level-scroll.vue

@@ -0,0 +1,150 @@
+<template>
+	<view>
+		<uni-nav-bar id="nav-bar" status-bar="true" @clickLeft="onBack()" @clickRight="onNavUpdateDevice()" title="关卡指导"
+			color="#000000" fixed="true" :border="false">
+			<view slot="left">
+				<view class=" flex align-center margin-left">
+					<image class="p-left-arrow" src="../../../static/p-left-arrow.png"></image>
+				</view>
+			</view>
+		</uni-nav-bar>
+
+		<view v-for="(item,index) in levelList" :key="index" class="mask-bg-07 ">
+			<view class="flex flex-direction level-mid position-relative">
+				<view style="height: 278rpx;width: 750rpx;" class="position-relative">
+					<view class="position-absolute-center flex">
+						<image style="width: 442rpx;height: 278rpx;"
+							src="../../../static/common/subNVue/guide/level-game-title@2x.png"></image>
+					</view>
+					<view class="position-absolute-center flex justify-center">
+						<text class="text-white text-14px" style="top: 0rpx;left:20rpx;">{{item.title}}</text>
+					</view>
+				</view>
+
+				<view class="flex flex-direction-row align-center justify-center  margin-xl">
+					<view class="level-tip-number">1</view>
+					<text class="text-16px text-left text-white " style="width:476rpx;">{{item.firstText}}</text>
+				</view>
+				<image
+					:style="{ width: item.firstWidth  + 'rpx', height: item.firstHeight  + 'rpx' ,transform:'scaleX('+item.firstDirection +')' }"
+					:src="item.firstImage"></image>
+				<view class="flex flex-direction-row align-center justify-center margin-xl">
+					<text class="level-tip-number">2</text>
+					<text class="text-16px text-left text-white " style="width:476rpx;">{{item.secondText}}</text>
+				</view>
+				<image
+					:style="{ width: item.secondWidth  + 'rpx', height: item.secondHeight  + 'rpx' ,transform:'scaleX('+item.secondDirection +')' }"
+					:src="item.secondImage">
+				</image>
+				<view style="height: 100rpx;"></view>
+			</view>
+		</view>
+
+
+
+	</view>
+
+
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				devicesList: [],
+				circular: true,
+				levelList: [{
+						title: '解锁向上跳',
+						firstText: '请先确保手柄已经连接成功。',
+						firstImage: '../../../static/common/subNVue/guide/level-game-fab@2x.png',
+						firstDirection: 1,
+						firstWidth: 102,
+						firstHeight: 108,
+						secondText: '通过向上跳的方式消除标志块',
+						secondImage: '../../../static/modal/action-jump/midJumpWhite.png',
+						secondDirection: 1,
+						secondWidth: 68,
+						secondHeight: 68
+
+					},
+					{
+						title: '解锁左右跳',
+						firstText: '此为左跳图标,通过向左跳的方式消除标志块',
+						firstImage: '../../../static/modal/action-jump/directionJumpWhite.png',
+						firstDirection: -1,
+						firstWidth: 68,
+						firstHeight: 68,
+						secondText: '此为右跳图标,通过向右跳的方式消除标志块',
+						secondImage: '../../../static/modal/action-jump/directionJumpWhite.png',
+						secondDirection: 1,
+						secondWidth: 68,
+						secondHeight: 68
+					},
+					{
+						title: '解锁左右旋跳',
+						firstText: '此为左旋跳图标,通过向左旋跳的方式消除标志块',
+						firstImage: '../../../static/modal/action-jump/directionJumpWhite.png',
+						firstDirection: -1,
+						firstWidth: 68,
+						firstHeight: 68,
+						secondText: '此为右旋跳图标,通过向右旋跳的方式消除标志块',
+						secondImage: '../../../static/modal/action-jump/directionJumpWhite.png',
+						secondDirection: 1,
+						secondWidth: 68,
+						secondHeight: 68
+					}
+				],
+				currentHeight: 0,
+				threeTipHeight: 0,
+				threeZIndex: 100,
+
+			}
+		},
+		onLoad(op) {
+
+
+		},
+		onHide() {},
+		methods: {
+			onBack() {
+				uni.navigateBack({
+					delta: 1
+				})
+			}
+
+		}
+
+	}
+</script>
+
+<style>
+	.hardware-border {
+		border: 1rpx solid #9898FF;
+		box-sizing: border-box;
+	}
+
+	.guide-container {
+		/* background-color: rgba(0, 0, 0, 0.3); */
+		width: 750rpx;
+		flex: 1;
+	}
+
+	.level-mid {
+
+		justify-content: center;
+		align-items: center;
+		height: 850rpx;
+		width: 750rpx;
+	}
+
+	.level-tip-number {
+		border-radius: 18px;
+		width: 22px;
+		height: 22px;
+		text-align: center;
+		color: #FFFFFF;
+		margin-right: 13px;
+		line-height: 18px;
+		border: 1rpx solid #FFFFFF;
+	}
+</style>

+ 6 - 10
pages/platform-page/guide/guide.vue

@@ -41,8 +41,8 @@
 					// 	navType: 'feedback'
 					// },
 					{
-						gameName: '游戏指导',
-						navType: 'gameGuide'
+						gameName: '关卡指导',
+						navType: 'levelGuide'
 					}
 				],
 				title: "新手指导",
@@ -63,7 +63,7 @@
 			},
 
 			onNavTo(item) {
-				console.log(item);
+				// console.log(item);
 				let url = '';
 				switch (item.navType) {
 					case 'personalGuide':
@@ -89,14 +89,10 @@
 					case 'bluetoothConnect':
 						url = './guide-ble-scroll';
 						break;
-					case 'gameGuide':
-						uni.showToast({
-							title: '功能未实现',
-							icon: 'none'
-						})
-						return;
+					case 'levelGuide':
+						url = './guide-level-scroll';
+						break;
 				}
-				console.error(1111)
 				uni.navigateTo({
 					url: url,
 					success: res => {},

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

@@ -123,17 +123,19 @@
 			<view style="width: 750rpx;height: 764rpx;">
 				<view style="height: 596rpx;" class="mask-bg-07">
 					<view class="position-absolute-center" style="top: 0;left:31rpx;">
-						<image style="width: 626rpx;height: 596rpx;"
-							src="../../../static/common/subNVue/guide/guide-bluetooth-big@2x.png">
+						<image style="width: 442rpx;height: 372rpx;"
+							src="../../../static/common/subNVue/guide/guide-bluetooth@3x.png">
 						</image>
 					</view>
-					<view class="position-absolute-center ">
-						<text class="text-left  text-white text-14px"
+					<view class="position-absolute-center" >
+						<text class="text-white text-14px" style="left: 20px;top: -5px;">请先连接蓝牙设备.</text>
+						<!-- <text class="text-left  text-white text-14px"
 							style="width: 542rpx;">1、长按开关键3秒,绿灯连续闪烁为可连接状态.</text>
 						<text class="text-left  text-white text-14px" style="width: 542rpx;">2、选择设备类型进行连接.</text>
 						<text class="text-left  text-white text-14px"
 							style="width: 542rpx;">3、手柄连接成功后,将手柄十字键朝上插入绑带中.</text>
 						<text class="text-left  text-white text-14px" style="width: 542rpx;">4、用绑带将手柄朝上绑在右脚脚踝上.</text>
+					 -->
 					</view>
 				</view>
 				<view style="width: 750rpx;height: 168rpx;" class="flex flex-direction-row">
@@ -180,9 +182,9 @@
 				</image>
 
 
-				<image style="width: 232rpx;height: 78rpx;margin-top: 48rpx;"
+				<!-- <image style="width: 232rpx;height: 78rpx;margin-top: 48rpx;"
 					src="../../../static/common/subNVue/guide/level-game-next@2x.png"></image>
-
+ -->
 
 			</view>
 		</view>

BIN
static/modal/action-jump/boom.png


+ 11 - 0
util/util-css/main.css

@@ -4581,3 +4581,14 @@ scroll-view.cu-steps .cu-item {
 	font-size: 400;
 }
 
+
+
+
+/* ==================
+         蒙层 透明度
+ ==================== */
+.mask-bg-07 {
+	background-color: rgba(0, 0, 0, 0.7);
+}
+
+

+ 209 - 0
util/util-js/effect/firework.js

@@ -0,0 +1,209 @@
+/**
+ * 烟花特效
+ */
+function Event() {
+	this.events = {};
+}
+Event.prototype.addEventListener = function(type, listener) {
+	this.events[type] = this.events[type] || [];
+	this.events[type].push(listener);
+};
+Event.prototype.trigger = function() {
+	for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
+		args[_key] = arguments[_key];
+	}
+
+	var type = args[0];
+	var params = args.slice(1);
+	if (!!this.events[type]) {
+		// console.log("type:",type);
+		this.events[type].forEach(function(listener) {
+			try {
+				listener.apply(null, params);
+			} catch (e) {
+				console.error(e);
+			}
+		});
+	}
+};
+// get a random number within a range
+function random(min, max) {
+	return Math.random() * (max - min) + min;
+}
+
+// calculate the distance between two points
+function calculateDistance(p1x, p1y, p2x, p2y) {
+	var xDistance = p1x - p2x,
+		yDistance = p1y - p2y;
+	return Math.sqrt(Math.pow(xDistance, 2) + Math.pow(yDistance, 2));
+}
+
+
+// create firework
+var Firework = function Firework(image, typeImage, direction, tx, ty, cw, ch) {
+	this.event = new Event();
+	//图片信息
+	this.image = image;
+	this.typeImage = typeImage;
+	this.direction = direction;
+	this.position = {
+		"EF_baozha_0": [0, 0, 312, 312],
+		"EF_baozha_1": [312, 0, 312, 312],
+		"EF_baozha_2": [624, 0, 312, 312],
+		"EF_baozha_3": [936, 0, 312, 312],
+		"EF_baozha_4": [0, 312, 312, 312],
+		"EF_baozha_5": [312, 312, 312, 312],
+		"EF_baozha_6": [624, 312, 312, 312],
+		"EF_baozha_7": [936, 312, 312, 312],
+		"EF_baozha_8": [0, 624, 312, 312],
+		"EF_baozha_9": [312, 624, 312, 312],
+		"EF_baozha_10": [624, 624, 312, 312],
+		"EF_baozha_11": [936, 624, 312, 312],
+		"EF_baozha_12": [0, 936, 312, 312],
+		"EF_baozha_13": [312, 936, 312, 312],
+		"EF_baozha_14": [624, 936, 312, 312],
+		"EF_baozha_15": [936, 936, 312, 312],
+		"EF_baozha_16": [0, 1248, 312, 312],
+		"EF_baozha_17": [312, 1248, 312, 312],
+		"EF_baozha_18": [624, 1248, 312, 312],
+		"EF_baozha_19": [936, 1248, 312, 312]
+	};
+	// target coordinates
+	this.tx = tx;
+	this.ty = ty;
+
+	this.cw = cw;
+	this.ch = ch;
+
+	this.index = 0;
+	// let _this = this;
+	// this.animationInstance = new Animation({
+	// 	timing: 'easeIn',
+	// 	duration: 1000,
+	// 	onProcess: function onProcess(process) {
+	// 		_this.event.trigger('renderProcess', process);
+
+	// 	},
+	// 	onAnimationFinish: function onAnimationFinish() {
+	// 		_this.event.trigger('renderComplete');
+	// 	}
+	// });
+}
+
+Firework.prototype.addEventListener = function(type, listener) {
+	this.event.addEventListener(type, listener);
+};
+
+// draw firework
+Firework.prototype.draw = function(ctx, callback) {
+	if (this.index > 19) return;
+	let i = this.index;
+	let temp = this.position["EF_baozha_" + i];
+	// console.log("draw:"+this.direction);
+	let tempX = this.tx * this.direction;
+	let tempValue = this.direction < 0 ? 20 : -20
+	ctx.drawImage(this.image.path,
+		temp[0] //截取原始图片的 x坐标
+		, temp[1] //截取原始图片的 y坐标
+		, 312 //截取原始图片的 宽度
+		, 312 // 截取的高度
+		, tempX - 164 * 0.5 - tempValue //图片在canvas画布上的x坐标
+		, 0 //图片在canvas画布上的y坐标
+		, 164 //绘制图片的宽度
+		, 164 //绘制图片的高度
+	);
+	let _r = this.index / 19;
+	ctx.save();
+	//如果是相反绘制,需要加多一个自身位置偏移
+	let _pos = this.direction < 0 ? this.typeImage.width : 0;
+	//左边位置
+	let left = (this.typeImage.width + tempX - 164 * 0.5) - (this.typeImage.width / 2 - _pos) * _r + 20 - tempValue;
+	// 中心点 this.cw / 2 - this.typeImage.width / 2 * _r
+	ctx.translate(left, this.ch / 2 - this.typeImage.height / 2 * _r);
+	ctx.scale(_r * this.direction, _r);
+	ctx.drawImage(this.typeImage.path, 0, 0);
+	ctx.restore();
+	if (i === 19 && callback) {
+		callback();
+	}
+	this.index++;
+
+}
+var Timing = {
+	easeIn: function easeIn(pos) {
+		return Math.pow(pos, 3);
+	},
+	easeOut: function easeOut(pos) {
+		return Math.pow(pos - 1, 3) + 1;
+	},
+	easeInOut: function easeInOut(pos) {
+		if ((pos /= 0.5) < 1) {
+			return 0.5 * Math.pow(pos, 3);
+		} else {
+			return 0.5 * (Math.pow(pos - 2, 3) + 2);
+		}
+	},
+	linear: function linear(pos) {
+		return pos;
+	}
+};
+
+function Animation(opts) {
+	this.isStop = false;
+	opts.duration = typeof opts.duration === 'undefined' ? 1000 : opts.duration;
+	opts.timing = opts.timing || 'linear';
+	var delay = 17;
+
+	function createAnimationFrame() {
+		if (typeof setTimeout !== 'undefined') {
+			return function(step, delay) {
+				setTimeout(function() {
+					var timeStamp = +new Date();
+					step(timeStamp);
+				}, delay);
+			};
+		} else if (typeof requestAnimationFrame !== 'undefined') {
+			return requestAnimationFrame;
+		} else {
+			return function(step) {
+				step(null);
+			};
+		}
+	};
+	var animationFrame = createAnimationFrame();
+	var startTimeStamp = null;
+	var _step = function step(timestamp) {
+		if (timestamp === null || this.isStop === true) {
+			opts.onProcess && opts.onProcess(1);
+			opts.onAnimationFinish && opts.onAnimationFinish();
+			return;
+		}
+		if (startTimeStamp === null) {
+			startTimeStamp = timestamp;
+		}
+		if (timestamp - startTimeStamp < opts.duration) {
+			var process = (timestamp - startTimeStamp) / opts.duration;
+			var timingFunction = Timing[opts.timing];
+			process = timingFunction(process);
+
+			opts.onProcess && opts.onProcess(process);
+			animationFrame(_step, delay);
+		} else {
+			opts.onProcess && opts.onProcess(1);
+			opts.onAnimationFinish && opts.onAnimationFinish();
+		}
+	};
+	_step = _step.bind(this);
+	animationFrame(_step, delay);
+}
+
+// stop animation immediately
+// and tigger onAnimationFinish
+Animation.prototype.stop = function() {
+	this.isStop = true;
+};
+
+
+if (typeof module === "object" && typeof module.exports === "object") {
+	module.exports = Firework;
+}

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

@@ -2834,10 +2834,11 @@ const store = new Vuex.Store({
 				}
 				if (value == "3") {
 					if (state.bListenerUpdate) {
-						uni.showToast({
-							title: "原始数据已开启"
-						})
-						return;
+						// uni.showToast({
+						// 	title: "原始数据已开启"
+						// })
+						console.warn("原始数据已开启");
+						// return;
 					}
 					state.bListenerUpdate = true;
 				}