修复有时候蓝牙配对成功依然提示未连接的异常
This commit is contained in:
@ -379,6 +379,12 @@
|
||||
these.formData.deviceId = v.deviceId;
|
||||
return true;
|
||||
}
|
||||
if(v.device){
|
||||
if(v.device.id==device.id){
|
||||
these.formData.deviceId = v.deviceId;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
if (!f) {
|
||||
@ -603,14 +609,24 @@
|
||||
|
||||
},
|
||||
getDevice: function() {
|
||||
|
||||
let f = ble.data.LinkedList.find((v) => {
|
||||
return v.macAddress == these.device.deviceMac;
|
||||
let flag=v.macAddress == these.device.deviceMac ;
|
||||
if(!flag && v.device){
|
||||
flag= v.device.id==these.device.id;
|
||||
}
|
||||
if(flag){
|
||||
these.formData.deviceId = v.deviceId;
|
||||
}
|
||||
return flag;
|
||||
});
|
||||
|
||||
// #ifdef WEB
|
||||
f = {
|
||||
deviceId: '123'
|
||||
}
|
||||
// #endif
|
||||
|
||||
return f;
|
||||
},
|
||||
showBleUnConnect() {
|
||||
|
||||
@ -1160,14 +1160,23 @@
|
||||
},
|
||||
getDevice: function() {
|
||||
|
||||
// console.log("LinkedList=", ble.data.LinkedList);
|
||||
// console.log("formData=", these.formData);
|
||||
let f = ble.data.LinkedList.find((v) => {
|
||||
return v.macAddress == these.device.deviceMac;
|
||||
});
|
||||
if (f) {
|
||||
this.formData.deviceId = f.deviceId;
|
||||
let flag=v.macAddress == these.device.deviceMac ;
|
||||
if(!flag && v.device){
|
||||
flag= v.device.id==these.device.id;
|
||||
}
|
||||
if(flag){
|
||||
these.formData.deviceId = v.deviceId;
|
||||
}
|
||||
return flag;
|
||||
});
|
||||
|
||||
// #ifdef WEB
|
||||
f = {
|
||||
deviceId: '123'
|
||||
}
|
||||
// #endif
|
||||
|
||||
return f;
|
||||
},
|
||||
|
||||
|
||||
@ -509,14 +509,7 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
let f = ble.data.LinkedList.find((v) => {
|
||||
if (v.macAddress == device.deviceMac) {
|
||||
// console.log("找到设备了", v);
|
||||
these.formData.deviceId = v.deviceId;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
let f =this.getDevice();
|
||||
if (!f) {
|
||||
|
||||
|
||||
@ -1300,12 +1293,23 @@ onFreqChanging(e){
|
||||
},
|
||||
getDevice: function() {
|
||||
|
||||
// console.log("LinkedList=", ble.data.LinkedList);
|
||||
// console.log("formData=", these.formData);
|
||||
let f = ble.data.LinkedList.find((v) => {
|
||||
return v.macAddress == these.device.deviceMac;
|
||||
let flag=v.macAddress == these.device.deviceMac ;
|
||||
if(!flag && v.device){
|
||||
flag= v.device.id==these.device.id;
|
||||
}
|
||||
if(flag){
|
||||
these.formData.deviceId = v.deviceId;
|
||||
}
|
||||
return flag;
|
||||
});
|
||||
|
||||
// #ifdef WEB
|
||||
f = {
|
||||
deviceId: '123'
|
||||
}
|
||||
// #endif
|
||||
|
||||
return f;
|
||||
},
|
||||
|
||||
|
||||
@ -248,14 +248,7 @@
|
||||
if (these.device.deviceImei) {
|
||||
these.initMQ();
|
||||
}
|
||||
let f = ble.data.LinkedList.find((v) => {
|
||||
if (v.macAddress == device.deviceMac) {
|
||||
console.log("找到设备了", v);
|
||||
these.formData.deviceId = v.deviceId;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
let f =these.getDevice();
|
||||
if (!f) {
|
||||
these.showBleUnConnect();
|
||||
these.getDetail();
|
||||
@ -472,7 +465,27 @@
|
||||
})
|
||||
}
|
||||
},
|
||||
getDevice: function() {
|
||||
|
||||
let f = ble.data.LinkedList.find((v) => {
|
||||
let flag = v.macAddress == these.device.deviceMac;
|
||||
if (!flag && v.device) {
|
||||
flag = v.device.id == these.device.id;
|
||||
}
|
||||
if (flag) {
|
||||
these.formData.deviceId = v.deviceId;
|
||||
}
|
||||
return flag;
|
||||
});
|
||||
|
||||
// #ifdef WEB
|
||||
f = {
|
||||
deviceId: '123'
|
||||
}
|
||||
// #endif
|
||||
|
||||
return f;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -459,14 +459,7 @@ created() {
|
||||
}
|
||||
these.device = device;
|
||||
these.getWarns();
|
||||
let f = ble.data.LinkedList.find((v) => {
|
||||
if (v.macAddress == device.deviceMac) {
|
||||
// console.log("找到设备了", v);
|
||||
these.formData.deviceId = v.deviceId;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
let f = these.getDevice();
|
||||
if (!f) {
|
||||
|
||||
|
||||
@ -1304,13 +1297,27 @@ created() {
|
||||
},
|
||||
getDevice: function() {
|
||||
|
||||
// console.log("LinkedList=", ble.data.LinkedList);
|
||||
// console.log("formData=", these.formData);
|
||||
|
||||
|
||||
let f = ble.data.LinkedList.find((v) => {
|
||||
return v.macAddress == these.device.deviceMac;
|
||||
let flag=v.macAddress == these.device.deviceMac ;
|
||||
if(!flag && v.device){
|
||||
flag= v.device.id==these.device.id;
|
||||
}
|
||||
if(flag){
|
||||
these.formData.deviceId = v.deviceId;
|
||||
}
|
||||
return flag;
|
||||
});
|
||||
|
||||
// #ifdef WEB
|
||||
f = {
|
||||
deviceId: '123'
|
||||
}
|
||||
// #endif
|
||||
|
||||
return f;
|
||||
|
||||
},
|
||||
|
||||
bleStatuToggle() {
|
||||
|
||||
@ -465,14 +465,7 @@
|
||||
}
|
||||
these.device = device;
|
||||
these.getWarns();
|
||||
let f = ble.data.LinkedList.find((v) => {
|
||||
if (v.macAddress == device.deviceMac) {
|
||||
// console.log("找到设备了", v);
|
||||
these.formData.deviceId = v.deviceId;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
let f = these.getDevice();
|
||||
if (!f) {
|
||||
|
||||
|
||||
@ -1328,12 +1321,23 @@
|
||||
},
|
||||
getDevice: function() {
|
||||
|
||||
// console.log("LinkedList=", ble.data.LinkedList);
|
||||
// console.log("formData=", these.formData);
|
||||
let f = ble.data.LinkedList.find((v) => {
|
||||
return v.macAddress == these.device.deviceMac;
|
||||
let flag=v.macAddress == these.device.deviceMac ;
|
||||
if(!flag && v.device){
|
||||
flag= v.device.id==these.device.id;
|
||||
}
|
||||
if(flag){
|
||||
these.formData.deviceId = v.deviceId;
|
||||
}
|
||||
return flag;
|
||||
});
|
||||
|
||||
// #ifdef WEB
|
||||
f = {
|
||||
deviceId: '123'
|
||||
}
|
||||
// #endif
|
||||
|
||||
return f;
|
||||
},
|
||||
|
||||
|
||||
@ -562,14 +562,7 @@
|
||||
if (these.device.deviceImei) {
|
||||
these.initMQ();
|
||||
}
|
||||
let f = ble.data.LinkedList.find((v) => {
|
||||
if (v.macAddress == device.deviceMac) {
|
||||
console.log("找到设备了", v);
|
||||
these.formData.deviceId = v.deviceId;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
let f = these.getDevice();
|
||||
if (!f) {
|
||||
these.showBleUnConnect();
|
||||
these.getDetail();
|
||||
@ -1468,18 +1461,22 @@
|
||||
},
|
||||
getDevice: function() {
|
||||
|
||||
let f ={deviceId:'123'};
|
||||
// #ifdef APP
|
||||
f= ble.data.LinkedList.find((v) => {
|
||||
if (v.macAddress == these.device.deviceMac) {
|
||||
if (!this.formData.deviceId) {
|
||||
this.formData.deviceId = v.deviceId
|
||||
};
|
||||
return true;
|
||||
let f = ble.data.LinkedList.find((v) => {
|
||||
let flag = v.macAddress == these.device.deviceMac;
|
||||
if (!flag && v.device) {
|
||||
flag = v.device.id == these.device.id;
|
||||
}
|
||||
if (flag) {
|
||||
these.formData.deviceId = v.deviceId;
|
||||
}
|
||||
return flag;
|
||||
});
|
||||
// #endif
|
||||
|
||||
// #ifdef WEB
|
||||
f = {
|
||||
deviceId: '123'
|
||||
}
|
||||
// #endif
|
||||
|
||||
return f;
|
||||
},
|
||||
|
||||
@ -531,14 +531,7 @@
|
||||
});
|
||||
})
|
||||
|
||||
let f = ble.data.LinkedList.find((v) => {
|
||||
if (v.macAddress == device.deviceMac) {
|
||||
// console.log("找到设备了", v);
|
||||
these.formData.deviceId = v.deviceId;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
let f = these.getDevice();
|
||||
if (!f) {
|
||||
|
||||
|
||||
@ -1271,12 +1264,23 @@
|
||||
},
|
||||
getDevice: function() {
|
||||
|
||||
console.log("LinkedList=", ble.data.LinkedList);
|
||||
console.log("formData=", these.device);
|
||||
let f = ble.data.LinkedList.find((v) => {
|
||||
return v.macAddress == these.device.deviceMac;
|
||||
let flag = v.macAddress == these.device.deviceMac;
|
||||
if (!flag && v.device) {
|
||||
flag = v.device.id == these.device.id;
|
||||
}
|
||||
if (flag) {
|
||||
these.formData.deviceId = v.deviceId;
|
||||
}
|
||||
return flag;
|
||||
});
|
||||
|
||||
// #ifdef WEB
|
||||
f = {
|
||||
deviceId: '123'
|
||||
}
|
||||
// #endif
|
||||
|
||||
return f;
|
||||
},
|
||||
|
||||
@ -1614,7 +1618,8 @@
|
||||
border-color: #aed600 !important;
|
||||
}
|
||||
|
||||
.lampMode .mode.active .bigTxt,.lampMode .mode.active .smallTxt {
|
||||
.lampMode .mode.active .bigTxt,
|
||||
.lampMode .mode.active .smallTxt {
|
||||
|
||||
color: #aed600 !important;
|
||||
}
|
||||
|
||||
@ -1282,17 +1282,23 @@
|
||||
},
|
||||
getDevice: function() {
|
||||
|
||||
console.log("LinkedList=", ble.data.LinkedList);
|
||||
console.log("this.device=", this.device);
|
||||
let f = ble.data.LinkedList.find((v) => {
|
||||
if (v.macAddress == these.device.deviceMac) {
|
||||
if (!this.formData.deviceId) {
|
||||
this.formData.deviceId = v.deviceId
|
||||
};
|
||||
return true;
|
||||
let flag = v.macAddress == these.device.deviceMac;
|
||||
if (!flag && v.device) {
|
||||
flag = v.device.id == these.device.id;
|
||||
}
|
||||
if (flag) {
|
||||
these.formData.deviceId = v.deviceId;
|
||||
}
|
||||
return flag;
|
||||
});
|
||||
|
||||
// #ifdef WEB
|
||||
f = {
|
||||
deviceId: '123'
|
||||
}
|
||||
// #endif
|
||||
|
||||
return f;
|
||||
},
|
||||
showBleUnConnect() {
|
||||
@ -1524,7 +1530,8 @@
|
||||
},
|
||||
gotoMap() {
|
||||
let promise = Promise.resolve([this.formData.sta_longitude, this.formData
|
||||
.sta_latitude]); //lnglatConvert.wgs84_to_gcj02(this.formData.sta_longitude, this.formData.sta_latitude);
|
||||
.sta_latitude
|
||||
]); //lnglatConvert.wgs84_to_gcj02(this.formData.sta_longitude, this.formData.sta_latitude);
|
||||
promise.then(lnglat => {
|
||||
|
||||
this.detailData.longitude = lnglat[0];
|
||||
|
||||
@ -377,14 +377,7 @@
|
||||
// console.log("收到父页面的参数:" + JSON.stringify(data));
|
||||
var device = data.data;
|
||||
these.device = device;
|
||||
let f = ble.data.LinkedList.find((v) => {
|
||||
if (v.macAddress == device.deviceMac) {
|
||||
// console.log("找到设备了", v);
|
||||
these.formData.deviceId = v.deviceId;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
let f = these.getDevice();
|
||||
if (!f) {
|
||||
|
||||
|
||||
@ -803,12 +796,23 @@
|
||||
|
||||
getDevice: function() {
|
||||
|
||||
// console.log("LinkedList=", ble.data.LinkedList);
|
||||
// console.log("formData=", these.formData);
|
||||
let f = ble.data.LinkedList.find((v) => {
|
||||
return v.macAddress == these.device.deviceMac;
|
||||
let flag = v.macAddress == these.device.deviceMac;
|
||||
if (!flag && v.device) {
|
||||
flag = v.device.id == these.device.id;
|
||||
}
|
||||
if (flag) {
|
||||
these.formData.deviceId = v.deviceId;
|
||||
}
|
||||
return flag;
|
||||
});
|
||||
|
||||
// #ifdef WEB
|
||||
f = {
|
||||
deviceId: '123'
|
||||
}
|
||||
// #endif
|
||||
|
||||
return f;
|
||||
},
|
||||
|
||||
@ -1846,6 +1850,4 @@
|
||||
.volMath {
|
||||
color: rgba(174, 214, 0, 1);
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
@ -37,7 +37,8 @@
|
||||
<view class="row">
|
||||
<image class="img" src="/static/images/common/time.png" mode="aspectFit"></image>
|
||||
<view class="txt">
|
||||
<view class="bigTxt" v-show="getMode('main')!='关闭'||getMode('fu')!='关闭'">{{formData.xuhang}}</view>
|
||||
<view class="bigTxt" v-show="getMode('main')!='关闭'||getMode('fu')!='关闭'">{{formData.xuhang}}
|
||||
</view>
|
||||
<view class="smallTxt">续航时间</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -375,14 +376,7 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
let f = ble.data.LinkedList.find((v) => {
|
||||
if (v.macAddress == device.deviceMac) {
|
||||
// console.log("找到设备了", v);
|
||||
these.formData.deviceId = v.deviceId;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
let f = these.getDevice();
|
||||
if (!f) {
|
||||
|
||||
these.getDetail();
|
||||
@ -665,12 +659,23 @@
|
||||
})
|
||||
},
|
||||
getDevice: function() {
|
||||
// console.log("LinkedList=", ble.data.LinkedList);
|
||||
// console.log("formData=", these.formData);
|
||||
let f = ble.data.LinkedList.find((v) => {
|
||||
return v.macAddress == these.device.deviceMac;
|
||||
let flag = v.macAddress == these.device.deviceMac;
|
||||
if (!flag && v.device) {
|
||||
flag = v.device.id == these.device.id;
|
||||
}
|
||||
if (flag) {
|
||||
these.formData.deviceId = v.deviceId;
|
||||
}
|
||||
return flag;
|
||||
});
|
||||
|
||||
// #ifdef WEB
|
||||
f = {
|
||||
deviceId: '123'
|
||||
}
|
||||
// #endif
|
||||
|
||||
return f;
|
||||
},
|
||||
bleValueNotify: function(receive, device, path, recArr) {
|
||||
@ -1748,7 +1753,9 @@
|
||||
res = res.data;
|
||||
let personnelInfo = res.personnelInfo;
|
||||
if (personnelInfo) {
|
||||
these.formData.textLines=[personnelInfo.position, personnelInfo.name,personnelInfo.unitName];
|
||||
these.formData.textLines = [personnelInfo.position, personnelInfo.name, personnelInfo
|
||||
.unitName
|
||||
];
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -344,14 +344,7 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
let f = ble.data.LinkedList.find((v) => {
|
||||
if (v.macAddress == device.deviceMac) {
|
||||
console.log("找到设备了", v);
|
||||
these.formData.deviceId = v.deviceId;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
let f = these.getDevice();
|
||||
if (!f) {
|
||||
|
||||
these.getDetail();
|
||||
@ -632,12 +625,23 @@
|
||||
})
|
||||
},
|
||||
getDevice: function() {
|
||||
// console.log("LinkedList=", ble.data.LinkedList);
|
||||
// console.log("formData=", these.formData);
|
||||
let f = ble.data.LinkedList.find((v) => {
|
||||
return v.macAddress == these.device.deviceMac;
|
||||
let flag = v.macAddress == these.device.deviceMac;
|
||||
if (!flag && v.device) {
|
||||
flag = v.device.id == these.device.id;
|
||||
}
|
||||
if (flag) {
|
||||
these.formData.deviceId = v.deviceId;
|
||||
}
|
||||
return flag;
|
||||
});
|
||||
|
||||
// #ifdef WEB
|
||||
f = {
|
||||
deviceId: '123'
|
||||
}
|
||||
// #endif
|
||||
|
||||
return f;
|
||||
},
|
||||
bleValueNotify: function(receive, device, path, recArr) {
|
||||
|
||||
@ -557,14 +557,22 @@
|
||||
if (ble) {
|
||||
|
||||
let f = ble.data.LinkedList.find((v) => {
|
||||
if (v.macAddress == this.itemInfo.deviceMac) {
|
||||
if (!this.formData.deviceId) {
|
||||
this.formData.deviceId = v.deviceId
|
||||
};
|
||||
return true;
|
||||
let flag = v.macAddress == these.device.deviceMac;
|
||||
if (!flag && v.device) {
|
||||
flag = v.device.id == these.device.id;
|
||||
}
|
||||
if (flag) {
|
||||
these.formData.deviceId = v.deviceId;
|
||||
}
|
||||
return flag;
|
||||
});
|
||||
|
||||
// #ifdef WEB
|
||||
f = {
|
||||
deviceId: '123'
|
||||
}
|
||||
// #endif
|
||||
|
||||
return f;
|
||||
}
|
||||
return null;
|
||||
@ -2117,14 +2125,7 @@
|
||||
this.initBle();
|
||||
|
||||
console.log("ble=", ble);
|
||||
let f = ble.data.LinkedList.find((v) => {
|
||||
if (v.macAddress == this.itemInfo.deviceMac) {
|
||||
console.log("找到设备了", v);
|
||||
these.formData.deviceId = v.deviceId;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
let f = these.getDevice();
|
||||
|
||||
if (f) {
|
||||
these.formData.bleStatu = 'connecting';
|
||||
|
||||
@ -218,7 +218,9 @@
|
||||
hideLoading,
|
||||
updateLoading
|
||||
} from '@/utils/loading.js'
|
||||
import request, { baseURL } from '@/utils/request.js';
|
||||
import request, {
|
||||
baseURL
|
||||
} from '@/utils/request.js';
|
||||
|
||||
import usrApi from '@/api/670/HBY670.js';
|
||||
import {
|
||||
@ -360,14 +362,7 @@ import request, { baseURL } from '@/utils/request.js';
|
||||
// console.log("收到父页面的参数:" + JSON.stringify(data));
|
||||
var device = data.data;
|
||||
these.device = device;
|
||||
let f = ble.data.LinkedList.find((v) => {
|
||||
if (v.macAddress == device.deviceMac) {
|
||||
// console.log("找到设备了", v);
|
||||
these.formData.deviceId = v.deviceId;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
let f = these.getDevice();
|
||||
if (!f) {
|
||||
|
||||
|
||||
@ -693,12 +688,23 @@ import request, { baseURL } from '@/utils/request.js';
|
||||
},
|
||||
getDevice: function() {
|
||||
|
||||
// console.log("LinkedList=", ble.data.LinkedList);
|
||||
// console.log("formData=", these.formData);
|
||||
let f = ble.data.LinkedList.find((v) => {
|
||||
return v.macAddress == these.device.deviceMac;
|
||||
let flag = v.macAddress == these.device.deviceMac;
|
||||
if (!flag && v.device) {
|
||||
flag = v.device.id == these.device.id;
|
||||
}
|
||||
if (flag) {
|
||||
these.formData.deviceId = v.deviceId;
|
||||
}
|
||||
return flag;
|
||||
});
|
||||
|
||||
// #ifdef WEB
|
||||
f = {
|
||||
deviceId: '123'
|
||||
}
|
||||
// #endif
|
||||
|
||||
return f;
|
||||
},
|
||||
getDetail() {
|
||||
|
||||
@ -113,8 +113,7 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="mode marginLeft fleft"
|
||||
v-on:click.stop="ShowUpload()">
|
||||
<view class="mode marginLeft fleft" v-on:click.stop="ShowUpload()">
|
||||
<view class="leftImg">
|
||||
<image class="img" src="/static/images/6155/DeviceDetail/open.png" mode="aspectFit"></image>
|
||||
</view>
|
||||
@ -183,7 +182,9 @@
|
||||
hideLoading,
|
||||
updateLoading
|
||||
} from '@/utils/loading.js'
|
||||
import request, { baseURL } from '@/utils/request.js';
|
||||
import request, {
|
||||
baseURL
|
||||
} from '@/utils/request.js';
|
||||
|
||||
import usrApi from '@/api/670/HBY670.js';
|
||||
import {
|
||||
@ -334,14 +335,7 @@ created() {
|
||||
}
|
||||
});
|
||||
}
|
||||
let f = ble.data.LinkedList.find((v) => {
|
||||
if (v.macAddress == device.deviceMac) {
|
||||
// console.log("找到设备了", v);
|
||||
these.formData.deviceId = v.deviceId;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
let f = these.getDevice();
|
||||
if (!f) {
|
||||
|
||||
|
||||
@ -640,12 +634,23 @@ created() {
|
||||
},
|
||||
getDevice: function() {
|
||||
|
||||
// console.log("LinkedList=", ble.data.LinkedList);
|
||||
// console.log("formData=", these.formData);
|
||||
let f = ble.data.LinkedList.find((v) => {
|
||||
return v.macAddress == these.device.deviceMac;
|
||||
let flag = v.macAddress == these.device.deviceMac;
|
||||
if (!flag && v.device) {
|
||||
flag = v.device.id == these.device.id;
|
||||
}
|
||||
if (flag) {
|
||||
these.formData.deviceId = v.deviceId;
|
||||
}
|
||||
return flag;
|
||||
});
|
||||
|
||||
// #ifdef WEB
|
||||
f = {
|
||||
deviceId: '123'
|
||||
}
|
||||
// #endif
|
||||
|
||||
return f;
|
||||
},
|
||||
getDetail() {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<view class="content contentBg">
|
||||
<uni-nav-bar :border="false" @clickLeft="prevPage" fixed="true" statusBar="true"
|
||||
background-color="#121212" color="#FFFFFF" :title="Status.navbar.title">
|
||||
<uni-nav-bar :border="false" @clickLeft="prevPage" fixed="true" statusBar="true" background-color="#121212"
|
||||
color="#FFFFFF" :title="Status.navbar.title">
|
||||
<template v-slot:left>
|
||||
<view>
|
||||
<uni-icons type="left" size="24" color="#FFFFFF"></uni-icons>
|
||||
@ -9,7 +9,8 @@
|
||||
</template>
|
||||
<block slot="right">
|
||||
<view class="navbarRight center">
|
||||
<image @click.stop="handleRightClick(index,item)" v-for="item,index in Status.navbar.icons" class="img" :src="item.src" mode="aspectFit"></image>
|
||||
<image @click.stop="handleRightClick(index,item)" v-for="item,index in Status.navbar.icons"
|
||||
class="img" :src="item.src" mode="aspectFit"></image>
|
||||
</view>
|
||||
|
||||
</block>
|
||||
@ -287,7 +288,9 @@
|
||||
hideLoading,
|
||||
updateLoading
|
||||
} from '@/utils/loading.js'
|
||||
import request, { baseURL } from '@/utils/request.js';
|
||||
import request, {
|
||||
baseURL
|
||||
} from '@/utils/request.js';
|
||||
import lnglatConvert from '@/utils/wgs84_to_gcj02.js';
|
||||
import {
|
||||
MsgSuccess,
|
||||
@ -511,14 +514,7 @@
|
||||
if (these.device.deviceImei) {
|
||||
these.initMQ();
|
||||
}
|
||||
let f = ble.data.LinkedList.find((v) => {
|
||||
if (v.macAddress == device.deviceMac) {
|
||||
console.log("找到设备了", v);
|
||||
these.formData.deviceId = v.deviceId;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
let f = these.getDevice();
|
||||
if (!f) {
|
||||
these.showBleUnConnect();
|
||||
these.getDetail();
|
||||
@ -931,7 +927,8 @@
|
||||
// console.log("收到文本回复", payload);
|
||||
// // this.SendTxtMQ(json);
|
||||
// }
|
||||
if (keys.indexOf('sta_BreakNews') > -1) { //紧急通知
|
||||
if (keys.indexOf('sta_BreakNews') > -
|
||||
1) { //紧急通知
|
||||
if (json.sta_BreakNews == 'I get it') {
|
||||
showPop({
|
||||
showPop: true,
|
||||
@ -1134,12 +1131,23 @@
|
||||
},
|
||||
getDevice: function() {
|
||||
|
||||
console.log("LinkedList=", ble.data.LinkedList);
|
||||
console.log("this.device=", this.device);
|
||||
let f = ble.data.LinkedList.find((v) => {
|
||||
return v.macAddress == these.device.deviceMac;
|
||||
let flag = v.macAddress == these.device.deviceMac;
|
||||
if (!flag && v.device) {
|
||||
flag = v.device.id == these.device.id;
|
||||
}
|
||||
if (flag) {
|
||||
these.formData.deviceId = v.deviceId;
|
||||
}
|
||||
return flag;
|
||||
});
|
||||
|
||||
// #ifdef WEB
|
||||
f = {
|
||||
deviceId: '123'
|
||||
}
|
||||
// #endif
|
||||
|
||||
return f;
|
||||
},
|
||||
setBleFormData() {
|
||||
@ -3345,6 +3353,7 @@
|
||||
height: 35rpx;
|
||||
margin-right: 30rpx;
|
||||
}
|
||||
|
||||
.uni-navbar--fixed {
|
||||
top: 0rpx;
|
||||
}
|
||||
|
||||
@ -119,15 +119,18 @@
|
||||
|
||||
<view class="item">
|
||||
<text class="lbl">单位:</text>
|
||||
<input class="value" maxlength="5" v-model="formData.inputLines[0]" placeholder="请输入单位" placeholder-class="usrplace" />
|
||||
<input class="value" maxlength="5" v-model="formData.inputLines[0]" placeholder="请输入单位"
|
||||
placeholder-class="usrplace" />
|
||||
</view>
|
||||
<view class="item">
|
||||
<text class="lbl">部门:</text>
|
||||
<input class="value" maxlength="5" v-model="formData.inputLines[1]" placeholder="请输入姓名" placeholder-class="usrplace" />
|
||||
<input class="value" maxlength="5" v-model="formData.inputLines[1]" placeholder="请输入姓名"
|
||||
placeholder-class="usrplace" />
|
||||
</view>
|
||||
<view class="item">
|
||||
<text class="lbl">姓名:</text>
|
||||
<input class="value" maxlength="5" v-model="formData.inputLines[2]" placeholder="请输入职位" placeholder-class="usrplace" />
|
||||
<input class="value" maxlength="5" v-model="formData.inputLines[2]" placeholder="请输入职位"
|
||||
placeholder-class="usrplace" />
|
||||
</view>
|
||||
|
||||
</view>
|
||||
@ -320,14 +323,7 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
let f = ble.data.LinkedList.find((v) => {
|
||||
if (v.macAddress == device.deviceMac) {
|
||||
console.log("找到设备了", v);
|
||||
these.formData.deviceId = v.deviceId;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
let f = these.getDevice();
|
||||
if (!f) {
|
||||
|
||||
these.getDetail();
|
||||
@ -568,12 +564,23 @@
|
||||
})
|
||||
},
|
||||
getDevice: function() {
|
||||
// console.log("LinkedList=", ble.data.LinkedList);
|
||||
// console.log("formData=", these.formData);
|
||||
let f = ble.data.LinkedList.find((v) => {
|
||||
return v.macAddress == these.device.deviceMac;
|
||||
let flag = v.macAddress == these.device.deviceMac;
|
||||
if (!flag && v.device) {
|
||||
flag = v.device.id == these.device.id;
|
||||
}
|
||||
if (flag) {
|
||||
these.formData.deviceId = v.deviceId;
|
||||
}
|
||||
return flag;
|
||||
});
|
||||
|
||||
// #ifdef WEB
|
||||
f = {
|
||||
deviceId: '123'
|
||||
}
|
||||
// #endif
|
||||
|
||||
return f;
|
||||
},
|
||||
bleValueNotify: function(receive, device, path, recArr) {
|
||||
@ -1184,7 +1191,9 @@ debugger;
|
||||
}
|
||||
|
||||
|
||||
this.formData.textLines=[this.formData.inputLines[0],this.formData.inputLines[1],this.formData.inputLines[2]];
|
||||
this.formData.textLines = [this.formData.inputLines[0], this.formData.inputLines[1], this.formData
|
||||
.inputLines[2]
|
||||
];
|
||||
|
||||
showLoading(these, {
|
||||
text: "发送中..."
|
||||
@ -1234,7 +1243,10 @@ debugger;
|
||||
.toString(16).padStart(2, '0'));
|
||||
console.log(`发送数据块 ${chunkIndex + 1}/${numChunks}:`, hexArray
|
||||
.join(' '));
|
||||
updateLoading(these,{text:'正在发送'+((index-1)*14+chunkIndex + 1)+'/42'})
|
||||
updateLoading(these, {
|
||||
text: '正在发送' + ((index - 1) * 14 + chunkIndex +
|
||||
1) + '/42'
|
||||
})
|
||||
ble.sendData(f.deviceId, chunk, f.writeServiceId, f
|
||||
.wirteCharactId, 100).then(() => {
|
||||
chunkIndex++;
|
||||
@ -1344,7 +1356,9 @@ debugger;
|
||||
res = res.data;
|
||||
let personnelInfo = res.personnelInfo;
|
||||
if (personnelInfo) {
|
||||
these.formData.inputLines=[personnelInfo.position,personnelInfo.name,personnelInfo.unitName];
|
||||
these.formData.inputLines = [personnelInfo.position, personnelInfo.name, personnelInfo
|
||||
.unitName
|
||||
];
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -58,7 +58,7 @@
|
||||
</view>
|
||||
<view class="list searchList">
|
||||
<view class="item" v-on:click="Link(item,index)" v-for="item, index in EquipMents"
|
||||
v-show="item.name.indexOf(search)>-1">
|
||||
v-show="item.name.toLowerCase().indexOf(search.toLowerCase())>-1">
|
||||
<view class="before" v-if="item.isTarget"></view>
|
||||
<view class="leftImg ">
|
||||
<image src="/static/images/BLEAdd/bluetooth.png" class="titleIco" mode="heightFix">
|
||||
@ -131,7 +131,7 @@
|
||||
var ble = null;
|
||||
var these = null;
|
||||
var eventChannel = null;
|
||||
|
||||
var sortTime=null;
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@ -362,15 +362,18 @@
|
||||
device.isTarget = true;
|
||||
}
|
||||
if (device.name) {
|
||||
device.name = device.name.replace(/^JQZM-/i, '').replace(/^HBY102J-/i, '');
|
||||
device.name = device.name.replace(/^HBY102J-/i, '');
|
||||
}
|
||||
these.EquipMents.push(device);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
clearTimeout(sortTime);
|
||||
sortTime=setTimeout(()=>{
|
||||
these.EquipMents.sort((a, b) => b.RSSI - a.RSSI);
|
||||
},500);
|
||||
|
||||
these.EquipMents.sort((a, b) => b.RSSI - a.RSSI); //信号好的排前面,一般信号好的是目标设备
|
||||
|
||||
}, pagePath);
|
||||
|
||||
@ -632,9 +635,9 @@
|
||||
}
|
||||
hideLoading(these);
|
||||
these.device.bleId=deviceId;
|
||||
eventChannel.emit('BindOver', these.device);
|
||||
|
||||
ble.updateCache();
|
||||
eventChannel.emit('BindOver', these.device);
|
||||
uni.navigateBack();
|
||||
}
|
||||
|
||||
@ -642,7 +645,8 @@
|
||||
if (f && f.macAddress) {
|
||||
|
||||
if (!these.device || !these.device.deviceMac) { //走服务端验证
|
||||
console.error("走服务端验证")
|
||||
console.error("理论上永远不会走这里,走服务端验证");
|
||||
console.error("我TM太相信理论了");
|
||||
request({
|
||||
url: '/app/device/getDeviceInfoByDeviceMac',
|
||||
method: 'GET',
|
||||
@ -650,8 +654,6 @@
|
||||
deviceMac: f.macAddress
|
||||
}
|
||||
}).then(res => {
|
||||
|
||||
|
||||
if (res && res.code == 200) {
|
||||
|
||||
let data = res.data;
|
||||
@ -701,17 +703,7 @@
|
||||
clearInterval(this.Status.intval)
|
||||
this.Status.intval = null;
|
||||
this.Status.time = null;
|
||||
f = ble.data.LinkedList.find(v => {
|
||||
if (v.deviceId == deviceId) {
|
||||
v.device = these.device;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
if (!(f && f.macAddress)) {
|
||||
deviceInvalid()
|
||||
return;
|
||||
}
|
||||
deviceInvalid();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -164,7 +164,20 @@ class BleHelper {
|
||||
//更新缓存
|
||||
updateCache() {
|
||||
|
||||
uni.setStorageSync(this.StorageKey, this.data.LinkedList);
|
||||
let task =async () => {
|
||||
await uni.setStorage({
|
||||
key: this.StorageKey,
|
||||
data: this.data.LinkedList,
|
||||
success() {
|
||||
|
||||
},
|
||||
fail(ex) {
|
||||
console.error("更新蓝牙缓存失败");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
task();
|
||||
|
||||
}
|
||||
//连接所有已连接过的设备
|
||||
@ -1711,9 +1724,11 @@ class BleHelper {
|
||||
|
||||
if (fIndex > -1) {
|
||||
this.data.LinkedList[fIndex].Linked = true;
|
||||
this.data.LinkedList[fIndex].linkId =linkId;
|
||||
this.data.LinkedList[fIndex].linkId =
|
||||
linkId;
|
||||
this.data.LinkedList[fIndex].name = cr.name;
|
||||
this.data.LinkedList[fIndex].advertisData =cr.advertisData;
|
||||
this.data.LinkedList[fIndex].advertisData =
|
||||
cr.advertisData;
|
||||
} else {
|
||||
this.data.LinkedList.push(cr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user