1
0
forked from dyf/APP

完成6075J蓝牙对接

This commit is contained in:
liub
2026-03-30 13:17:47 +08:00
parent 4e518e7340
commit 37f5047a46
32 changed files with 472 additions and 281 deletions

View File

@ -530,7 +530,7 @@
ble.StartSearch().then(result => {
// console.log("开始搜索成功", result);
these.Status.BottomMenu.show=false;
}).catch(err => {
console.error("开始搜索失败:", err);
if (err.code === 10001) {
@ -582,6 +582,9 @@
ble.showBlueSetting(false);
},
DeviceVerdict(deviceId) { //判断是否是目标设备
if (these.Status.isPageHidden) {
return;
}
console.log("deviceid=", deviceId);
console.log("these.device=", these.device)
if (these.device) { //从设备详情过来的,回设备详情去
@ -618,6 +621,9 @@
}
//找到目标设备的处理方法
let deviceOK = () => {
if (these.Status.isPageHidden) {
return;
}
hideLoading(these);
eventChannel.emit('BindOver', these.device);
@ -779,6 +785,9 @@
execLink().then((res) => {
console.log("res=", res);
if(this.Status.isPageHidden){
return;
}
linkCallback(res);
}).catch(ex => {
console.error("ex=", ex)

View File

@ -24,7 +24,7 @@
<view class="scanPanel center">
<image @click.stop="scan" class="img" src="/static/images/common/scan.png" mode="aspectFit"></image>
</view>
<view class="txt">
<view class="txt" @click.stop="scan">
对准二维码进行扫描
</view>
@ -284,9 +284,10 @@
.btnOK {
color: rgba(255, 255, 255, 0.6);
font-family: 'PingFang SC';
font-size: 30rpx;
font-size: 40rpx;
font-weight: 400;
letter-spacing: 5rpx;
margin-top: 20rpx;
}
.btnOK.active {

View File

@ -363,7 +363,7 @@
}
//统一通信协议方法
let CommonSend = () => {
let json=JSON.stringify({ins_ShakeBit:1});
let json=JSON.stringify({ins_ShakeBit:isAlarming?1:0});
for (let i = 0; i < deviceImeiList.length; i++) {
let imei = deviceImeiList[i];
mq.sendData("B/"+imei,json,false);

View File

@ -18,13 +18,10 @@
<image src="/static/images/common/more.png" mode="aspectFit" class="more"></image>
</view>
</view>
<view class="sendFlex"
v-show="showSendFlex"
>
<view class="sendFlex" v-show="showSendFlex">
<view class="callpolice" @click="callpolice" v-show="showWarn">报警</view>
<view class="Sendmessage" @click="location" v-show="showMap">位置</view>
<view class="Sendmessage" @click="handleSend"
v-show="ShowSendmessage">发送信息</view>
<view class="Sendmessage" @click="handleSend" v-show="ShowSendmessage">发送信息</view>
</view>
<mescroll-uni class="device-list" @init="mescrollInit" @down="downCallback" @up="upCallback" :up="upOption"
@ -159,22 +156,22 @@
components: {
MescrollUni
},
computed:{
showSendFlex(){
computed: {
showSendFlex() {
// return this.activeTab && this.activeTab.id !== ''&& (this.activeTabInfo.communicationMode==0 || this.activeTabInfo.communicationMode==2);
if(this.showMap || this.ShowSendmessage || this.showWarn){
if (this.showMap || this.ShowSendmessage || this.showWarn) {
return true;
}
return false;
},
ShowSendmessage(){
return this.dic.showMsgTypes.indexOf(this.activeTabInfo.typeName)>-1
ShowSendmessage() {
return this.dic.showMsgTypes.indexOf(this.activeTabInfo.typeName) > -1
},
showMap(){
return this.dic.showMapTypes.indexOf(this.activeTabInfo.typeName)>-1
showMap() {
return this.dic.showMapTypes.indexOf(this.activeTabInfo.typeName) > -1
},
showWarn(){
return this.dic.showCallPolice.indexOf(this.activeTabInfo.typeName)>-1
showWarn() {
return this.dic.showCallPolice.indexOf(this.activeTabInfo.typeName) > -1
}
},
data() {
@ -254,10 +251,15 @@
deviceName: "", //重命名
activeTabInfo: '',
dic: {
showMsgTypes: ['BJQ6170', 'HBY210', 'HBY670', 'BJQ6075', 'BJQ6075J'],//需要发送消息的类型
showMapTypes:['BJQ6170','HBY210','HBY670','BJQ6075','HBY018A','HBY100-J','BJQ6075J','HBY008A','HBY100-Y'],//需要显示地图的类型
showCallPolice:['BJQ6170','HBY210','HBY670','BJQ6075','HBY018A','HBY100-J','BJQ6075J','HBY008A','HBY100-Y']//需要发送报警的类型
}
showMsgTypes: ['BJQ6170', 'HBY210', 'HBY670', 'BJQ6075', 'BJQ6075J'], //需要发送消息的类型
showMapTypes: ['BJQ6170', 'HBY210', 'HBY670', 'BJQ6075', 'HBY018A', 'HBY100-J', 'BJQ6075J', 'HBY008A',
'HBY100-Y'
], //需要显示地图的类型
showCallPolice: ['BJQ6170', 'HBY210', 'HBY670', 'BJQ6075', 'HBY018A', 'HBY100-J', 'BJQ6075J',
'HBY008A', 'HBY100-Y'
] //需要发送报警的类型
},
isPageShow: true
}
},
methods: {
@ -299,8 +301,11 @@
this.updateBleStatu();
},
bleStateRecovery() {
console.log("蓝牙适配器恢复可用,重连断开的设备");
ble.linkAllDevices();
if (this.isPageShow) {
console.log("蓝牙适配器恢复可用,重连断开的设备");
ble.linkAllDevices();
}
},
bleBreak(res) {
@ -738,8 +743,11 @@
.filter(Boolean);
},
},
onHide() {
this.isPageShow = false;
},
onShow() {
this.isPageShow = true;
if (ble) {
//因为vue视图只能后退不能隐藏后再显示
//所以回到首页后将其他所有页面的订阅都删除

View File

@ -77,6 +77,8 @@
import {
Logout
} from '@/api/common/login.js'
import bleTool from '@/utils/BleHelper.js';
var ble=null;
export default {
data() {
return {
@ -87,6 +89,7 @@
},
onLoad() {
var these=this;
ble=bleTool.getBleTool();
uni.getSystemInfo({
success(res) {
if(res.uniPlatform=='app'){
@ -139,7 +142,12 @@
uni.showToast({
title: '退出成功',
icon: 'success'
})
});
if(ble){
ble.StopSearch().catch(ex => {});
ble.disconnectDevice().catch(ex => {});
}
uni.reLaunch({
url: '/pages/common/login/index'
});