Переглянути джерело

1.修改了推荐,游戏列表 的接口,替换成了有平台区分接口
2.添加了方向识别算法
3.修复了首页显示mode 问题;
4.requstUtil.js head 添加了一个platform 参数
5.添加了一个获取当前app 支持 的versionCode,用于限制显示的接口。

slambb 5 роки тому
батько
коміт
6a4bee4af7

+ 6 - 1
App.vue

@@ -18,7 +18,12 @@
 					this.$store.state.clientName = res.model
 					this.$store.state.clientName = res.model
 					this.$store.state.system = res.system
 					this.$store.state.system = res.system
 					this.$store.state.platform = res.platform
 					this.$store.state.platform = res.platform
-
+					
+					if(res.platform == "ios"){
+						uni.setStorageSync("platform",1);
+					}else if(res.platform == "android"){
+						uni.setStorageSync("platform",0);
+					}
 				},
 				},
 				fail: (err) => {},
 				fail: (err) => {},
 				complete: () => {}
 				complete: () => {}

+ 14 - 5
common/config.js

@@ -1,12 +1,13 @@
 //设置游戏列表的更新时间,超过这个时间,不显示出来
 //设置游戏列表的更新时间,超过这个时间,不显示出来
 //"2020-07-14"
 //"2020-07-14"
-const endTime = "2021-01-24"
+//************* ios 注意此时间设置,目前设置2021-01-24,暂时用于处理游戏显示 *************
+const endTime = "2021-02-24"
 
 
 
 
 //线上地址,腾讯云服务器
 //线上地址,腾讯云服务器
-const host="https://www.9527fun.cn/api_prd"
+// 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.112: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://47.104.216.192:9090/api_dev"
@@ -41,6 +42,9 @@ const URL = {
 	//添加前端设备的信息
 	//添加前端设备的信息
 	ADDCLIENTINFO:`${host}/program/add_client_info`,
 	ADDCLIENTINFO:`${host}/program/add_client_info`,
 	
 	
+	//获取version code 状态,用于处理特定信息显示
+	GETVERSIONCODE:`${host}/program/get_version_code_state`,
+	
 	
 	
 	// 获取用户信息
 	// 获取用户信息
 	USERINFOURL: `${host}/user_info/get`,
 	USERINFOURL: `${host}/user_info/get`,
@@ -72,12 +76,17 @@ const URL = {
 	GAMEDETAIL: `${host}/game/detail`,
 	GAMEDETAIL: `${host}/game/detail`,
 	//获取推荐列表
 	//获取推荐列表
 	GAMERECOMMEND: `${host}/game/recommend_list`,
 	GAMERECOMMEND: `${host}/game/recommend_list`,
+	GAMERECOMMENDBYPLATFORM: `${host}/game/recommend_list_platform`,
 	//获取游戏类目
 	//获取游戏类目
 	GAMECATEGORY: `${host}/game/game_category_list`,
 	GAMECATEGORY: `${host}/game/game_category_list`,
 	//根据游戏类目获取游戏列表
 	//根据游戏类目获取游戏列表
 	GAMELIST_FROM_CATEGORY: `${host}/game/list_from_category`,
 	GAMELIST_FROM_CATEGORY: `${host}/game/list_from_category`,
+	GAMELIST_FROM_CATEGORY_PLATFORM: `${host}/game/list_from_category_platform`,
+	
 	//根据游戏显示获取游戏列表
 	//根据游戏显示获取游戏列表
 	GAMELIST_BY_RANKING_SHOW: `${host}/game/list_by_ranking_show`,
 	GAMELIST_BY_RANKING_SHOW: `${host}/game/list_by_ranking_show`,
+	GAMELIST_BY_RANKING_SHOW_AND_PLATFORM: `${host}/game/list_by_ranking_show_and_platform`,
+	
 	//收藏
 	//收藏
 	//添加
 	//添加
 	FAVORITESADD: `${host}/favorites/add`,
 	FAVORITESADD: `${host}/favorites/add`,
@@ -85,12 +94,12 @@ const URL = {
 	FAVORITESMODIFY: `${host}/favorites/modify`,
 	FAVORITESMODIFY: `${host}/favorites/modify`,
 	//获取收藏 列表
 	//获取收藏 列表
 	FAVORITESGET: `${host}/favorites/get`,
 	FAVORITESGET: `${host}/favorites/get`,
-
+	FAVORITESGETBYPLATFORM: `${host}/favorites/get_by_platform`,
 	//添加 最近玩 列表
 	//添加 最近玩 列表
 	RECENTLYPLAYINGADD: `${host}/recently_playing/add`,
 	RECENTLYPLAYINGADD: `${host}/recently_playing/add`,
 	//获取 最近玩 列表
 	//获取 最近玩 列表
 	RECENTLYPLAYINGGET: `${host}/recently_playing/get`,
 	RECENTLYPLAYINGGET: `${host}/recently_playing/get`,
-
+	RECENTLYPLAYINGGETBYPLATFORM: `${host}/recently_playing/get_by_platform`,
 	//添加当前排行榜游戏,
 	//添加当前排行榜游戏,
 	MOTIFYRANKGAME: `${host}/ranking/add_rank_game`,
 	MOTIFYRANKGAME: `${host}/ranking/add_rank_game`,
 	//获取排行榜里面的游戏
 	//获取排行榜里面的游戏

+ 2 - 2
manifest.json

@@ -2,8 +2,8 @@
     "name" : "哔蹦",
     "name" : "哔蹦",
     "appid" : "__UNI__2635DF5",
     "appid" : "__UNI__2635DF5",
     "description" : "",
     "description" : "",
-    "versionName" : "2.2.2",
-    "versionCode" : 21021601,
+    "versionName" : "2.2.7",
+    "versionCode" : 21022402,
     "transformPx" : false,
     "transformPx" : false,
     /* 5+App特有相关 */
     /* 5+App特有相关 */
     "app-plus" : {
     "app-plus" : {

+ 2 - 0
pages/Loading-page/Loading/Loading.vue

@@ -46,6 +46,7 @@
 								}
 								}
 
 
 							});
 							});
+							
 
 
 						} else {
 						} else {
 							//如果token 不合法,不存在,跳转登录页面
 							//如果token 不合法,不存在,跳转登录页面
@@ -59,6 +60,7 @@
 				//如果没有token,进入登录界面
 				//如果没有token,进入登录界面
 				_self.onNavTo("login");
 				_self.onNavTo("login");
 			}
 			}
