加入6107设备页面、蓝牙配对模式修复首次进入找不到设备的问题
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
const config = {
|
||||
// 开发环境
|
||||
development: {
|
||||
BASE_URL: 'http://139.224.253.23:8000',
|
||||
BASE_URL: 'http://192.168.110.57:8000',//http://139.224.253.23:8000
|
||||
API_PREFIX: '',
|
||||
// MQTT 配置
|
||||
MQTT_HOST: 'www.cnxhyc.com',
|
||||
|
||||
@ -362,6 +362,13 @@
|
||||
{
|
||||
"navigationBarTitleText" : "HBY018A"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "pages/6107/BJQ6107",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "BJQ6107"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
1622
pages/6107/BJQ6107.vue
Normal file
1622
pages/6107/BJQ6107.vue
Normal file
File diff suppressed because it is too large
Load Diff
@ -72,10 +72,10 @@
|
||||
@click="MainModeSetting('hight','staticBattery')">
|
||||
<view class="p100 center">高档</view>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- <view class="item " :class="formData.modeCurr=='close'?'active':''"
|
||||
@click="MainModeSetting('close','staticBattery')">
|
||||
<view class="p100 center">关闭</view>
|
||||
@ -343,6 +343,7 @@
|
||||
|
||||
|
||||
these.showBleUnConnect();
|
||||
console.error("111111");
|
||||
these.getDetail();
|
||||
return;
|
||||
}
|
||||
@ -356,13 +357,14 @@
|
||||
}
|
||||
these.formData.blename = f.name ? f.name : "Unname";
|
||||
these.formData.deviceName = device.deviceName;
|
||||
|
||||
|
||||
these.formData.bleStatu = false;
|
||||
these.formData.deviceId = f.deviceId;
|
||||
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
||||
these.formData.bleStatu = true;
|
||||
});
|
||||
these.setBleFormData();
|
||||
console.error("222222");
|
||||
these.getDetail();
|
||||
|
||||
|
||||
@ -574,7 +576,7 @@
|
||||
getDetail() {
|
||||
var that = this;
|
||||
usrApi.getDetail(this.device.id).then(res => {
|
||||
console.log("res=", res);
|
||||
console.log("获取人员信息=", res);
|
||||
if (res && res.code == 200) {
|
||||
res = res.data;
|
||||
let personnelInfo = res.personnelInfo;
|
||||
@ -583,8 +585,24 @@
|
||||
that.formData.name = personnelInfo.name;
|
||||
that.formData.job = personnelInfo.position;
|
||||
that.formData.id = personnelInfo.code
|
||||
return;
|
||||
}
|
||||
}
|
||||
let phone = uni.getStorageSync('phone');
|
||||
if (phone === '17671332251') {
|
||||
console.log("default=",that.device);
|
||||
that.formData.company = '湖北消防总队';
|
||||
that.formData.name = '胡红军';
|
||||
that.formData.job = '中队长';
|
||||
let arr=that.device.bluetoothName.split('-');
|
||||
if(arr.length>1){
|
||||
that.formData.id =arr[arr.length-1];
|
||||
}else{
|
||||
that.formData.id =that.device.bluetoothName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
},
|
||||
|
||||
@ -602,19 +620,19 @@
|
||||
},
|
||||
MainModeSetting: function(type, byteType) {
|
||||
if (this.formData.modeCurr == type) {
|
||||
type='close';
|
||||
type = 'close';
|
||||
}
|
||||
showLoading(this, {
|
||||
text: "请稍候..."
|
||||
});
|
||||
let task = () => {
|
||||
|
||||
|
||||
let dataValue = 0x00;
|
||||
let btype = 0x00;
|
||||
switch (type) {
|
||||
case "smalllow":
|
||||
dataValue = 0x68;
|
||||
break;
|
||||
break;
|
||||
case "low": //低档
|
||||
dataValue = 0x67;
|
||||
break;
|
||||
@ -1094,9 +1112,9 @@
|
||||
hideLoading(these);
|
||||
return;
|
||||
}
|
||||
console.log("baseURL=",baseURL);
|
||||
console.log("token",token);
|
||||
console.log("clientID",clientid);
|
||||
console.log("baseURL=", baseURL);
|
||||
console.log("token", token);
|
||||
console.log("clientID", clientid);
|
||||
uni.uploadFile({
|
||||
// url: 'http://114.55.111.217/video/upload',
|
||||
url: baseURL + "/app/video/upload",
|
||||
@ -1124,10 +1142,10 @@
|
||||
});
|
||||
|
||||
Promise.all([p1, p2]).then((arr) => {
|
||||
|
||||
|
||||
let res = arr[1];
|
||||
res = JSON.parse(res.data);
|
||||
|
||||
|
||||
if (res.data) {
|
||||
these.videoHexArray = res.data;
|
||||
updateLoading(these, {
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
var these = null;
|
||||
var eventChannel = null;
|
||||
var ble = null;
|
||||
|
||||
var inteval=null;
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@ -118,7 +118,7 @@
|
||||
|
||||
onUnload() {
|
||||
console.log("返回取消订阅");
|
||||
|
||||
clearInterval(inteval);
|
||||
ble.removeAllCallback(pagePath);
|
||||
},
|
||||
onLoad(option) {
|
||||
@ -226,7 +226,7 @@
|
||||
}
|
||||
})
|
||||
|
||||
let inteval = setInterval(this.initDevice, 10000);
|
||||
inteval = setInterval(this.initDevice, 10000);
|
||||
}
|
||||
|
||||
|
||||
@ -291,6 +291,7 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
clearInterval(inteval);
|
||||
} else {
|
||||
deviceInvalid();
|
||||
}
|
||||
|
||||
@ -120,6 +120,7 @@
|
||||
var ble = null;
|
||||
var these = null;
|
||||
var eventChannel = null;
|
||||
var searchTime=null;
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@ -334,7 +335,7 @@
|
||||
|
||||
//搜索到新设备的回调 (Always active)
|
||||
ble.addDeviceFound((arr) => {
|
||||
console.log("--- 收到原始扫描数据 ---", JSON.stringify(arr));
|
||||
// console.log("--- 收到原始扫描数据 ---", JSON.stringify(arr));
|
||||
if (these.Status.isPageHidden) {
|
||||
return;
|
||||
}
|
||||
@ -343,7 +344,7 @@
|
||||
}
|
||||
arr = arr.devices;
|
||||
|
||||
console.log(`本次扫描批次发现 ${arr.length} 个设备`);
|
||||
// console.log(`本次扫描批次发现 ${arr.length} 个设备`);
|
||||
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
let device = arr[i];
|
||||
@ -351,9 +352,9 @@
|
||||
|
||||
let f = these.EquipMents.find((v, index) => {
|
||||
if (v.deviceId == device.deviceId) {
|
||||
console.log(
|
||||
`更新设备信号: ${device.name || device.deviceId}, RSSI: ${device.RSSI}`
|
||||
);
|
||||
// console.log(
|
||||
// `更新设备信号: ${device.name || device.deviceId}, RSSI: ${device.RSSI}`
|
||||
// );
|
||||
these.$set(these.EquipMents[index], 'RSSI', device.RSSI);
|
||||
return true;
|
||||
}
|
||||
@ -361,7 +362,7 @@
|
||||
});
|
||||
|
||||
if (!f) {
|
||||
console.log("+++ 发现新设备,准备添加到列表:", JSON.stringify(device));
|
||||
// console.log("+++ 发现新设备,准备添加到列表:", JSON.stringify(device));
|
||||
|
||||
if (these.device && these.device.bluetoothName && device.name) {
|
||||
if (these.device.bluetoothName === device.name || (device.name && device.name
|
||||
@ -417,27 +418,29 @@
|
||||
|
||||
//收到设备的消息回调
|
||||
ble.addReceiveCallback((receivData, f, path, arr) => {
|
||||
console.log("000000");
|
||||
console.log("000000",receivData);
|
||||
if (these.Status.isPageHidden) {
|
||||
return;
|
||||
}
|
||||
console.log("1111111");
|
||||
if (f.macAddress && these.device) {
|
||||
console.log("222222");
|
||||
clearInterval(this.Status.intval);
|
||||
this.Status.intval = null;
|
||||
this.Status.time = null;
|
||||
if(receivData.str.indexOf('mac address:')>-1 || receivData.str.indexOf('sta_address')>-1
|
||||
|| (receivData.hexs[0]===0xFC && receivData.hexs.length>=7))
|
||||
{
|
||||
console.log("1111111");
|
||||
if (f.macAddress && these.device) {
|
||||
console.log("222222");
|
||||
clearInterval(this.Status.intval);
|
||||
this.Status.intval = null;
|
||||
this.Status.time = null;
|
||||
|
||||
showLoading(these, {
|
||||
text: '正在验证设备'
|
||||
});
|
||||
showLoading(these, {
|
||||
text: '正在验证设备'
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
these.DeviceVerdict(f.deviceId);
|
||||
}, 0);
|
||||
setTimeout(() => {
|
||||
these.DeviceVerdict(f.deviceId);
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}, pagePath);
|
||||
}
|
||||
}
|
||||
@ -452,7 +455,7 @@
|
||||
}
|
||||
|
||||
startValidDevice();
|
||||
these.refreshBleList();
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
@ -502,6 +505,8 @@
|
||||
});
|
||||
},
|
||||
async refreshBleList() {
|
||||
|
||||
|
||||
const systemInfo = uni.getSystemInfoSync();
|
||||
if (systemInfo.uniPlatform == 'web') {
|
||||
return;
|
||||
@ -520,37 +525,42 @@
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ble.StopSearch().finally(() => {
|
||||
|
||||
let disconnectPromises = [];
|
||||
if (ble.data && ble.data.LinkedList) {
|
||||
ble.data.LinkedList.forEach(device => {
|
||||
console.log(`Requesting disconnect for ${device.deviceId}`);
|
||||
disconnectPromises.push(ble.disconnectDevice(device.deviceId));
|
||||
});
|
||||
}
|
||||
|
||||
Promise.allSettled(disconnectPromises).finally(() => {
|
||||
|
||||
these.EquipMents = [];
|
||||
these.PairEquip = [];
|
||||
|
||||
ble.StartSearch().then(result => {
|
||||
console.log("Fresh scan started successfully.");
|
||||
}).catch(err => {
|
||||
console.error("Failed to start fresh scan:", err);
|
||||
if (err.code === 10001) {
|
||||
these.showOpenSetting();
|
||||
} else {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '开始搜索失败:' + err.msg
|
||||
});
|
||||
}
|
||||
clearTimeout(searchTime);
|
||||
searchTime=setTimeout(()=>{
|
||||
|
||||
ble.StopSearch().finally(() => {
|
||||
|
||||
let disconnectPromises = [];
|
||||
if (ble.data && ble.data.LinkedList) {
|
||||
ble.data.LinkedList.forEach(device => {
|
||||
console.log(`Requesting disconnect for ${device.deviceId}`);
|
||||
disconnectPromises.push(ble.disconnectDevice(device.deviceId));
|
||||
});
|
||||
}
|
||||
|
||||
Promise.allSettled(disconnectPromises).finally(() => {
|
||||
|
||||
these.EquipMents = [];
|
||||
these.PairEquip = [];
|
||||
|
||||
ble.StartSearch().then(result => {
|
||||
console.log("Fresh scan started successfully.");
|
||||
}).catch(err => {
|
||||
console.error("Failed to start fresh scan:", err);
|
||||
if (err.code === 10001) {
|
||||
these.showOpenSetting();
|
||||
} else {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '开始搜索失败:' + err.msg
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
},800);
|
||||
|
||||
},
|
||||
isItemLink: function(item, index) {
|
||||
let src = '/static/images/BLEAdd/noLink.png';
|
||||
@ -599,8 +609,6 @@
|
||||
if (index > -1) {
|
||||
this.PairEquip.splice(index, 1);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
console.log("f=", f);
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
<view class="vehicle-list" v-if="vehicles.length>0">
|
||||
<view v-for="(item, index) in vehicles" :key="index">
|
||||
<view class="vehicle-item" @click="alltypeInfo(item)">
|
||||
<image src="/static/images/common/bip.6.png" mode="" class="IMG"></image>
|
||||
<image :src="item.img" mode="aspectFit" class="IMG"></image>
|
||||
</view>
|
||||
<view class="plate-number">{{ item.typeName }}</view>
|
||||
</view>
|
||||
@ -25,13 +25,88 @@
|
||||
data() {
|
||||
return {
|
||||
vehicles: [],
|
||||
typeImgs: [{
|
||||
"Name": "HBY018A",
|
||||
"sigName": "018A",
|
||||
"url": "/static/images/common/018A.png"
|
||||
},
|
||||
{
|
||||
"Name": "HBY102",
|
||||
"sigName": "102",
|
||||
"url": "/static/images/common/HBY102.png"
|
||||
},
|
||||
{
|
||||
"Name": "BJQ6075",
|
||||
"sigName": "6075",
|
||||
"url": "/static/images/common/BJQ6075.png"
|
||||
},
|
||||
{
|
||||
"Name": "HBY100",
|
||||
"sigName": "100",
|
||||
"url": "/static/images/common/HBY100J.png"
|
||||
},
|
||||
{
|
||||
"Name": "BJQ4877",
|
||||
"sigName": "4877",
|
||||
"url": "/static/images/common/BJQ4877.png"
|
||||
},
|
||||
{
|
||||
"Name": "BJQ7307",
|
||||
"sigName": "7307",
|
||||
"url": "/static/images/common/7307.png"
|
||||
},
|
||||
{
|
||||
"Name": "BJQ7305",
|
||||
"sigName": "7305",
|
||||
"url": "/static/images/common/7305.png"
|
||||
},
|
||||
{
|
||||
"Name": "HBY650",
|
||||
"sigName": "650",
|
||||
"url": "/static/images/common/HBY650.png"
|
||||
},
|
||||
{
|
||||
"Name": "BJQ6155",
|
||||
"sigName": "6155",
|
||||
"url": "/static/images/common/HBY6155.png"
|
||||
},
|
||||
{
|
||||
"Name": "HBY670",
|
||||
"sigName": "670",
|
||||
"url": "/static/images/common/HBY670.png"
|
||||
},
|
||||
{
|
||||
"Name": "HBY210",
|
||||
"sigName": "210",
|
||||
"url": "/static/images/common/210.png"
|
||||
},
|
||||
{
|
||||
"Name": "BJQ6170",
|
||||
"sigName": "6170",
|
||||
"url": "/static/images/common/bip.6.png"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getTab() {
|
||||
deviceTypeList({}).then((res) => {
|
||||
if (res.code == 200) {
|
||||
this.vehicles = res.data
|
||||
for (var i = 0; i < res.data.length; i++) {
|
||||
var item = res.data[i];
|
||||
|
||||
item.img="/static/images/common/bip.6.png";
|
||||
let f=this.typeImgs.find(v=>{
|
||||
if(item.typeName.toLowerCase()===v.Name.toLowerCase()){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
if(f){
|
||||
item.img=f.url;
|
||||
}
|
||||
}
|
||||
this.vehicles = res.data;
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 9.7 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 522 B |
BIN
static/images/common/BJQ6075.png
Normal file
BIN
static/images/common/BJQ6075.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 33 KiB |
BIN
static/images/common/HBY210.png
Normal file
BIN
static/images/common/HBY210.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
Reference in New Issue
Block a user