670人员登记调整,蓝牙成功不再走后端
This commit is contained in:
@ -10,7 +10,7 @@
|
||||
|
||||
<view class="imgContent center">
|
||||
<view class="img center">
|
||||
<image src="/static/images/common/bluetooth.png" class="titleIco" mode="aspectFit">
|
||||
<image src="/static/images/BLEAdd/bluetooth.png" class="titleIco" mode="aspectFit">
|
||||
</image>
|
||||
</view>
|
||||
|
||||
@ -44,19 +44,31 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="lblTitle">搜索设备</view>
|
||||
<view class="lblTitle">
|
||||
<text>搜索设备</text>
|
||||
<view @click="refreshBleList()">刷新</view>
|
||||
</view>
|
||||
<view class="list searchList">
|
||||
<view class="item" v-on:click="Link(item,index)" v-for="item, index in EquipMents"
|
||||
v-show="!item['linkStatu']">
|
||||
<view class="leftImg ">
|
||||
<image src="/static/images/common/bluetooth.png" class="titleIco" mode="heightFix">
|
||||
<image src="/static/images/BLEAdd/bluetooth.png" class="titleIco" mode="heightFix">
|
||||
</image>
|
||||
</view>
|
||||
<view class="centertxt ">
|
||||
<view class="name" v-text="item.name?item.name:'Unnamed'"></view>
|
||||
<view class="id" v-text="item.deviceId"></view>
|
||||
<view class="name">
|
||||
<text>{{item.name?item.name:'Unnamed'}}</text>
|
||||
|
||||
</view>
|
||||
<view class="id" >
|
||||
<text>信号强度:{{110+item.RSSI>100?100:110+item.RSSI}}%</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="rightIco center">
|
||||
|
||||
|
||||
|
||||
<image :src="isItemLink(item,index)" class="img" mode="aspectFit">
|
||||
</image>
|
||||
</view>
|
||||
@ -154,34 +166,34 @@
|
||||
these = this;
|
||||
ble = bleTool.getBleTool();
|
||||
//已连接过但删除了设备
|
||||
let delArr = ble.data.deletedEqs.map(v => {
|
||||
return {
|
||||
"deviceId": v.deviceId,
|
||||
"name": v.name,
|
||||
"RSSI": -99,
|
||||
"localName": v.name,
|
||||
}
|
||||
});
|
||||
//已连接过但没绑定过的设备
|
||||
let noDev = ble.data.LinkedList.filter(v => {
|
||||
return !(v.device && v.device.id);
|
||||
}).map(v => {
|
||||
return {
|
||||
"deviceId": v.deviceId,
|
||||
"name": v.name,
|
||||
"RSSI": -99,
|
||||
"localName": v.name,
|
||||
}
|
||||
});
|
||||
delArr = delArr.concat(noDev);
|
||||
// let delArr = ble.data.deletedEqs.map(v => {
|
||||
// return {
|
||||
// "deviceId": v.deviceId,
|
||||
// "name": v.name,
|
||||
// "RSSI": -99,
|
||||
// "localName": v.name,
|
||||
// }
|
||||
// });
|
||||
// //已连接过但没绑定过的设备
|
||||
// let noDev = ble.data.LinkedList.filter(v => {
|
||||
// return !(v.device && v.device.id);
|
||||
// }).map(v => {
|
||||
// return {
|
||||
// "deviceId": v.deviceId,
|
||||
// "name": v.name,
|
||||
// "RSSI": -99,
|
||||
// "localName": v.name,
|
||||
// }
|
||||
// });
|
||||
// delArr = delArr.concat(noDev);
|
||||
|
||||
console.log("可能搜不到的设备=", delArr);
|
||||
this.EquipMents = delArr;
|
||||
// console.log("可能搜不到的设备=", delArr);
|
||||
this.EquipMents = []; //delArr;
|
||||
|
||||
|
||||
|
||||
ble.addDeviceFound((arr) => {
|
||||
// console.log("发现新设备,",arr);
|
||||
|
||||
arr = arr.devices;
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
|
||||
@ -190,15 +202,18 @@
|
||||
continue;
|
||||
}
|
||||
|
||||
let f = these.EquipMents.find(function(v) {
|
||||
return v.deviceId == arr[i].deviceId;
|
||||
let f = these.EquipMents.find((v, index) => {
|
||||
if (v.deviceId == arr[i].deviceId) {
|
||||
// v.RSSI=arr[i].RSSI;//同一设备上报更新信号强度
|
||||
these.$set(these.EquipMents[index], 'RSSI', arr[i].RSSI);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
if (!f) {
|
||||
if (arr[i].deviceId == '35:06:00:EF:46:51') {
|
||||
console.log("EquipMents=", these.EquipMents);
|
||||
console.log("arr[i]=", arr[i]);
|
||||
}
|
||||
console.log("发现新设备,", arr[i]);
|
||||
arr[i].name=arr[i].name.replace('JQZM-','');
|
||||
these.EquipMents.push(arr[i]);
|
||||
} else {
|
||||
|
||||
@ -237,7 +252,7 @@
|
||||
|
||||
// this.EquipMents = [];
|
||||
|
||||
this.PairEquip = [];
|
||||
// this.PairEquip = [];
|
||||
ble && ble.StartSearch().then(res => {
|
||||
console.log("开始搜索成功", res);
|
||||
}).catch((ex) => {
|
||||
@ -248,6 +263,23 @@
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
refreshBleList() {
|
||||
if (!ble) {
|
||||
return;
|
||||
}
|
||||
console.log("111111");
|
||||
ble.StopSearch().then(res => {
|
||||
console.log("停止搜索成功");
|
||||
this.EquipMents = [];
|
||||
ble.StartSearch().then(result => {
|
||||
console.log("开始搜索成功");
|
||||
}).catch(err => {
|
||||
console.log("err=", err);
|
||||
});
|
||||
}).catch(ex => {
|
||||
console.log("ex=", ex);
|
||||
});
|
||||
},
|
||||
isItemLink: function(item, index) {
|
||||
let src = '/static/images/BLEAdd/noLink.png';
|
||||
|
||||
@ -458,7 +490,7 @@
|
||||
}
|
||||
|
||||
.content {
|
||||
background-color: #1d1d1d;
|
||||
background-color: #121212;
|
||||
color: #ffffffde;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
@ -533,6 +565,7 @@
|
||||
.animate .titleIco {
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
|
||||
}
|
||||
|
||||
.circle {
|
||||
@ -542,7 +575,7 @@
|
||||
animation: expand 4s infinite ease-out;
|
||||
display: inline-block;
|
||||
transform: translate(-50%, -50%);
|
||||
|
||||
border:1rpx solid #bbe6003d;
|
||||
}
|
||||
|
||||
.circle:nth-child(2) {
|
||||
@ -561,7 +594,7 @@
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
100% {
|
||||
width: 18.75rem;
|
||||
@ -575,10 +608,10 @@
|
||||
padding: 30rpx;
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
height: calc(100% - 400rpx);
|
||||
height: calc(100% - 300rpx);
|
||||
overflow-y: scroll;
|
||||
position: absolute;
|
||||
top: 400rpx;
|
||||
top: 300rpx;
|
||||
left: 0rpx;
|
||||
}
|
||||
|
||||
@ -594,6 +627,13 @@
|
||||
width: 100%;
|
||||
height: 28rpx;
|
||||
line-height: 28rpx;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
align-content: center;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.list {
|
||||
@ -608,9 +648,10 @@
|
||||
|
||||
.list .item {
|
||||
width: 100%;
|
||||
height: 120rpx;
|
||||
min-height: 120rpx;
|
||||
height: auto;
|
||||
box-sizing: border-box;
|
||||
padding: 30rpx;
|
||||
padding: 20rpx;
|
||||
border-radius: 8px;
|
||||
background: #1a1a1a;
|
||||
display: flex;
|
||||
@ -627,7 +668,7 @@
|
||||
}
|
||||
|
||||
.list .item .centertxt {
|
||||
width: calc(100% - 150rpx);
|
||||
width: calc(100% - 100rpx);
|
||||
height: 100%;
|
||||
padding-left: 10rpx;
|
||||
display: flex;
|
||||
@ -640,14 +681,21 @@
|
||||
}
|
||||
|
||||
.list .item .rightIco {
|
||||
width: 50rpx;
|
||||
width: 40rpx;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
align-content: center;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
|
||||
.list .item .leftImg .titleIco {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
filter:invert(100%);
|
||||
}
|
||||
|
||||
.list .item .name {
|
||||
@ -662,7 +710,7 @@
|
||||
.list .item .id {
|
||||
color: #ffffff99;
|
||||
font-family: "PingFang SC";
|
||||
font-size: 24rpx;
|
||||
font-size: 26rpx;
|
||||
font-weight: 400;
|
||||
line-height: 36rpx;
|
||||
text-align: left;
|
||||
@ -670,8 +718,8 @@
|
||||
|
||||
|
||||
.list .item .rightIco .img {
|
||||
width: 45rpx;
|
||||
height: 45rpx;
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
}
|
||||
|
||||
.openBlue {
|
||||
|
||||
Reference in New Issue
Block a user