+			
 		},
 		},
 		methods: {
 		methods: {
 			...mapMutations(['accountLogin']),
 			...mapMutations(['accountLogin']),

+ 6 - 3
pages/game-page/game-play-sub/subGame/subGame.nvue

@@ -774,9 +774,10 @@
 								// console.log('gUpdateFilter callback:',res)
 								// console.log('gUpdateFilter callback:',res)
 
 
 								let temp = {
 								let temp = {
-									direction: "allCount",
-									name: "击中",
-									ename: "hit",
+									direction: res.direction,
+									angle:res.angle,
+									name: res.name,
+									ename: res.ename,
 									value: res.hit,
 									value: res.hit,
 									mass: 10, //质量
 									mass: 10, //质量
 									hitPower: res.hit //计算的力
 									hitPower: res.hit //计算的力
@@ -841,6 +842,7 @@
 				// console.log(direction, direValue, power);
 				// console.log(direction, direValue, power);
 				let temp = {
 				let temp = {
 					direction: direction,
 					direction: direction,
+					angle: 0,
 					name: name,
 					name: name,
 					ename: ename,
 					ename: ename,
 					value: direValue,
 					value: direValue,
@@ -866,6 +868,7 @@
 					console.log(e);
 					console.log(e);
 					let temp = {
 					let temp = {
 						direction: "allCount",
 						direction: "allCount",
+						angle: 0,
 						name: "击中",
 						name: "击中",
 						ename: "hit",
 						ename: "hit",
 						value: e.acc,
 						value: e.acc,

+ 10 - 7
pages/game-page/game-ranking/game-ranking.vue

@@ -150,8 +150,11 @@
 						<view class="cu-form-group margin-top">
 						<view class="cu-form-group margin-top">
 							<view v-if="playRankingGames.length!=0" class="grid col-4 homepage-grid-square flex-sub ">
 							<view v-if="playRankingGames.length!=0" class="grid col-4 homepage-grid-square flex-sub ">
 								<view v-for="(item,index) in playRankingGames" :key="index" v-if="index<4" @tap="onChangeGame(item)">
 								<view v-for="(item,index) in playRankingGames" :key="index" v-if="index<4" @tap="onChangeGame(item)">
-									<image class="item-img" :src="item.gameIcon" mode="aspectFill"></image>
-									<view class="border text-center text-cut">{{item.gameName}}</view>
+									<block v-if="platform == gamePlatform[item.platform] || item.platform == 2">
+										<image class="item-img" :src="item.gameIcon" mode="aspectFill"></image>
+										<view class="border text-center text-cut">{{item.gameName}}</view>
+									</block>
+									
 								</view>
 								</view>
 							</view>
 							</view>
 							<view v-else class="text-center text-gray" :style="{width:'100%'}">去玩游戏吧~</view>
 							<view v-else class="text-center text-gray" :style="{width:'100%'}">去玩游戏吧~</view>
@@ -181,8 +184,8 @@
 					</view>
 					</view>
 					<scroll-view scroll-y="true" style="height: 250px;" class="cu-item">
 					<scroll-view scroll-y="true" style="height: 250px;" class="cu-item">
 						<view class="cu-form-group ">
 						<view class="cu-form-group ">
-							<view v-if="allGames.length!=0" class="grid col-4 homepage-grid-square flex-sub ">
-								<view v-for="(item,index) in allGames" :key="index" @tap="onChangeGame(item)">
+							<view v-if="versionCodeState&&versionCodeState.showGame&&allGames.length!=0" class="grid col-4 homepage-grid-square flex-sub ">
+								<view v-if="platform == gamePlatform[item.platform] || item.platform == 2"  v-for="(item,index) in allGames" :key="index" @tap="onChangeGame(item)">
 									<image class="item-img" :src="item.gameIcon" mode="aspectFill"></image>
 									<image class="item-img" :src="item.gameIcon" mode="aspectFill"></image>
 									<view class="border text-center margin-bottom text-cut">{{item.gameName}}</view>
 									<view class="border text-center margin-bottom text-cut">{{item.gameName}}</view>
 								</view>
 								</view>
@@ -206,7 +209,7 @@
 	} from 'vuex'
 	} from 'vuex'
 
 
 	export default {
 	export default {
-		computed: mapState(['rankSelectedGame', 'rankInfo', 'cityName', 'city', 'playRankingGames', 'playGames', 'hasLogin', 'allGames']),
+		computed: mapState(['rankSelectedGame', 'rankInfo', 'cityName', 'city', 'playRankingGames', 'playGames', 'hasLogin', 'allGames','platform','gamePlatform','versionCodeState']),
 		data() {
 		data() {
 			return {
 			return {
 				pageTitle: '排行榜',
 				pageTitle: '排行榜',
@@ -290,8 +293,8 @@
 			
 			
 
 
 			//获取最近玩的游戏列表
 			//获取最近玩的游戏列表
-			reqUtil.requestData(config.URL.RECENTLYPLAYINGGET).then(res => {
-					console.log('RECENTLYPLAYINGGET =====', res);
+			reqUtil.requestData(config.URL.RECENTLYPLAYINGGETBYPLATFORM).then(res => {
+					console.log('RECENTLYPLAYINGGETBYPLATFORM =====', res);
 					if (res.code == 0 && res.data.gameList) {
 					if (res.code == 0 && res.data.gameList) {
 						// that.$store.state.playRankingGames = res.data.gameList;
 						// that.$store.state.playRankingGames = res.data.gameList;
 						let _arry = [];
 						let _arry = [];

+ 17 - 6
pages/game-page/game/game.vue

@@ -28,7 +28,7 @@
 		</view>
 		</view>
 
 
 		<scroll-view scroll-y="true" :style="{ height: scrollviewHigh + 'px' }" @scrolltolower="lower">
 		<scroll-view scroll-y="true" :style="{ height: scrollviewHigh + 'px' }" @scrolltolower="lower">
-			<view class="game-item card-view" v-for="(item, index) in gameList" :key="index" :data-id="index">
+			<view v-if="gameShow" class="game-item card-view" v-for="(item, index) in gameList" :key="index" :data-id="index">
 				<view @tap="onNavToWebviewGame(item)">
 				<view @tap="onNavToWebviewGame(item)">
 					<view class="game-image-container">
 					<view class="game-image-container">
 						<image mode="aspectFill" class="game-item-image" :src="item.gamePicture"></image>
 						<image mode="aspectFill" class="game-item-image" :src="item.gamePicture"></image>
@@ -65,7 +65,7 @@
 					</view>
 					</view>
 				</view>
 				</view>
 			</view>
 			</view>
-			<view v-if="gameList.length == 0" class="text-16px text-gray text-center margin">没有更多数据</view>
+			<view v-if="!gameShow || gameList.length == 0" class="text-16px text-gray text-center margin">没有更多数据</view>
 			<view style="height: 17px;"></view>
 			<view style="height: 17px;"></view>
 		</scroll-view>
 		</scroll-view>
 
 
@@ -95,7 +95,7 @@
 			sideBar,
 			sideBar,
 			roundMenu
 			roundMenu
 		},
 		},
-		computed: mapState(['ConnectBindingDevice', 'BLEConnectDevice', 'cIndex']),
+		computed: mapState(['ConnectBindingDevice', 'BLEConnectDevice', 'cIndex','versionCodeState','platform','gamePlatform']),
 		data() {
 		data() {
 			return {
 			return {
 				tabList: [],
 				tabList: [],
@@ -111,7 +111,9 @@
 				gameList: [],
 				gameList: [],
 				gamePage: 1,
 				gamePage: 1,
 				gameSize: 10,
 				gameSize: 10,
-
+				
+				//默认显示
+				gameShow: true,
 				//编码的item
 				//编码的item
 				encodeItem: '',
 				encodeItem: '',
 
 
@@ -324,7 +326,7 @@
 				})
 				})
 				//获得游戏列表
 				//获得游戏列表
 				reqUtil.requestData(
 				reqUtil.requestData(
-					config.URL.GAMELIST_FROM_CATEGORY, {
+					config.URL.GAMELIST_FROM_CATEGORY_PLATFORM, {
 						categoryType: categoryType,
 						categoryType: categoryType,
 						//endTime 可以不设置,服务器默认设置一个值
 						//endTime 可以不设置,服务器默认设置一个值
 						endTime: config.endTime,
 						endTime: config.endTime,
@@ -332,7 +334,7 @@
 						size: this.gameSize
 						size: this.gameSize
 					}
 					}
 				).then(res => {
 				).then(res => {
-						console.log('GAMELIST_FROM_CATEGORY =====', res);
+						console.log('GAMELIST_FROM_CATEGORY_PLATFORM =====', res);
 						if (res.code == 0) {
 						if (res.code == 0) {
 							uni.hideToast();
 							uni.hideToast();
 
 
@@ -352,6 +354,15 @@
 								})
 								})
 							}
 							}
 							this.gameList = this.gameList.concat(res.data);
 							this.gameList = this.gameList.concat(res.data);
+							
+							if (categoryType == 1) {
+								//game
+								this.gameShow = this.versionCodeState.showGame;
+								
+							} else if (categoryType == 2) {
+								//game
+								this.gameShow = this.versionCodeState.showVideo;
+							}
 						}
 						}
 					},
 					},
 					e => {
 					e => {

+ 6 - 6
pages/my-page/homepage/homepage.vue

@@ -74,7 +74,7 @@
 			<view class="cu-item shadow">
 			<view class="cu-item shadow">
 				<view class="cu-form-group margin-top">
 				<view class="cu-form-group margin-top">
 					<view v-if="favoriteGames.length!=0" class="grid col-3 homepage-grid-square flex-sub ">
 					<view v-if="favoriteGames.length!=0" class="grid col-3 homepage-grid-square flex-sub ">
-						<view class="text-center "  v-for="(item,index) in favoriteGames" :key="index" v-if="index<6" @tap="onViewImage(item)">
+						<view  class="text-center "  v-for="(item,index) in favoriteGames" :key="index" v-if="index<6" @tap="onViewImage(item)">
 							<image class="item-img" :src="item.gameIcon" mode="aspectFill"></image>
 							<image class="item-img" :src="item.gameIcon" mode="aspectFill"></image>
 							<view class="border text-cut">{{item.gameName}}</view>
 							<view class="border text-cut">{{item.gameName}}</view>
 						</view>
 						</view>
@@ -96,12 +96,12 @@
 
 
 	export default {
 	export default {
 		computed: mapState(['forcedLogin', 'hasLogin', 'userName', 'avatarUrl', 'playGames', 'favoriteGames', 'days',
 		computed: mapState(['forcedLogin', 'hasLogin', 'userName', 'avatarUrl', 'playGames', 'favoriteGames', 'days',
-			'signature'
+			'signature','platform','gamePlatform'
 		]),
 		]),
 		onLoad() {
 		onLoad() {
 			let that = this;
 			let that = this;
-			reqUtil.requestData(config.URL.RECENTLYPLAYINGGET).then(res => {
-					console.log('RECENTLYPLAYINGGET =====', res);
+			reqUtil.requestData(config.URL.RECENTLYPLAYINGGETBYPLATFORM).then(res => {
+					console.log('RECENTLYPLAYINGGETBYPLATFORM =====', res);
 					if (res.code == 0) {
 					if (res.code == 0) {
 						that.$store.state.playGames = res.data.gameList;
 						that.$store.state.playGames = res.data.gameList;
 					}
 					}
@@ -111,8 +111,8 @@
 					console.log(e)
 					console.log(e)
 				});
 				});
 
 
-			reqUtil.requestData(config.URL.FAVORITESGET).then(res => {
-					console.log('FAVORITESADD =====', res);
+			reqUtil.requestData(config.URL.FAVORITESGETBYPLATFORM).then(res => {
+					console.log('FAVORITESGETBYPLATFORM =====', res);
 					if (res.code == 0) {
 					if (res.code == 0) {
 						that.$store.state.favoriteGames = res.data.gameList;
 						that.$store.state.favoriteGames = res.data.gameList;
 					}
 					}

+ 54 - 61
pages/personal-page/devices-hardware/devices-hardware.vue

@@ -27,6 +27,7 @@
 				 mode="aspectFit" @tap="_onRadio(item,$event)"></image>
 				 mode="aspectFit" @tap="_onRadio(item,$event)"></image>
 			</view>
 			</view>
 		</view>
 		</view>
+		<!-- <button @click="onGetDevice()"> onGetDevice</button> -->
 
 
 	</view>
 	</view>
 
 
@@ -68,7 +69,9 @@
 				bLimitClose: false,
 				bLimitClose: false,
 
 
 				//是否需要检测发起的连接蓝牙是否匹配上
 				//是否需要检测发起的连接蓝牙是否匹配上
-				bTestBondConnect: true
+				bTestBondConnect: true,
+				//是否显示
+				bShow:true,
 			}
 			}
 		},
 		},
 		onLoad(op) {
 		onLoad(op) {
@@ -101,7 +104,7 @@
 			this.onClearTimeout();
 			this.onClearTimeout();
 		},
 		},
 		onShow() {
 		onShow() {
-
+			this.bShow = true;
 			this.bLimitClose = false;
 			this.bLimitClose = false;
 			console.log(this.cIndex, this.BLEDeviceShowList, this.BLEConnectDevice, this.devicesList);
 			console.log(this.cIndex, this.BLEDeviceShowList, this.BLEConnectDevice, this.devicesList);
 			//this.bConnection &&
 			//this.bConnection &&
@@ -115,7 +118,11 @@
 						eq.bRatio = true;
 						eq.bRatio = true;
 						this.currentItem = eq;
 						this.currentItem = eq;
 
 
-						this.onCheckBondDevice();
+						setTimeout(() => {
+							this.onCheckBondDevice();
+						}, 5000)
+						
+						
 					}
 					}
 				}
 				}
 			} else {
 			} else {
@@ -129,7 +136,10 @@
 
 
 
 
 		},
 		},
-		onHide() {},
+		onHide() {
+			//如果蓝牙弹出匹配框,会触发onHide。这时候处理蓝牙连接流程检测应等onShow 时候,再检测
+			this.bShow = false;
+		},
 		methods: {
 		methods: {
 			...mapMutations(['initAdapter', 'onCreateBLESuccess', 'onGetBLEDeviceServices', 'onOnlyCloseBLEConnection',
 			...mapMutations(['initAdapter', 'onCreateBLESuccess', 'onGetBLEDeviceServices', 'onOnlyCloseBLEConnection',
 				'onGetRSSITransDistance',
 				'onGetRSSITransDistance',
@@ -160,7 +170,7 @@
 			},
 			},
 			//监听回调
 			//监听回调
 			onListenerBLE(res) {
 			onListenerBLE(res) {
-				console.log('onListenerBLE:', res);
+				// console.log('onListenerBLE:', res);
 				if (res.type !== 'mac') return;
 				if (res.type !== 'mac') return;
 				//如果mac 回调了不用提示
 				//如果mac 回调了不用提示
 				if (this.searchMac) {
 				if (this.searchMac) {
@@ -209,6 +219,7 @@
 							);
 							);
 
 
 						} else if (res.code == 721) {
 						} else if (res.code == 721) {
+							// console.log("~~:",_self.saveObj);
 							//是自己绑定的,添加设备
 							//是自己绑定的,添加设备
 							if (_self.saveObj == null) return;
 							if (_self.saveObj == null) return;
 							_self.addBLEDevice(_self.saveObj);
 							_self.addBLEDevice(_self.saveObj);
@@ -220,8 +231,8 @@
 							//res.code = 722  蓝牙设备别人使用过
 							//res.code = 722  蓝牙设备别人使用过
 							uni.hideToast();
 							uni.hideToast();
 							uni.showModal({
 							uni.showModal({
-								title: '绑定蓝牙失败',
-								content: res.msg + ',可重新尝试连接。如有疑问请联系官方客服。'
+								title: '连接失败',
+								content:'当前手柄已经被其它账号绑定。'
 							})
 							})
 							//关闭当前连接
 							//关闭当前连接
 							_self.onOnlyCloseBLEConnection({
 							_self.onOnlyCloseBLEConnection({
@@ -258,16 +269,22 @@
 						 */
 						 */
 						this.$store.state.bVerifiedConnection = true;
 						this.$store.state.bVerifiedConnection = true;
 
 
-						this.onCheckBondDevice();
+						setTimeout(() => {
+							this.onCheckBondDevice();
+						}, 5000)
+						
 					}
 					}
 				}
 				}
 			},
 			},
 			onCheckBondDevice() {
 			onCheckBondDevice() {
-				if (this.bTestBondConnect) {
+				console.log("onCheckBondDevice",this.bTestBondConnect);
+				if (this.bTestBondConnect && this.bShow) {
 					/**
 					/**
 					 * 假如手机没有匹配,断开连接
 					 * 假如手机没有匹配,断开连接
 					 */
 					 */
+					console.log(2,this.finallyUseDevice);
 					this.B_GetBondedDevices({
 					this.B_GetBondedDevices({
+						deviceId:this.finallyUseDevice.deviceId,
 						success: (bondedDevice) => {
 						success: (bondedDevice) => {
 							uni.hideToast();
 							uni.hideToast();
 							if (bondedDevice == null) {
 							if (bondedDevice == null) {
@@ -330,7 +347,7 @@
 					// uni.hideToast();
 					// uni.hideToast();
 					// console.log("//假如匹配过程中断开连接");
 					// console.log("//假如匹配过程中断开连接");
 					uni.showToast({
 					uni.showToast({
-						title: '连接失败,请检查设备是否正常。',
+						title: '连接失败,尝试重新连接。',
 						icon: 'none',
 						icon: 'none',
 						mask: true,
 						mask: true,
 						duration: 2000
 						duration: 2000
@@ -351,54 +368,6 @@
 				if (_self.bOpenBluetooth) {
 				if (_self.bOpenBluetooth) {
 					//1.第一步还是先进行设备搜索
 					//1.第一步还是先进行设备搜索
 					_self.onCanStart();
 					_self.onCanStart();
-					// //先查询最近使用的硬件,如果最近使用的和当前需要连接的item id一样,则认为是
-					// if (_self.finallyUseDevice !== null) {
-					// 	if (_self.finallyUseDevice.id == _self.currentItem.id) {
-					// 		//currentItem 是mode 页面选中的item
-					// 		let obj = Object.assign({}, _self.finallyUseDevice, _self.currentItem);
-					// 		//finallyUserDevice 就是最后一次使用搜索到的设备信息
-					// 		_self.saveObj = _self.finallyUseDevice;
-					// 		uni.showToast({
-					// 			title: '设备连接中...',
-					// 			icon: 'loading',
-					// 			duration: 12000,
-					// 			mask: true
-					// 		})
-					// 		// 先直连,然后判断版本
-					// 		_self._onConnectDevice(obj);
-					// 	} else {
-
-					// 		uni.showModal({
-					// 			title: '连接提示!',
-					// 			content: "1.确定则连接最近使用的设备。\r\n2.取消则重新搜索设备。",
-					// 			success: (res) => {
-					// 				if (res.confirm) {
-					// 					//currentItem 是mode 页面选中的item
-					// 					let obj = Object.assign({}, _self.finallyUseDevice, _self.currentItem);
-					// 					//finallyUserDevice 就是最后一次使用搜索到的设备信息
-					// 					_self.saveObj = Object.assign({}, _self.finallyUseDevice, {
-					// 						id: _self.currentItem.id
-					// 					});
-					// 					uni.showToast({
-					// 						title: '设备连接中...',
-					// 						icon: 'loading',
-					// 						duration: 12000,
-					// 						mask: true
-					// 					})
-					// 					console.log("_onConnectDevice:::===", obj);
-					// 					// 先直连,然后判断版本
-					// 					_self._onConnectDevice(obj);
-					// 				} else if (res.cancel) {
-					// 					_self.onBondedDeviceConnect();
-					// 				}
-					// 			}
-					// 		})
-
-					// 	}
-					// } else {
-					// 	_self.onBondedDeviceConnect();
-					// }
-
 				} else {
 				} else {
 					_self.initAdapter(() => {
 					_self.initAdapter(() => {
 						_self.startBluetoothDeviceDiscovery();
 						_self.startBluetoothDeviceDiscovery();
@@ -419,7 +388,11 @@
 				// 	"localName": "BGBox_20201",
 				// 	"localName": "BGBox_20201",
 				// 	"advertisServiceUUIDs": ["00001812-0000-1000-8000-00805F9B34FB", "0000FFF0-0000-1000-8000-00805F9B34FB"]
 				// 	"advertisServiceUUIDs": ["00001812-0000-1000-8000-00805F9B34FB", "0000FFF0-0000-1000-8000-00805F9B34FB"]
 				// }
 				// }
+				
+				console.log("onBoded ***************:",_self.finallyUseDevice);
+				
 				_self.B_GetBondedDevices({
 				_self.B_GetBondedDevices({
+					deviceId:_self.finallyUseDevice == null?null:_self.finallyUseDevice.deviceId,
 					success: (bondedDevice) => {
 					success: (bondedDevice) => {
 						console.log("bondedDevice:",bondedDevice);
 						console.log("bondedDevice:",bondedDevice);
 						//获取已和蓝牙连接的设备
 						//获取已和蓝牙连接的设备
@@ -432,7 +405,7 @@
 								"localName": "",
 								"localName": "",
 								"advertisServiceUUIDs": ["00001812-0000-1000-8000-00805F9B34FB", "0000FFF0-0000-1000-8000-00805F9B34FB"]
 								"advertisServiceUUIDs": ["00001812-0000-1000-8000-00805F9B34FB", "0000FFF0-0000-1000-8000-00805F9B34FB"]
 							}
 							}
-
+							
 							let obj = Object.assign({}, setDevice, _self.currentItem);
 							let obj = Object.assign({}, setDevice, _self.currentItem);
 							//finallyUserDevice 就是最后一次使用搜索到的设备信息
 							//finallyUserDevice 就是最后一次使用搜索到的设备信息
 							_self.saveObj = Object.assign({}, setDevice, {
 							_self.saveObj = Object.assign({}, setDevice, {
@@ -444,7 +417,7 @@
 							// 	duration: 12000,
 							// 	duration: 12000,
 							// 	mask: true
 							// 	mask: true
 							// })
 							// })
-							console.log("B_GetBondedDevices:::===", obj);
+							console.log("GetBondedDevices:::===",setDevice,_self.currentItem, obj);
 							// 先直连,然后判断版本
 							// 先直连,然后判断版本
 							_self._onConnectDevice(obj);
 							_self._onConnectDevice(obj);
 
 
@@ -452,6 +425,11 @@
 							_self.bTestBondConnect = false;
 							_self.bTestBondConnect = false;
 						} else {
 						} else {
 							console.log("没有获取到绑定的设备");
 							console.log("没有获取到绑定的设备");
+							uni.showToast({
+								title:'获取匹配设备失败',
+								icon:'none',
+								mask:true
+							})
 						}
 						}
 					}
 					}
 				});
 				});
@@ -624,7 +602,7 @@
 							this.onGetBLEDeviceServices({
 							this.onGetBLEDeviceServices({
 								item: item,
 								item: item,
 								success: (res) => {
 								success: (res) => {
-									console.log("******getBLEDeviceServices************", res);
+									// console.log("******getBLEDeviceServices************", res);
 									//连接成功了,设置旧的item
 									//连接成功了,设置旧的item
 									this.oldItem = this.currentItem;
 									this.oldItem = this.currentItem;
 									uni.showToast({
 									uni.showToast({
@@ -727,6 +705,21 @@
 				uni.navigateTo({
 				uni.navigateTo({
 					url: "../devices-update/devices-update?deviceType=" + this.option.deviceType
 					url: "../devices-update/devices-update?deviceType=" + this.option.deviceType
 				})
 				})
+			},
+			onGetDevice(){
+				uni.getBluetoothDevices({
+					success(res) {
+						console.log("getBluetoothDevices:", res)
+					}
+				})
+				
+				uni.getConnectedBluetoothDevices({
+					success(res) {
+						console.log("getConnectedBluetoothDevices:", res)
+					}
+				})
+				
+				
 			}
 			}
 		}
 		}
 
 

+ 10 - 6
pages/personal-page/favorites/favorites.vue

@@ -15,7 +15,7 @@
 		</view>
 		</view>
 		<view v-else class="cu-list menu margin-top">
 		<view v-else class="cu-list menu margin-top">
 			<view class="cu-item" :class="true?'arrow':''" v-for="(item,index) in gameList" :key="index">
 			<view class="cu-item" :class="true?'arrow':''" v-for="(item,index) in gameList" :key="index">
-				<view class="content" @tap="_onConnectDevice(item,$event)">
+				<view v-if="platform == gamePlatform[item.platform] || item.platform == 2" class="content" @tap="_onConnectDevice(item,$event)">
 					<image :src="item.icon" mode="aspectFit"></image>
 					<image :src="item.icon" mode="aspectFit"></image>
 					<text class="text-grey">{{item.name}}</text>
 					<text class="text-grey">{{item.name}}</text>
 				</view>
 				</view>
@@ -30,8 +30,12 @@
 <script>
 <script>
 	import reqUtil from "@/util/util-js/requstUtil.js"
 	import reqUtil from "@/util/util-js/requstUtil.js"
 	import config from "@/common/config.js"
 	import config from "@/common/config.js"
-
+	import {
+		mapState
+	} from 'vuex';
+	
 	export default {
 	export default {
+		computed: mapState(['platform','gamePlatform']),
 		data() {
 		data() {
 			return {
 			return {
 				gameList: []
 				gameList: []
@@ -60,8 +64,8 @@
 			// 		console.log(e)
 			// 		console.log(e)
 			// 	});
 			// 	});
 
 
-			reqUtil.requestData(config.URL.RECENTLYPLAYINGGET).then(res => {
-					console.log('RECENTLYPLAYINGGET =====', res);
+			reqUtil.requestData(config.URL.RECENTLYPLAYINGGETBYPLATFORM).then(res => {
+					console.log('RECENTLYPLAYINGGETBYPLATFORM =====', res);
 					if (res.code == 0) {
 					if (res.code == 0) {
 
 
 					}
 					}
@@ -76,8 +80,8 @@
 		methods: {
 		methods: {
 
 
 			onPullDownRefresh(e) {
 			onPullDownRefresh(e) {
-				reqUtil.requestData(config.URL.FAVORITESGET).then(res => {
-						console.log('FAVORITESADD =====', res);
+				reqUtil.requestData(config.URL.FAVORITESGETBYPLATFORM).then(res => {
+						console.log('FAVORITESGETBYPLATFORM =====', res);
 						if (res.code == 0) {
 						if (res.code == 0) {
 
 
 						}
 						}

+ 29 - 26
pages/personal-page/list/list.vue

@@ -10,8 +10,8 @@
 		</uni-nav-bar>
 		</uni-nav-bar>
 		<view class="card-view game-item" v-for="(item,index) in list" :key="index">
 		<view class="card-view game-item" v-for="(item,index) in list" :key="index">
 			<!-- <view class="only-arrow"> -->
 			<!-- <view class="only-arrow"> -->
-			<view class="content" @tap="onNavTo(item)">
-				<image :src="item.gameIcon" class="png"  ></image>
+			<view v-if="platform == gamePlatform[item.platform] || item.platform == 2" class="content" @tap="onNavTo(item)">
+				<image :src="item.gameIcon" class="png"></image>
 				<text class="text-black text-bold ">{{item.gameName}}</text>
 				<text class="text-black text-bold ">{{item.gameName}}</text>
 				<view class="only-arrow"></view>
 				<view class="only-arrow"></view>
 			</view>
 			</view>
@@ -25,23 +25,26 @@
 <script>
 <script>
 	import reqUtil from "@/util/util-js/requstUtil.js"
 	import reqUtil from "@/util/util-js/requstUtil.js"
 	import config from "@/common/config.js"
 	import config from "@/common/config.js"
-
+	import {
+		mapState
+	} from 'vuex';
 	export default {
 	export default {
+		computed: mapState(['platform', 'gamePlatform']),
 		data() {
 		data() {
 			return {
 			return {
 				list: [],
 				list: [],
 				title: "最近在玩",
 				title: "最近在玩",
-				type:'',
-				page:1,
-				size:10,
-				bDontUpdate:false,
+				type: '',
+				page: 1,
+				size: 10,
+				bDontUpdate: false,
 			}
 			}
 		},
 		},
 		onLoad(option) {
 		onLoad(option) {
 
 
 			let that = this;
 			let that = this;
 
 
-			if (option&&option.type) {
+			if (option && option.type) {
 				that.type = option.type;
 				that.type = option.type;
 				that.onGetData();
 				that.onGetData();
 			}
 			}
@@ -59,34 +62,34 @@
 					delta: 1
 					delta: 1
 				})
 				})
 			},
 			},
-			onReachBottom(){
-				if(this.bDontUpdate) return;
+			onReachBottom() {
+				if (this.bDontUpdate) return;
 				this.page++;
 				this.page++;
 				this.onGetData();
 				this.onGetData();
 			},
 			},
-			onGetData(){
+			onGetData() {
 				let that = this;
 				let that = this;
 				uni.showToast({
 				uni.showToast({
-					title:'',
-					icon:'loading',
-					mask:true,
-					duration:10000
+					title: '',
+					icon: 'loading',
+					mask: true,
+					duration: 10000
 				})
 				})
 				if (that.type == 'recently') {
 				if (that.type == 'recently') {
 					that.title = "最近在玩";
 					that.title = "最近在玩";
-					reqUtil.requestData(config.URL.RECENTLYPLAYINGGET,{
-						page:that.page,
-						size:that.size
+					reqUtil.requestData(config.URL.RECENTLYPLAYINGGETBYPLATFORM, {
+						page: that.page,
+						size: that.size
 					}).then(res => {
 					}).then(res => {
-							console.log('RECENTLYPLAYINGGET =====', res);
+							console.log('RECENTLYPLAYINGGETBYPLATFORM =====', res);
 							if (res.code == 0) {
 							if (res.code == 0) {
-								if(res.data.gameList.length < that.size){
+								if (res.data.gameList.length < that.size) {
 									that.bDontUpdate = true;
 									that.bDontUpdate = true;
 								}
 								}
 								that.list = that.list.concat(res.data.gameList);
 								that.list = that.list.concat(res.data.gameList);
 							}
 							}
 							uni.hideToast();
 							uni.hideToast();
-				
+
 						},
 						},
 						e => {
 						e => {
 							uni.hideToast();
 							uni.hideToast();
@@ -94,13 +97,13 @@
 						});
 						});
 				} else if (that.type == 'watchGame') {
 				} else if (that.type == 'watchGame') {
 					that.title = "关注的游戏";
 					that.title = "关注的游戏";
-					reqUtil.requestData(config.URL.FAVORITESGET,{
-						page:that.page,
-						size:that.size
+					reqUtil.requestData(config.URL.FAVORITESGETBYPLATFORM, {
+						page: that.page,
+						size: that.size
 					}).then(res => {
 					}).then(res => {
-							console.log('FAVORITESADD =====', res);
+							console.log('FAVORITESGETBYPLATFORM =====', res);
 							if (res.code == 0) {
 							if (res.code == 0) {
-								if(res.data.gameList.length < that.size){
+								if (res.data.gameList.length < that.size) {
 									that.bDontUpdate = true;
 									that.bDontUpdate = true;
 								}
 								}
 								that.list = that.list.concat(res.data.gameList);
 								that.list = that.list.concat(res.data.gameList);

+ 36 - 14
pages/personal-page/personal/personal.vue

@@ -259,7 +259,7 @@
 						</view>
 						</view>
 
 
 						<!-- 游戏推荐 -->
 						<!-- 游戏推荐 -->
-						<view class="card-view" v-if="gameList.length !== 0">
+						<view class="card-view" v-if="versionCodeState&&versionCodeState.showGame && gameList.length !== 0">
 							<view class="text-left padding margin-xs flex justify-between">
 							<view class="text-left padding margin-xs flex justify-between">
 								<text class="text-black text-15px margin-left">游戏推荐</text>
 								<text class="text-black text-15px margin-left">游戏推荐</text>
 								<view data-type="game" @tap="onNavToGameMore" class="flex text-center justify-center align-center margin-right">
 								<view data-type="game" @tap="onNavToGameMore" class="flex text-center justify-center align-center margin-right">
@@ -290,7 +290,7 @@
 						<!-- <button class="margin" @click="stopGyro">关闭手机加速计和方向传感器</button> -->
 						<!-- <button class="margin" @click="stopGyro">关闭手机加速计和方向传感器</button> -->
 						<!-- <keyboard-listener @keydown="onKeyDown"></keyboard-listener> -->
 						<!-- <keyboard-listener @keydown="onKeyDown"></keyboard-listener> -->
 						<!-- 视频推荐 -->
 						<!-- 视频推荐 -->
-						<view class="card-view" v-if="videoList.length !== 0">
+						<view class="card-view" v-if="versionCodeState&&versionCodeState.showVideo && videoList.length !== 0">
 							<view class="text-left padding margin-xs flex justify-between">
 							<view class="text-left padding margin-xs flex justify-between">
 								<text class="text-black text-15px margin-left">视频推荐</text>
 								<text class="text-black text-15px margin-left">视频推荐</text>
 								<view data-type="video" @tap="onNavToGameMore" class="flex text-center justify-center align-center margin-right">
 								<view data-type="video" @tap="onNavToGameMore" class="flex text-center justify-center align-center margin-right">
@@ -481,7 +481,8 @@
 			'currentModeIndex', 'oldArcbarProCalorie', 'oldArcbarAllCalorie', 'bOpenBluetooth', 'bOpenSuccess',
 			'currentModeIndex', 'oldArcbarProCalorie', 'oldArcbarAllCalorie', 'bOpenBluetooth', 'bOpenSuccess',
 			'bListenAdapterStateChange', 'bConnection', 'bVerifiedConnection', 'currentInstruction', 'instructionState',
 			'bListenAdapterStateChange', 'bConnection', 'bVerifiedConnection', 'currentInstruction', 'instructionState',
 			'LocationGameUrl',
 			'LocationGameUrl',
-			'bPhoneMatched'
+			'bPhoneMatched',
+			'versionCodeState'
 		]),
 		]),
 		components: {
 		components: {
 			uniNavBar,
 			uniNavBar,
@@ -736,7 +737,7 @@
 					avatar: '/static/defaultAvatar.png'
 					avatar: '/static/defaultAvatar.png'
 				},
 				},
 				currentMode: 'calorieMode', //pkMode calorieMode
 				currentMode: 'calorieMode', //pkMode calorieMode
-
+				
 				bHitShake: false,
 				bHitShake: false,
 
 
 				bAiHitShake: false,
 				bAiHitShake: false,
@@ -779,7 +780,7 @@
 
 
 			//获得游戏列表
 			//获得游戏列表
 			reqUtil
 			reqUtil
-				.requestData(config.URL.GAMERECOMMEND, {
+				.requestData(config.URL.GAMERECOMMENDBYPLATFORM, {
 					recommendType: 2,
 					recommendType: 2,
 					endTime: config.endTime
 					endTime: config.endTime
 				})
 				})
@@ -800,13 +801,12 @@
 				);
 				);
 			//获得视频列表
 			//获得视频列表
 			reqUtil
 			reqUtil
-				.requestData(config.URL.GAMERECOMMEND, {
+				.requestData(config.URL.GAMERECOMMENDBYPLATFORM, {
 					recommendType: 1,
 					recommendType: 1,
 					endTime: config.endTime
 					endTime: config.endTime
 				})
 				})
 				.then(
 				.then(
 					res => {
 					res => {
-						// console.warn('GAMERECOMMEND =====', res);
 						if (res.code == 0) {
 						if (res.code == 0) {
 							if (res.data.gameList.length > 3) {
 							if (res.data.gameList.length > 3) {
 								this.videoList = this.videoList.concat(res.data.gameList.slice(0, 3));
 								this.videoList = this.videoList.concat(res.data.gameList.slice(0, 3));
@@ -885,7 +885,7 @@
 						this.onGetBondDevice();
 						this.onGetBondDevice();
 						this.bGetBondTesting = false;
 						this.bGetBondTesting = false;
 					}
 					}
-				}, 2000)
+				}, 5000)
 
 
 			}
 			}
 
 
@@ -1180,7 +1180,7 @@
 				} = _self.arcbarData(_self.planData);
 				} = _self.arcbarData(_self.planData);
 
 
 				if (showCal == _self.oldArcbarProCalorie && showLCal == _self.oldArcbarAllCalorie) {
 				if (showCal == _self.oldArcbarProCalorie && showLCal == _self.oldArcbarAllCalorie) {
-					console.log("没有改变值,不刷新表盘:", showCal, _self.oldArcbarProCalorie, showLCal, _self.oldArcbarAllCalorie);
+					// console.log("没有改变值,不刷新表盘:", showCal, _self.oldArcbarProCalorie, showLCal, _self.oldArcbarAllCalorie);
 					return;
 					return;
 				}
 				}
 				//这个是显示当前的总卡路里
 				//这个是显示当前的总卡路里
@@ -1348,10 +1348,24 @@
 						this.$store.state.cIndex = i;
 						this.$store.state.cIndex = i;
 
 
 					}
 					}
+					
 					if(eq.ename.indexOf("hotman") > -1 && this.BLEConnectDevice.id == 1){
 					if(eq.ename.indexOf("hotman") > -1 && this.BLEConnectDevice.id == 1){
-						this.$refs.boxingPostRef.onSetMode('pkMode');
+						if(this.$refs.boxingPostRef){
+							this.$refs.boxingPostRef.onSetMode('pkMode');
+						}else{
+							setTimeout(()=>{
+								this.$refs.boxingPostRef.onSetMode('pkMode');
+							},500)
+						}
+						
 					}else if(eq.ename.indexOf("BLEHandle") > -1 && this.BLEConnectDevice.id == 2){
 					}else if(eq.ename.indexOf("BLEHandle") > -1 && this.BLEConnectDevice.id == 2){
-						this.$refs.boxingPostRef.onSetMode('calorieMode');
+						if(this.$refs.boxingPostRef){
+							this.$refs.boxingPostRef.onSetMode('calorieMode');
+						}else{
+							setTimeout(()=>{
+								this.$refs.boxingPostRef.onSetMode('calorieMode');
+							},500)
+						}
 					} 
 					} 
 				}
 				}
 			},
 			},
@@ -1380,7 +1394,9 @@
 							this.bGetBondTesting = true;
 							this.bGetBondTesting = true;
 						} else {
 						} else {
 							//没有弹出框时候,直接检测
 							//没有弹出框时候,直接检测
-							this.onGetBondDevice();
+							setTimeout(() => {
+								this.onGetBondDevice();
+							}, 5000)
 						}
 						}
 					},
 					},
 					getinitAdapter: () => {
 					getinitAdapter: () => {
@@ -1497,7 +1513,9 @@
 							this.bGetBondTesting = true;
 							this.bGetBondTesting = true;
 						} else {
 						} else {
 							//没有弹出框时候,直接检测
 							//没有弹出框时候,直接检测
-							this.onGetBondDevice();
+							setTimeout(() => {
+								this.onGetBondDevice();
+							}, 5000)
 						}
 						}
 						
 						
 						//刷新状态
 						//刷新状态
@@ -1520,10 +1538,14 @@
 				/**
 				/**
 				 * 假如手机没有匹配,断开连接
 				 * 假如手机没有匹配,断开连接
 				 */
 				 */
+				console.log("****",this.BLEConnectDevice);
+				if(!this.BLEConnectDevice)return;
+				
 				this.B_GetBondedDevices({
 				this.B_GetBondedDevices({
+					deviceId: this.BLEConnectDevice.deviceId,
 					success: (bondedDevice) => {
 					success: (bondedDevice) => {
 						console.error("===========", bondedDevice);
 						console.error("===========", bondedDevice);
-						uni.hideToast();
+						// uni.hideToast();
 						if (bondedDevice == null) {
 						if (bondedDevice == null) {
 							// if (plus.os.name == 'Android') 
 							// if (plus.os.name == 'Android') 
 							{
 							{

+ 119 - 36
util/util-js/o0Project.js

@@ -14,6 +14,7 @@ module.exports = {
 				o.time = new Date().getTime();
 				o.time = new Date().getTime();
 				o.timeGap = 20;
 				o.timeGap = 20;
 				o.acc = new o0.Vector2(0, 0);
 				o.acc = new o0.Vector2(0, 0);
+				o.gyr = new o0.Vector2(0, 0);
 				o.accFixed = 0;
 				o.accFixed = 0;
 				o.accSlope = 0;
 				o.accSlope = 0;
 				o.pos = new o0.Vector2(0, 0);
 				o.pos = new o0.Vector2(0, 0);
@@ -21,10 +22,13 @@ module.exports = {
 				o.shake = 0;
 				o.shake = 0;
 				o.shakeFixed = 1;
 				o.shakeFixed = 1;
 				o.shakeSlope = 0;
 				o.shakeSlope = 0;
+				o.reliable = 1;
+				o.speed = new o0.Vector2(0, 0);
 				o.hit = 0;
 				o.hit = 0;
 				this.frame.push(o);
 				this.frame.push(o);
 				//this.frameHit.push(o);
 				//this.frameHit.push(o);
 			}
 			}
+			this.frameSwing = this.frame[0];
 			//this.frame = 0;
 			//this.frame = 0;
 
 
 			this.force = new o0.Vector2(0, 0);
 			this.force = new o0.Vector2(0, 0);
@@ -41,11 +45,9 @@ module.exports = {
 				this.forceRecord.push(new o0.Vector2(0, 0));
 				this.forceRecord.push(new o0.Vector2(0, 0));
 			} /** */
 			} /** */
 			this.angle = 0;
 			this.angle = 0;
-
 			this.quitHitCount = 0;
 			this.quitHitCount = 0;
 		}
 		}
-		Update(vector3, timeGap, callback) {
-			// console.log(vector3,timeGap,callback);
+		Update(vector3, timeGap, gyr, callback) {
 			if (this.stableAcceleration == null) {
 			if (this.stableAcceleration == null) {
 				this.stableAcceleration = vector3;
 				this.stableAcceleration = vector3;
 				this.recordCount = 1;
 				this.recordCount = 1;
@@ -67,6 +69,7 @@ module.exports = {
 			newFrame.time = new Date().getTime();
 			newFrame.time = new Date().getTime();
 			newFrame.timeGap = timeGap;
 			newFrame.timeGap = timeGap;
 			newFrame.acc = new o0.Vector2(newForce.x, newForce.z);
 			newFrame.acc = new o0.Vector2(newForce.x, newForce.z);
+			newFrame.gyr = new o0.Vector2(gyr.z, -gyr.x);
 			let lastFrame = this.frame[this.frame.length - 1];
 			let lastFrame = this.frame[this.frame.length - 1];
 			let last2Frame = this.frame[this.frame.length - 2];
 			let last2Frame = this.frame[this.frame.length - 2];
 			let last3Frame = this.frame[this.frame.length - 3];
 			let last3Frame = this.frame[this.frame.length - 3];
@@ -184,6 +187,17 @@ module.exports = {
 				(newFrame.shakeSlope >= 20 || lastFrame.shakeSlope >= 40)) {
 				(newFrame.shakeSlope >= 20 || lastFrame.shakeSlope >= 40)) {
 				newFrame.hit = newFrame.shake;
 				newFrame.hit = newFrame.shake;
 				this.frameHit = [];
 				this.frameHit = [];
+
+				//this.frameSwing = last2Frame;
+				for (var i = this.frame.length - 3; i >= 1; --i) {
+					let io = this.frame[i];
+					let pio = this.frame[i - 1];
+					if (io.accFixed * 0.85 <= pio.accFixed && io.accFixed >= pio.accFixed * 0.85) {
+						this.frameSwing = io;
+					}
+				}
+
+
 			} else {
 			} else {
 				newFrame.hit = 0;
 				newFrame.hit = 0;
 			}
 			}
@@ -200,23 +214,6 @@ module.exports = {
 				newFrame.hit = 0;
 				newFrame.hit = 0;
 			}/** */
 			}/** */
 			/////////////力量大小
 			/////////////力量大小
-			// if(lastFrame.hit!=0){
-			// 	lastFrame.hit = Math.max(lastFrame.hit,newFrame.shakeFixed)
-			// }else if(this.frame[this.frame.length-2].hit!=0){
-			// 	this.frame[this.frame.length-2].hit = Math.max(this.frame[this.frame.length-2].hit,newFrame.shakeFixed)
-			// 	// console.log(this.frame[this.frame.length-2].hit);
-			// 	// this.quitHitCount ++;
-			// 	// console.log(this.quitHitCount);
-
-			// 	if(callback){
-			// 		let temp = {
-			// 			type:'hit',
-			// 			hit:this.frame[this.frame.length-2].hit,
-			// 			hitCount : this.quitHitCount
-			// 		}
-			// 		callback(temp);
-			// 	}
-			// }
 			if (lastFrame.hit != 0) {
 			if (lastFrame.hit != 0) {
 				lastFrame.hit = lastFrame.hit + newFrame.shake;
 				lastFrame.hit = lastFrame.hit + newFrame.shake;
 			} else if (last2Frame.hit != 0) {
 			} else if (last2Frame.hit != 0) {
@@ -227,27 +224,42 @@ module.exports = {
 				last4Frame.hit = last4Frame.hit + newFrame.shake;
 				last4Frame.hit = last4Frame.hit + newFrame.shake;
 			} else if (last5Frame.hit != 0) {
 			} else if (last5Frame.hit != 0) {
 				last5Frame.hit = last5Frame.hit + newFrame.shake;
 				last5Frame.hit = last5Frame.hit + newFrame.shake;
-				console.log(last5Frame.hit/5);
-				this.quitHitCount++;
-				if (callback) {
-					let temp = {
-						type: 'hit',
-						hit: last5Frame.hit/5,
-						hitCount: this.quitHitCount
-					}
-					callback(temp);
-				}
-			}
-			/** */
+				this.getDirection(last5Frame.hit, callback);
+			} /** */
 			//newFrame.shake = o0.distance2(newFrame.predict,newFrame.pos) * o0.distance2(lastFrame.pos,newFrame.pos);
 			//newFrame.shake = o0.distance2(newFrame.predict,newFrame.pos) * o0.distance2(lastFrame.pos,newFrame.pos);
+			//////////////////////////////////////////////////////////////////////////////////
+			newFrame.reliable = Math.pow((Math.PI / 2 - Math.atan(newFrame.shakeFixed / 10000)) / (Math.PI / 2), 2000);
+
+			let lastFrameAddSpeed = lastFrame.acc.multiply(lastFrame.timeGap / 20).multiply(lastFrame.reliable);
+			let newFrameAddSpeed = newFrame.acc.multiply(newFrame.timeGap / 20).multiply(newFrame.reliable);
+
+			newFrame.speed = lastFrame.speed.multiply(0.8);
+			var lastFrameAngle = newFrame.speed.angle(lastFrameAddSpeed);
+			if (isNaN(lastFrameAngle)) {
+				lastFrameAngle = 180.0;
+			}
+			//newFrame.speed = newFrame.speed.plus(lastFrameAddSpeed.multiply(Math.max(1,lastFrameAngle/60.0 - 1)));
+			//newFrame.speed = newFrame.speed.multiply(1).plus(lastFrameAddSpeed.multiply(Math.max(1,lastFrameAngle/60.0 - 1)));
+			newFrame.speed = newFrame.speed.multiply(1 - lastFrameAngle / 360.0).plus(lastFrameAddSpeed.multiply(Math.max(1,
+				lastFrameAngle / 60.0 - 1)));
+			var newFrameAngle = newFrame.speed.angle(newFrameAddSpeed);
+			if (isNaN(newFrameAngle)) {
+				newFrameAngle = 180.0;
+			}
+			//newFrame.speed = newFrame.speed.plus(newFrameAddSpeed.multiply(Math.min(1,newFrameAngle/60.0-1)));
+			newFrame.speed = newFrame.speed.multiply(1 - newFrameAngle / 360.0).plus(newFrameAddSpeed.multiply(Math.max(1,
+				newFrameAngle / 60.0 - 1)));
+
+
 			//////////////////////
 			//////////////////////
 			this.frame.shift();
 			this.frame.shift();
 			this.frame.push(newFrame);
 			this.frame.push(newFrame);
-			if (this.frameHit.length <= 17) {
+			if (this.frameHit.length <= 10) {
 				var o = new Object();
 				var o = new Object();
 				o.time = newFrame.time;
 				o.time = newFrame.time;
 				o.timeGap = newFrame.timeGap;
 				o.timeGap = newFrame.timeGap;
 				o.acc = newFrame.acc;
 				o.acc = newFrame.acc;
+				o.gyr = newFrame.gyr;
 
 
 				let frameHitLength = this.frameHit.length + 1;
 				let frameHitLength = this.frameHit.length + 1;
 				let lastFrameHit = this.frameHit[this.frameHit.length - 1];
 				let lastFrameHit = this.frameHit[this.frameHit.length - 1];
@@ -268,9 +280,6 @@ module.exports = {
 				this.frameHit.push(o);
 				this.frameHit.push(o);
 			}
 			}
 
 
-
-
-
 			var vectorChanged = newForce.minus(this.force);
 			var vectorChanged = newForce.minus(this.force);
 			var forceLength = this.force.length;
 			var forceLength = this.force.length;
 			var ForceChanged = newForce.length - forceLength;
 			var ForceChanged = newForce.length - forceLength;
@@ -350,5 +359,79 @@ module.exports = {
 		test() {
 		test() {
 			return "123123131";
 			return "123123131";
 		}
 		}
+		getDirection(hitValue, callback) {
+			var direction = new o0.Vector2(0, 0);
+			var directionDistance = 0;
+			for (var fi = 1; fi < this.frameHit.length - 1; ++fi) {
+				for (var li = fi + 1; li < this.frameHit.length; ++li) {
+					let firstGyr = this.frameHit[fi].gyr;
+					let lastGyr = this.frameHit[li].gyr;
+					let newDirectionDistance = o0.distance2(firstGyr, lastGyr);
+					if (directionDistance < newDirectionDistance) {
+						directionDistance = newDirectionDistance;
+						direction = lastGyr.minus(firstGyr);
+					}
+				}
+			}
+
+			let curAngle = new o0.Vector2(direction.x, direction.y).mod.angle(new o0.Vector2(0, 1));
+			let directionPunch = "all",
+				name = "击中",
+				ename = "hit";
+			let curAngleCeil = Math.ceil(curAngle);
+			//已坐标 (0,1) 向量为参考
+			if (direction.y < 0) {
+				//相反方向击打
+				//正方向
+				if (curAngleCeil > 150) {
+					directionPunch = "straightPunch";
+					name = "负向的直拳";
+					ename = "back-straight";
+				} else if (direction.x > 0) {
+					directionPunch = "rightPunch";
+					name = "负向的右拳";
+					ename = "back-right";
+				} else if (direction.x < 0) {
+					directionPunch = "leftPunch";
+					name = "负向的左拳";
+					ename = "back-left";
+				}
+			} else {
+				// y 大于零 手柄正方向击打
+				if (curAngleCeil < 30) {
+					directionPunch = "straightPunch";
+					name = "正向的直拳";
+					ename = "front-straight";
+				} else if (direction.x < 0) {
+					directionPunch = "rightPunch";
+					name = "正向的右拳";
+					ename = "front-right";
+				} else if (direction.x > 0) {
+					directionPunch = "leftPunch";
+					name = "正向的左拳";
+					ename = "front-left";
+				}
+			}
+
+
+			this.quitHitCount++;
+			if (callback) {
+				let temp = {
+					type: 'hit',
+					hit: hitValue / 5,
+					hitCount: this.quitHitCount,
+					direction: directionPunch,
+					directionVect: {
+						'x': direction.x,
+						'y': direction.y
+					},
+					angle: curAngleCeil,
+					name: name,
+					ename: ename
+				}
+				callback(temp);
+			}
+
+		}
 	}
 	}
 };
 };

+ 4 - 2
util/util-js/requstUtil.js

@@ -8,7 +8,8 @@ function requestData(url, params, method) {
 			header: {
 			header: {
 				//application/x-www-form-urlencoded text/html;charset=UTF-8;application/json; accessToken backend_api_context Bearer 
 				//application/x-www-form-urlencoded text/html;charset=UTF-8;application/json; accessToken backend_api_context Bearer 
 				"Content-Type": "application/x-www-form-urlencoded",
 				"Content-Type": "application/x-www-form-urlencoded",
-				"token": uni.getStorageSync('token') ? `${uni.getStorageSync('token')}` : ''
+				"token": uni.getStorageSync('token') ? `${uni.getStorageSync('token')}` : '',
+				"platform": uni.getStorageSync('platform') || uni.getStorageSync('platform') == 0 ? `${uni.getStorageSync('platform')}` : 2
 			},
 			},
 			success: function(res) {
 			success: function(res) {
 				console.log("GET URL:", url, ". Params:", params);
 				console.log("GET URL:", url, ". Params:", params);
@@ -35,7 +36,8 @@ function reqUpload(url, params,filePath) {
 			header:{
 			header:{
 				//application/x-www-form-urlencoded text/html;charset=UTF-8;application/json; accessToken backend_api_context Bearer 
 				//application/x-www-form-urlencoded text/html;charset=UTF-8;application/json; accessToken backend_api_context Bearer 
 				// "Content-Type": "multipart/form-data",
 				// "Content-Type": "multipart/form-data",
-				"token": uni.getStorageSync('token') ? `${uni.getStorageSync('token')}` : ''
+				"token": uni.getStorageSync('token') ? `${uni.getStorageSync('token')}` : '',
+				"platform": uni.getStorageSync('platform') || uni.getStorageSync('platform') == 0 ? `${uni.getStorageSync('platform')}` : 2
 			},
 			},
 			filePath: filePath,
 			filePath: filePath,
 			name: 'file',
 			name: 'file',

+ 235 - 171
util/util-js/store.js

@@ -196,8 +196,8 @@ const store = new Vuex.Store({
 		//是否安装了微信
 		//是否安装了微信
 		bInstallWechat: false,
 		bInstallWechat: false,
 		bHideWeixin: false,
 		bHideWeixin: false,
-        
-		clientName:'',//但是客户端名字
+
+		clientName: '', //但是客户端名字
 		system: '', // 系统版本
 		system: '', // 系统版本
 		platform: '', // 平台
 		platform: '', // 平台
 		appName: '',
 		appName: '',
@@ -205,6 +205,13 @@ const store = new Vuex.Store({
 		versionCode: '',
 		versionCode: '',
 		showEndTime: config.endTime, //游戏显示时间字段,后台返回对应此时间之前的数据
 		showEndTime: config.endTime, //游戏显示时间字段,后台返回对应此时间之前的数据
 
 
+		//现在游戏显示在对应的平台
+		gamePlatform: {
+			0: 'android',
+			1: 'ios',
+			2: 'all'
+		},
+
 		globalAcc: null,
 		globalAcc: null,
 		globalOri: null,
 		globalOri: null,
 
 
@@ -267,6 +274,12 @@ const store = new Vuex.Store({
 		bListenerUpdate: false,
 		bListenerUpdate: false,
 		bListenerJson: false,
 		bListenerJson: false,
 		bListenerMac: false,
 		bListenerMac: false,
+
+
+		BluetoothAdapter: null,
+
+		//版本状态,用于区分部分特定的环境
+		versionCodeState: null
 	},
 	},
 	mutations: {
 	mutations: {
 
 
@@ -290,14 +303,17 @@ const store = new Vuex.Store({
 		 * @param {Object} device
 		 * @param {Object} device
 		 */
 		 */
 		setFinallUseDevice(state, device) {
 		setFinallUseDevice(state, device) {
-			uni.setStorage({
-				key: 'finallyUseDevice',
-				data: device,
-				success: (res) => {
-					state.finallyUseDevice = device;
-					console.log("保存finallyUseDevice:", res);
-				}
-			})
+			uni.setStorageSync('finallyUseDevice', device);
+			state.finallyUseDevice = device;
+			console.log("保存finallyUseDevice:", state.finallyUseDevice);
+			// uni.setStorage({
+			// 	key: 'finallyUseDevice',
+			// 	data: device,
+			// 	success: (res) => {
+			// 		state.finallyUseDevice = device;
+			// 		console.log("保存finallyUseDevice:", res);
+			// 	}
+			// })
 		},
 		},
 		/**
 		/**
 		 * 移除记录的use device
 		 * 移除记录的use device
@@ -742,7 +758,7 @@ const store = new Vuex.Store({
 						for (let i = 0; i < state.BLEInfoList.length; i++) {
 						for (let i = 0; i < state.BLEInfoList.length; i++) {
 							let eq = state.BLEInfoList[i];
 							let eq = state.BLEInfoList[i];
 							if (item.id == eq.id) {
 							if (item.id == eq.id) {
-								console.log("存储的======================:",item,eq);
+								// console.log("存储的======================:", item, eq);
 								state.BLEDeviceShowList.push(Object.assign({}, item, eq));
 								state.BLEDeviceShowList.push(Object.assign({}, item, eq));
 								break;
 								break;
 							}
 							}
@@ -859,7 +875,7 @@ const store = new Vuex.Store({
 				return;
 				return;
 			}
 			}
 			reqUtil.requestData(
 			reqUtil.requestData(
-				config.URL.GAMELIST_BY_RANKING_SHOW, {
+				config.URL.GAMELIST_BY_RANKING_SHOW_AND_PLATFORM, {
 					rankingShow: 1,
 					rankingShow: 1,
 					page: 1,
 					page: 1,
 					size: 100
 					size: 100
@@ -1043,6 +1059,9 @@ const store = new Vuex.Store({
 			// 	}
 			// 	}
 			// });
 			// });
 
 
+			//获取版本信息
+			this.commit('getVersionCode');
+
 		},
 		},
 
 
 		// 退出登录
 		// 退出登录
@@ -1720,7 +1739,13 @@ const store = new Vuex.Store({
 				az
 				az
 			} = data.acc;
 			} = data.acc;
 
 
-			state.filter.Update(new o0.Vector3(ax, ay, az), msGap, callback); //我自己的更新acc的函数
+			let {
+				gx,
+				gy,
+				gz
+			} = data.gyro;
+
+			state.filter.Update(new o0.Vector3(ax, ay, az), msGap, new o0.Vector3(gx, gy, gz) , callback); //我自己的更新acc的函数
 		},
 		},
 		/**
 		/**
 		 * 限制开始游戏
 		 * 限制开始游戏
@@ -1950,7 +1975,7 @@ const store = new Vuex.Store({
 			uni.getBLEDeviceServices({
 			uni.getBLEDeviceServices({
 				deviceId: item.deviceId,
 				deviceId: item.deviceId,
 				success: res => {
 				success: res => {
-					console.log("getBLEDeviceServices==", JSON.stringify(res), item);
+					// console.log("getBLEDeviceServices==", JSON.stringify(res), item);
 					serviceList = res.services;
 					serviceList = res.services;
 					if (getServiceList) {
 					if (getServiceList) {
 						getServiceList(serviceList);
 						getServiceList(serviceList);
@@ -1990,8 +2015,8 @@ const store = new Vuex.Store({
 				fail: failRes => {
 				fail: failRes => {
 					console.log('device services:', failRes.services)
 					console.log('device services:', failRes.services)
 					uni.showModal({
 					uni.showModal({
-						title: '连接失败',
-						content: '未获取到相应服务,继续尝试连接设备。'
+						title: '连接错误',
+						content: '请尝试重新连接设备。'
 					})
 					})
 				}
 				}
 			});
 			});
@@ -2267,22 +2292,13 @@ const store = new Vuex.Store({
 		//获取手机中蓝牙已匹配的设备
 		//获取手机中蓝牙已匹配的设备
 		B_GetBondedDevices(state, context) {
 		B_GetBondedDevices(state, context) {
 			// console.log("getBondedDevices ====>");
 			// console.log("getBondedDevices ====>");
-			// 	uni.getBluetoothDevices({
-			// 		success(res) {
-			// 			console.log("getBluetoothDevices:", res)
-			// 		}
-			// 	})
-
-			// 	uni.getConnectedBluetoothDevices({
-			// 		success(res) {
-			// 			console.log("getConnectedBluetoothDevices:", res)
-			// 		}
-			// 	})
 			let {
 			let {
-				success = null
+				success = null,
+					deviceId = null
 			} = context;
 			} = context;
 			//Android
 			//Android
-			function android_bluetooth_list(deviceName) {
+			function android_bluetooth_list(deviceName, deviceId, count, callback) {
+				console.log("===》调用android_bluetooth_list count:", count);
 				var main = plus.android.runtimeMainActivity();
 				var main = plus.android.runtimeMainActivity();
 				var BluetoothAdapter = plus.android.importClass("android.bluetooth.BluetoothAdapter");
 				var BluetoothAdapter = plus.android.importClass("android.bluetooth.BluetoothAdapter");
 				var BAdapter = BluetoothAdapter.getDefaultAdapter();
 				var BAdapter = BluetoothAdapter.getDefaultAdapter();
@@ -2290,19 +2306,85 @@ const store = new Vuex.Store({
 				var lists = BAdapter.getBondedDevices();
 				var lists = BAdapter.getBondedDevices();
 				plus.android.importClass(lists);
 				plus.android.importClass(lists);
 				var len = lists.size();
 				var len = lists.size();
-				// console.log("getBondedDevices.len=" + len);
+				// var BluetoothManager = plus.android.importClass("android.bluetooth.BluetoothManager");
+				// var BluetoothDevice = plus.android.importClass("android.bluetooth.BluetoothDevice");
+				// var ProfileType = plus.android.importClass("android.bluetooth.ProfileType");
+				// plus.android.importClass(BluetoothManager);
+				// plus.android.importClass(BluetoothDevice);
+				// plus.android.importClass(ProfileType);
+				// var UUID = plus.android.importClass("java.util.UUID");  
+				// var uuid = UUID.fromString("0000FFF0-0000-1000-8000-00805F9B34FB"); 
+
+				// var gDevice = BAdapter.getRemoteDevice("C5:5C:19:04:00:30");  
+				// plus.android.importClass(gDevice);  
+				// var bluetoothSocket = gDevice.createInsecureRfcommSocketToServiceRecord(uuid);  
+				// plus.android.importClass(bluetoothSocket); 
+				// console.log("是否连接:",bluetoothSocket.isConnected());
+				// var deviceLists = BluetoothManager.getConnectedDevices();
+				// plus.android.importClass(deviceLists);
+				// console.log("deviceLists.len=" + deviceLists.size());
+
+				console.log("getBondedDevices.len=", len, "deviceId:", deviceId);
+
+				//测试start===》 如果没有配对的设备,重新获取
+				// count--;
+				// if(count >0){
+				// 	setTimeout(()=>{
+				// 		android_bluetooth_list("BGBox", deviceId, count, callback);
+				// 	},1000)
+				// 	return;
+				// }
+				//测试end
+
 				if (len == 0) {
 				if (len == 0) {
-					//如果没有配对的设备
-					return null;
+					//如果没有配对的设备,重新获取
+					count--;
+					if (count > 0) {
+						setTimeout(() => {
+							android_bluetooth_list("BGBox", deviceId, count, callback);
+						}, 2000)
+					} else {
+						if (callback)
+							callback(null);
+					}
+
+
 				} else {
 				} else {
 					var iterator = lists.iterator();
 					var iterator = lists.iterator();
+					let temp = null;
 					plus.android.importClass(iterator);
 					plus.android.importClass(iterator);
 					while (iterator.hasNext()) {
 					while (iterator.hasNext()) {
 						var d = iterator.next();
 						var d = iterator.next();
 						plus.android.importClass(d);
 						plus.android.importClass(d);
-						let temp = null;
-						console.log("匹配列表的:",d.getName(),d.getBondState());
-						if (d.getName().indexOf(deviceName) > -1) {
+						// if (d.getName().indexOf(deviceName) > -1) 
+						console.log(d.getAddress(), deviceId);
+						if (deviceId == null && d.getName().indexOf(deviceName) > -1) {
+							let typeEnum = {
+								0: 'Unknown',
+								1: 'Classic',
+								2: 'Le',
+								3: 'Dual'
+							};
+							let bondStateEnum = {
+								10: 'None',
+								11: 'Bonding',
+								12: 'Bonded'
+							};
+							temp = {
+								name: d.getName(),
+								address: d.getAddress(),
+								type: {
+									'value': d.getType(),
+									'name': typeEnum[d.getType()]
+								},
+								bondState: {
+									'value': d.getBondState(),
+									'name': bondStateEnum[d.getBondState()]
+								}
+							}
+							console.log("获取到设备,并且跳出:", temp);
+							break;
+						} else if (d.getAddress() == deviceId) {
 							// console.log(d.getName());
 							// console.log(d.getName());
 							// console.log(d.getAddress());
 							// console.log(d.getAddress());
 							// Classic	1	
 							// Classic	1	
@@ -2337,161 +2419,125 @@ const store = new Vuex.Store({
 									'name': bondStateEnum[d.getBondState()]
 									'name': bondStateEnum[d.getBondState()]
 								}
 								}
 							}
 							}
-
+							console.log("获取到设备,并且跳出:", temp);
+							break;
 						}
 						}
-						return temp;
+					}
+					// return temp;
+					if (temp == null && count > 0) {
+						count--;
+						setTimeout(() => {
+							android_bluetooth_list("BGBox", deviceId, count, callback);
+						}, 2000)
+					} else {
+						if (callback)
+							callback(temp);
 					}
 					}
 				}
 				}
 
 
 
 
 			}
 			}
 
 
+			function ios_bluetooth_list(deviceName, callback) {
+				//原生操作 首先需要通过 uni.requireNativePlugin("ModuleName") 获取 module
+				var SLABluetoothModule = uni.requireNativePlugin("SLABluetoothUniPlugin-SLAModule")
+				if (SLABluetoothModule) {
+					SLABluetoothModule.getConnectionDevicesAsync({
+						serviceUUIDs: "FFF0"
+					}, (res) => {
+						console.log("***************getConnectionDevicesAsync:", JSON.stringify(res));
+						if (res.data) {
+							console.log("获取到对应的匹配设备!");
 
 
-			function searchIOS() {
-				var CBCentralManager = plus.ios.import("CBCentralManager");
-				var manager = new CBCentralManager();
-				var delegate = plus.ios.implements("CBCentralManagerDelegate", {
-					"centralManagerDidUpdateState:": centralManagerDidUpdateState,
-					"centralManager:didDiscoverPeripheral:advertisementData:RSSI:": didDiscoverPeripheral
-				});
-				if (plus.device.model == "iPad" || plus.device.model == "iPod") {
-					manager.initWithDelegatequeue(delegate, null);
-				} else {
-					manager.initWithDelegatequeue(delegate, null, null);
-					let arr = manager.retrieveConnectedPeripheralsWithServices();
-					console.error(arr.length);
-				}
-			}
-
-			function centralManagerDidUpdateState(central) {
-				console.log(central);
-				var state = central.plusGetAttribute('state');
-				console.log(state);
-				if (state == 4) {
-					writelog('请开启蓝牙');
-				}
-				if (state == 5) {
-					console.log("中央外设管理器状态 state= " + state);
-					central.scanForPeripheralsWithServicesoptions(null, null);
-				}
-				//writelog("中央外设管理器状态 state= " + state);  
-			}
-
-			function didDiscoverPeripheral(central, peripheral, advertisementData, RSSI) {
-				var name = peripheral.plusGetAttribute("name");
-				var uuid = peripheral.plusGetAttribute("identifier").plusGetAttribute("UUIDString");
-				var rssi = RSSI.plusGetAttribute("intValue");
-				var dist = calcDistByRSSI(rssi, 74, 2);
-				writelog("蓝牙设备:" + name + " " + uuid + " " + rssi + " " + dist + "米");
-
-			}
-
-			function writelog(msg) {
-				console.log(msg);
-			}
-
-			function calcDistByRSSI(rssi, a, n) {
-				var rs = Math.abs(rssi);
-				var power = (rs - a) / (10 * n);
-				return Math.pow(10, parseFloat(power)).toFixed(2);
-			}
+							let typeEnum = {
+								0: 'Unknown',
+								1: 'Classic',
+								2: 'Le',
+								3: 'Dual'
+							};
+							let bondStateEnum = {
+								10: 'None',
+								11: 'Bonding',
+								12: 'Bonded'
+							};
+							let temp = {
+								name: res.data[0].name,
+								address: res.data[0].identifier,
+								type: {
+									'value': 2,
+									'name': typeEnum[2]
+								},
+								bondState: {
+									'value': 12,
+									'name': bondStateEnum[12]
+								}
+							}
+							if (callback) {
+								callback({
+									"device": temp
+								});
+							}
 
 
-			function ios_bluetooth_list(deviceName,callback) {
-				// let CBCentralManager= plus.ios.importClass("CBCentralManager");
-				// let _centralManager =  new CBCentralManager();
-				// _centralManager.initWithDelegatequeue(plus.ios.currentWebview(),null);
-				// let arr = _centralManager.retrieveConnectedPeripheralsWithServices();
-				// console.error(arr.length);
-				// searchIOS();
-				//原生操作
-				// 首先需要通过 uni.requireNativePlugin("ModuleName") 获取 module
-				var SLABluetoothModule = uni.requireNativePlugin("SLABluetoothUniPlugin-SLAModule")
-				if(SLABluetoothModule){
-					SLABluetoothModule.getConnectionDevicesAsync({serviceUUIDs:"FFF0"},(res)=>{
-						console.log("***************getConnectionDevicesAsync:",JSON.stringify(res));
-						if(res.data){
-							console.log("获取到对应的匹配设备!");
-							
-							let typeEnum = {
-								0: 'Unknown',
-								1: 'Classic',
-								2: 'Le',
-								3: 'Dual'
-							};
-							let bondStateEnum = {
-								10: 'None',
-								11: 'Bonding',
-								12: 'Bonded'
-							};
-							let temp = {
-								name: res.data[0].name,
-								address: res.data[0].identifier,
-								type: {
-									'value': 2,
-									'name': typeEnum[2]
-								},
-								bondState: {
-									'value': 12,
-									'name': bondStateEnum[12]
-								}
-							}
-							if(callback){
-								callback({"device":temp});
-							}
-							
-						}else{
-							console.log("匹配设备数据不存在!");
-							if(callback){
-								callback({"device":null});
-							}
-						}
-					})
-				}else{
-					console.error("不存在SLABluetoothModule ios 插件!");
-					if(callback){
-						callback({"device":null});
-					}
+						} else {
+							console.log("匹配设备数据不存在!");
+							if (callback) {
+								callback({
+									"device": null
+								});
+							}
+						}
+					})
+				} else {
+					console.error("不存在SLABluetoothModule ios 插件!");
+					if (callback) {
+						callback({
+							"device": null
+						});
+					}
 				}
 				}
 			}
 			}
 
 
 
 
 
 
 			let device = null;
 			let device = null;
+			let _count = 3;
 
 
 			switch (plus.os.name) {
 			switch (plus.os.name) {
 				case "Android":
 				case "Android":
 					// Android平台: plus.android.*  
 					// Android平台: plus.android.*  
-					device = android_bluetooth_list("BGBox");
-					console.log("android getBondedDevices 匹配的对象======>", device)
-					if (device != null) {
-						state.bPhoneMatched = true;
-					} else {
-						state.bPhoneMatched = false;
-					}
-					if (success) {
-						success(device);
-					}
+					android_bluetooth_list("BGBox", deviceId, _count, (data) => {
+						device = data;
+						console.log("android getBondedDevices 匹配的对象======>", device)
+						if (device != null) {
+							state.bPhoneMatched = true;
+						} else {
+							state.bPhoneMatched = false;
+						}
+						if (success) {
+							success(device);
+						}
+					});
 					break;
 					break;
 				case "iOS":
 				case "iOS":
 					// iOS平台: plus.ios.*  
 					// iOS平台: plus.ios.*  
-					ios_bluetooth_list("BGBox",(res)=>{
-						device = res.device
-						if (success) {
-							success(device);
-						}
-						
-						console.log("ios getBondedDevices 匹配的对象======>", device)
-						if (device != null) {
-							state.bPhoneMatched = true;
-						} else {
-							state.bPhoneMatched = false;
-						}
+					ios_bluetooth_list("BGBox", (res) => {
+						device = res.device
+						if (success) {
+							success(device);
+						}
+
+						console.log("ios getBondedDevices 匹配的对象======>", device)
+						if (device != null) {
+							state.bPhoneMatched = true;
+						} else {
+							state.bPhoneMatched = false;
+						}
 					});
 					});
 					break;
 					break;
 				default:
 				default:
-					// 其它平台  
-					if (success) {
-						success(device);
+					// 其它平台  
+					if (success) {
+						success(device);
 					}
 					}
 					break;
 					break;
 			}
 			}
@@ -2509,7 +2555,7 @@ const store = new Vuex.Store({
 				main.startActivity(intent);
 				main.startActivity(intent);
 			}
 			}
 
 
-			function ios_bluetooth_setting() {
+			function ios_bluetooth_setting() {
 				// var UIApplication = plus.ios.import("UIApplication");  
 				// var UIApplication = plus.ios.import("UIApplication");  
 				// var application2 = UIApplication.sharedApplication();  
 				// var application2 = UIApplication.sharedApplication();  
 				// var NSURL2 = plus.ios.import("NSURL");  
 				// var NSURL2 = plus.ios.import("NSURL");  
@@ -2523,10 +2569,12 @@ const store = new Vuex.Store({
 				// 	action: 'App-Prefs:root=Bluetooth'
 				// 	action: 'App-Prefs:root=Bluetooth'
 				// }, function(e) {
 				// }, function(e) {
 				// 	console.log(JSON.stringify(e));
 				// 	console.log(JSON.stringify(e));
-				// });
-				
-				plus.runtime.launchApplication({action:'App-Prefs:root=Bluetooth'}, function(e){
-				console.log(JSON.stringify(e));
+				// });
+
+				plus.runtime.launchApplication({
+					action: 'App-Prefs:root=Bluetooth'
+				}, function(e) {
+					console.log(JSON.stringify(e));
 				});
 				});
 			}
 			}
 
 
@@ -2546,7 +2594,23 @@ const store = new Vuex.Store({
 					break;
 					break;
 			}
 			}
 
 
-		}
+		},
+
+		//获取versionCode状态,用于处理特定的信息显示
+		getVersionCode(state) {
+			let self = this;
+			reqUtil.requestData(config.URL.GETVERSIONCODE, {
+				code: state.versionCode
+			}).then(res => {
+					console.log('获取GETVERSIONCODE =====', res);
+					if (res.code == 0) {
+						state.versionCodeState = res.data;
+					}
+				},
+				e => {
+					console.log(e)
+				});
+		},
 	}
 	}
 })
 })