|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
<view>
|
|
|
- <uni-nav-bar id="nav-bar" status-bar="true" @clickLeft="onBack()" @clickRight="onNavUpdateDevice()" title="选择设备类型"
|
|
|
- color="#000000" fixed="true" :border="false">
|
|
|
+ <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>
|
|
@@ -9,30 +9,111 @@
|
|
|
</view>
|
|
|
<view slot="right">
|
|
|
<view class=" flex align-center " style="margin-right: 10rpx;">
|
|
|
- <image style="width: 60rpx;height: 50rpx;" src="../../../static/devicesIconSimple/upgrade.png"></image>
|
|
|
+ <image style="width: 60rpx;height: 50rpx;" src="../../../static/devicesIconSimple/upgrade.png">
|
|
|
+ </image>
|
|
|
</view>
|
|
|
</view>
|
|
|
</uni-nav-bar>
|
|
|
- <view class="card-view padding-top padding-bottom" v-for="(item,index) in devicesList" :key="index" :class="item.bRatio?'hardware-border':''">
|
|
|
+ <view class="card-view padding-top padding-bottom" v-for="(item,index) in devicesList" :key="index"
|
|
|
+ :id="'task_'+index" :class="item.bRatio?'hardware-border':''" :style="{'z-index': threeZIndex}">
|
|
|
<view class="flex justify-between align-center">
|
|
|
<view class="flex justify-start align-center">
|
|
|
- <image style="margin-left: 20rpx; width: 200rpx;height: 120rpx;" :src="item.icon" mode="aspectFit"></image>
|
|
|
+ <image style="margin-left: 20rpx; width: 200rpx;height: 120rpx;" :src="item.icon" mode="aspectFit">
|
|
|
+ </image>
|
|
|
<view style="width: 350rpx;margin-left: 10rpx;">
|
|
|
- <view style="margin: 20rpx 0rpx; font-weight: bold; font-size: 18px; color: #565656;">{{item.cname}}</view>
|
|
|
- <view style="font-size: 12px; white-space:pre-wrap;" class="make-text-bPurple">{{item.describe}}</view>
|
|
|
+ <view style="margin: 20rpx 0rpx; font-weight: bold; font-size: 18px; color: #565656;">
|
|
|
+ {{item.cname}}</view>
|
|
|
+ <view style="font-size: 12px; white-space:pre-wrap;" class="make-text-bPurple">{{item.describe}}
|
|
|
+ </view>
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
- <image style="margin-right: 60rpx; width: 60rpx;height: 60rpx;" :src="item.bRatio?'/static/devicesOther/radio-b.png':'/static/devicesOther/radio-g.png'"
|
|
|
- mode="aspectFit" @tap="_onRadio(item,$event)"></image>
|
|
|
+ <image style="margin-right: 60rpx; width: 60rpx;height: 60rpx;"
|
|
|
+ :src="item.bRatio?'/static/devicesOther/radio-b.png':'/static/devicesOther/radio-g.png'"
|
|
|
+ mode="aspectFit" @tap="_onRadio(item,$event)"></image>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <!-- <button @click="onGetDevice()"> onGetDevice</button> -->
|
|
|
- <!-- <view class="margin">
|
|
|
- <view class="make-text-bPurple text-14px">** 匹配步骤 **</view>
|
|
|
- <view class="make-text-bPurple text-14px">1.长按游戏手柄直到蓝灯正常闪烁</view>
|
|
|
- <view class="make-text-bPurple text-14px">2.蓝灯正常闪烁后,选择下面模式匹配手柄</view>
|
|
|
- </view> -->
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <view v-if="currentIndex<5" class="position-absolute-center" style="z-index: 1; width: 750rpx;display: flex;">
|
|
|
+ <swiper class="swiper" :style="{height:currentHeight+'px'}" :circular="circular" :vertical="true"
|
|
|
+ disable-touch="true" :current="currentIndex" @click="onSwiperClick" @change="onSwiperChange">
|
|
|
+ <!-- 1 @touchmove.stop='stopTouchMove' -->
|
|
|
+ <swiper-item class="flex justify-center align-center" @click="onSwiperItemClick">
|
|
|
+ <view style="width: 590rpx; height: 626rpx;" class="position-relative">
|
|
|
+ <view class="bluetooth-guide-number" style="position: absolute;left: 94rpx;top: 8rpx;">1</view>
|
|
|
+ <image style="width: 590rpx; height: 626rpx;"
|
|
|
+ src="../../../static/guide/blutooth/guide-ble-1@2x.png">
|
|
|
+ </image>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ </swiper-item>
|
|
|
+ <!-- 2 -->
|
|
|
+ <swiper-item class="flex justify-center align-center flex-direction">
|
|
|
+
|
|
|
+ <image style="width: 354rpx; height: 306rpx; margin-bottom: 28rpx;"
|
|
|
+ src="../../../static/guide/blutooth/guide-ble-device.png">
|
|
|
+ </image>
|
|
|
+ <view class="position-relative">
|
|
|
+ <image style="width: 520rpx; height:166rpx;" src="../../../static/guide/blutooth/boxMid@2x.png">
|
|
|
+ </image>
|
|
|
+ <view class="position-absolute-center text-regular"
|
|
|
+ style="width: 438rpx;height: 96rpx;top: 26rpx;">长按游戏设备开关3秒,设备灯连续闪烁为可连接状态</view>
|
|
|
+ </view>
|
|
|
+ <view class="bluetooth-guide-number" style="margin-top: 36rpx;">2</view>
|
|
|
+ </swiper-item>
|
|
|
+ <!-- 3 -->
|
|
|
+ <swiper-item class="flex justify-start align-center flex-direction">
|
|
|
+
|
|
|
+ <view :style="{height:threeTipHeight+'px'}"></view>
|
|
|
+ <view class="flex justify-end">
|
|
|
+ <view class="bluetooth-guide-number" style="margin-top: 32rpx;">3</view>
|
|
|
+ <view class="position-relative">
|
|
|
+ <image style="width: 462rpx; height:206rpx;"
|
|
|
+ src="../../../static/guide/blutooth/boxRight@2x.png">
|
|
|
+ </image>
|
|
|
+ <view class="position-absolute-center text-regular"
|
|
|
+ style="width: 392rpx;height: 144rpx;top: 44rpx;">选择设备类型连接,按钮勾选上表示手柄连接成功。如果连接失败请重试</view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ </swiper-item>
|
|
|
+ <!-- 4 -->
|
|
|
+ <swiper-item class="flex justify-center align-center flex-direction">
|
|
|
+
|
|
|
+ <image style="width: 446rpx; height: 384rpx; margin-bottom: 28rpx;"
|
|
|
+ src="../../../static/guide/blutooth/guide-ble-bind.png">
|
|
|
+ </image>
|
|
|
+ <view class="position-relative">
|
|
|
+ <image style="width: 520rpx; height:166rpx;" src="../../../static/guide/blutooth/boxMid@2x.png">
|
|
|
+ </image>
|
|
|
+ <view class="position-absolute-center text-regular"
|
|
|
+ style="width: 438rpx;height: 96rpx;top: 26rpx;">请将手柄十字键朝上插入绑带中,用绑带将手柄朝上绑在右脚脚踝上</view>
|
|
|
+ </view>
|
|
|
+ <view class="bluetooth-guide-number" style="margin-top: 36rpx;">4</view>
|
|
|
+ </swiper-item>
|
|
|
+ <!-- 5 -->
|
|
|
+ <swiper-item class="flex justify-start align-center flex-direction">
|
|
|
+
|
|
|
+ <view :style="{height:threeTipHeight+'px'}"></view>
|
|
|
+ <view class="position-relative">
|
|
|
+ <image style="width: 520rpx; height:162rpx;" src="../../../static/guide/blutooth/boxMid@2x.png">
|
|
|
+ </image>
|
|
|
+ <view class="position-absolute-center flex align-center justify-center"
|
|
|
+ style="width: 438rpx;top: 32rpx;">
|
|
|
+ <image style="width: 60rpx;height:60rpx;margin-right: 28rpx;"
|
|
|
+ src="../../../static/guide/blutooth/guide-ble-finish@2x.png"></image>
|
|
|
+ <view class=" text-regular " style="width: 336rpx;height: 90rpx;">
|
|
|
+ 您已绑定成功,返回主界面选择关卡开始游戏吧</view>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ </view>
|
|
|
+ </swiper-item>
|
|
|
+
|
|
|
+ </swiper>
|
|
|
+ </view>
|
|
|
+
|
|
|
</view>
|
|
|
|
|
|
|
|
@@ -50,7 +131,7 @@
|
|
|
export default {
|
|
|
computed: mapState(['bOpenBluetooth', 'bOpenSuccess', 'bListenAdapterStateChange', 'bListenDeviceFound',
|
|
|
'BLEConnectDevice', 'BLEGetServices', 'cIndex', 'bConnection', 'bVerifiedConnection', 'BLEInfoList',
|
|
|
- 'BLEDeviceShowList', 'finallyUseDevice'
|
|
|
+ 'BLEDeviceShowList', 'finallyUseDevice', 'systemInfo','guideUnlockState'
|
|
|
]),
|
|
|
data() {
|
|
|
return {
|
|
@@ -77,7 +158,14 @@
|
|
|
//是否显示
|
|
|
bShow: true,
|
|
|
//切换连接
|
|
|
- bSwitch: false
|
|
|
+ bSwitch: false,
|
|
|
+
|
|
|
+ //提示
|
|
|
+ circular: false,
|
|
|
+ currentHeight: 0,
|
|
|
+ threeTipHeight: 0,
|
|
|
+ threeZIndex: 0,
|
|
|
+ currentIndex: 5,
|
|
|
}
|
|
|
},
|
|
|
onLoad(op) {
|
|
@@ -110,7 +198,16 @@
|
|
|
uni.$on('listenerBLE', this.onListenerBLE);
|
|
|
|
|
|
|
|
|
-
|
|
|
+ this.currentHeight = this.systemInfo.windowHeight;
|
|
|
+
|
|
|
+ if (this.guideUnlockState.firstDisconnectBluetooth) {
|
|
|
+
|
|
|
+ this.currentIndex = 0;
|
|
|
+ let guideUnlockState = Object.assign(this.guideUnlockState, {
|
|
|
+ firstDisconnectBluetooth: false
|
|
|
+ });
|
|
|
+ this.setGuideUnlockState(guideUnlockState);
|
|
|
+ }
|
|
|
},
|
|
|
onUnload() {
|
|
|
uni.$off('retryConnectBLESuccess', this.onRetryConnectBLESuccess);
|
|
@@ -131,7 +228,7 @@
|
|
|
if (
|
|
|
(eq.ename.indexOf("mobilePhoneBandage") > -1 && this.BLEConnectDevice.id == 0) ||
|
|
|
(eq.ename.indexOf("hotman") > -1 && this.BLEConnectDevice.id == 1) ||
|
|
|
- (eq.ename.indexOf("BLEHandle") > -1 && this.BLEConnectDevice.id == 2)||
|
|
|
+ (eq.ename.indexOf("BLEHandle") > -1 && this.BLEConnectDevice.id == 2) ||
|
|
|
(eq.ename.indexOf("rope") > -1 && this.BLEConnectDevice.id == 3)) {
|
|
|
eq.bRatio = true;
|
|
|
this.currentItem = eq;
|
|
@@ -153,6 +250,14 @@
|
|
|
}
|
|
|
|
|
|
|
|
|
+ },
|
|
|
+ onReady() {
|
|
|
+ let view = uni.createSelectorQuery().select('#task_0');
|
|
|
+ view.boundingClientRect(data => {
|
|
|
+ // console.log('参数:' + JSON.stringify(data));
|
|
|
+ //13 是间隔
|
|
|
+ this.threeTipHeight = data.top + data.height + 13;
|
|
|
+ }).exec();
|
|
|
},
|
|
|
onHide() {
|
|
|
//如果蓝牙弹出匹配框,会触发onHide。这时候处理蓝牙连接流程检测应等onShow 时候,再检测
|
|
@@ -161,7 +266,8 @@
|
|
|
methods: {
|
|
|
...mapMutations(['initAdapter', 'onCreateBLESuccess', 'onGetBLEDeviceServices', 'onOnlyCloseBLEConnection',
|
|
|
'onGetRSSITransDistance',
|
|
|
- 'addBLEDevice', 'onWriteBLEConnectionValue', 'deleteBLEDevice', 'B_GetBondedDevices', 'B_OpenBLESetting'
|
|
|
+ 'addBLEDevice', 'onWriteBLEConnectionValue', 'deleteBLEDevice', 'B_GetBondedDevices',
|
|
|
+ 'B_OpenBLESetting','setGuideUnlockState'
|
|
|
]),
|
|
|
//
|
|
|
onClearTimeout() {
|
|
@@ -204,7 +310,8 @@
|
|
|
// mac="BB:34:24:22:77:88";
|
|
|
// mac="较è¾";
|
|
|
//判断mac地址是否是合理的格式
|
|
|
- var tempMacRegExp = /[A-Fa-f0-9]{2}:[A-Fa-f0-9]{2}:[A-Fa-f0-9]{2}:[A-Fa-f0-9]{2}:[A-Fa-f0-9]{2}:[A-Fa-f0-9]{2}/;
|
|
|
+ var tempMacRegExp =
|
|
|
+ /[A-Fa-f0-9]{2}:[A-Fa-f0-9]{2}:[A-Fa-f0-9]{2}:[A-Fa-f0-9]{2}:[A-Fa-f0-9]{2}:[A-Fa-f0-9]{2}/;
|
|
|
if (!tempMacRegExp.test(mac)) {
|
|
|
uni.hideToast();
|
|
|
uni.showModal({
|
|
@@ -296,7 +403,7 @@
|
|
|
if (
|
|
|
(eq.ename.indexOf("mobilePhoneBandage") > -1 && this.BLEConnectDevice.id == 0) ||
|
|
|
(eq.ename.indexOf("hotman") > -1 && this.BLEConnectDevice.id == 1) ||
|
|
|
- (eq.ename.indexOf("BLEHandle") > -1 && this.BLEConnectDevice.id == 2)||
|
|
|
+ (eq.ename.indexOf("BLEHandle") > -1 && this.BLEConnectDevice.id == 2) ||
|
|
|
(eq.ename.indexOf("rope") > -1 && this.BLEConnectDevice.id == 3)) {
|
|
|
|
|
|
eq.bRatio = true;
|
|
@@ -449,7 +556,9 @@
|
|
|
"name": bondedDevice.name,
|
|
|
"RSSI": -74,
|
|
|
"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);
|
|
@@ -543,12 +652,13 @@
|
|
|
*/
|
|
|
// console.log("onBluetoothDeviceFound:", res);
|
|
|
res.devices.forEach(device => {
|
|
|
- if (device.name.indexOf('PBox') > -1 || device.name.indexOf('BGBox') > -1 || device.name.indexOf('Rope') > -1) {
|
|
|
+ if (device.name.indexOf('PBox') > -1 || device.name.indexOf('BGBox') > -1 || device
|
|
|
+ .name.indexOf('Rope') > -1) {
|
|
|
//如果搜索的设备名 不是对应当前设备类型,过滤
|
|
|
// if (device.name.indexOf(_self.currentItem.deviceName) == -1) return;
|
|
|
- if (_self.currentItem.deviceName.indexOf('PBox') == -1
|
|
|
- && _self.currentItem.deviceName.indexOf('BGBox') == -1
|
|
|
- && _self.currentItem.deviceName.indexOf('Rope') == -1
|
|
|
+ if (_self.currentItem.deviceName.indexOf('PBox') == -1 &&
|
|
|
+ _self.currentItem.deviceName.indexOf('BGBox') == -1 &&
|
|
|
+ _self.currentItem.deviceName.indexOf('Rope') == -1
|
|
|
) return;
|
|
|
//寻找到对应设备时候,其余的返回
|
|
|
if (_self.searchObj) return;
|
|
@@ -684,10 +794,16 @@
|
|
|
})
|
|
|
this.onOnlyCloseBLEConnection({
|
|
|
getSuccess: () => {
|
|
|
- if (this.currentItem)
|
|
|
- this.currentItem.bRatio = false;
|
|
|
-
|
|
|
- this.currentItem = null;
|
|
|
+ if (this
|
|
|
+ .currentItem
|
|
|
+ )
|
|
|
+ this
|
|
|
+ .currentItem
|
|
|
+ .bRatio =
|
|
|
+ false;
|
|
|
+
|
|
|
+ this.currentItem =
|
|
|
+ null;
|
|
|
}
|
|
|
});
|
|
|
}, 6000)
|
|
@@ -714,7 +830,8 @@
|
|
|
this.currentItem = null;
|
|
|
this.currentItem = item;
|
|
|
this.bSwitch = true;
|
|
|
- console.log("this.currentItem1 ==:", this.currentItem, this.bOpenBluetooth, this.BLEConnectDevice);
|
|
|
+ console.log("this.currentItem1 ==:", this.currentItem, this.bOpenBluetooth,
|
|
|
+ this.BLEConnectDevice);
|
|
|
this.startBluetoothDeviceDiscovery();
|
|
|
}
|
|
|
});
|
|
@@ -773,6 +890,78 @@
|
|
|
})
|
|
|
|
|
|
|
|
|
+ },
|
|
|
+
|
|
|
+ onSwiperChange(e) {
|
|
|
+ let currentIndex = e.detail.current;
|
|
|
+ // console.log(currentIndex);
|
|
|
+ if (currentIndex === this._videoIndex) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (currentIndex === 2) {
|
|
|
+ setTimeout(() => {
|
|
|
+ this.threeZIndex = 2;
|
|
|
+ }, 200)
|
|
|
+ } else {
|
|
|
+ this.threeZIndex = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ // let isNext = false;
|
|
|
+ // if (currentIndex === 0 && this._videoIndex === this.videoList.length - 1) {
|
|
|
+ // isNext = true;
|
|
|
+ // } else if (currentIndex === this.videoList.length - 1 && this._videoIndex === 0) {
|
|
|
+ // isNext = false;
|
|
|
+ // } else if (currentIndex > this._videoIndex) {
|
|
|
+ // isNext = true;
|
|
|
+ // }
|
|
|
+
|
|
|
+ // if (isNext) {
|
|
|
+ // this._videoDataIndex++;
|
|
|
+ // } else {
|
|
|
+ // this._videoDataIndex--;
|
|
|
+ // }
|
|
|
+
|
|
|
+ // if (this._videoDataIndex < 0) {
|
|
|
+ // this._videoDataIndex = this.videoDataList.length - 1;
|
|
|
+ // } else if (this._videoDataIndex >= this.videoDataList.length) {
|
|
|
+ // this._videoDataIndex = 0;
|
|
|
+ // }
|
|
|
+
|
|
|
+ // this.circular = (this._videoDataIndex != 0);
|
|
|
+
|
|
|
+ // if (this._videoIndex >= 0) {
|
|
|
+ // this._videoContextList[this._videoIndex].pause();
|
|
|
+ // this._videoContextList[this._videoIndex].seek(0);
|
|
|
+ // }
|
|
|
+
|
|
|
+ // this._videoIndex = currentIndex;
|
|
|
+
|
|
|
+
|
|
|
+ },
|
|
|
+ //禁止用户手动滑动
|
|
|
+ stopTouchMove() {
|
|
|
+ // return;
|
|
|
+ },
|
|
|
+ onSwiperClick() {
|
|
|
+ console.log('onSwiperClick');
|
|
|
+
|
|
|
+ this.currentIndex++;
|
|
|
+
|
|
|
+ if (this.currentIndex === 2) {
|
|
|
+ setTimeout(() => {
|
|
|
+ this.threeZIndex = 2;
|
|
|
+ }, 200)
|
|
|
+ } else {
|
|
|
+ this.threeZIndex = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ },
|
|
|
+ onSwiperItemClick(e) {
|
|
|
+ console.log('onSwiperItemClick');
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -784,4 +973,26 @@
|
|
|
border: 1rpx solid #9898FF;
|
|
|
box-sizing: border-box;
|
|
|
}
|
|
|
+
|
|
|
+ .swiper {
|
|
|
+ flex: 1;
|
|
|
+ background-color: rgba(0, 0, 0, 0.32);
|
|
|
+ }
|
|
|
+
|
|
|
+ .swiper-item {
|
|
|
+ flex: 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ .bluetooth-guide-number {
|
|
|
+ border-radius: 18px;
|
|
|
+ border-width: 1rpx;
|
|
|
+ width: 30px;
|
|
|
+ height: 30px;
|
|
|
+ text-align: center;
|
|
|
+ line-height: 30px;
|
|
|
+ color: #000000;
|
|
|
+ /* border-color: #FFFFFF; */
|
|
|
+ background-color: #FFFFFF;
|
|
|
+ margin-right: 13px;
|
|
|
+ }
|
|
|
</style>
|