diff --git a/manifest.json b/manifest.json index 12cf937..282ed38 100644 --- a/manifest.json +++ b/manifest.json @@ -132,7 +132,7 @@ "quickapp" : {}, /* 小程序特有相关 */ "mp-weixin" : { - "appid" : "", + "appid" : "wxe16dcf57e925a6b5", "setting" : { "urlCheck" : false }, diff --git a/pages/100/HBY100.vue b/pages/100/HBY100.vue index ea5a481..56849d9 100644 --- a/pages/100/HBY100.vue +++ b/pages/100/HBY100.vue @@ -23,13 +23,14 @@ - - 蓝牙名称 - {{formData.blename}} - + 设备名称 - {{formData.deviceName}} + {{device.deviceName}} + + + 蓝牙名称 + {{device.bluetoothName}} 蓝牙状态 @@ -323,48 +324,39 @@ sta_LightFreq: '', sta_LightDimmer: '', sta_system: '' - }, dic: { - SOS: [{ - text: '声光报警', - val: 'sos', - img: '/static/images/4877/sg.png', - activeImg: '/static/images/4877/sgActive.png' - }, - { - text: '泛光照明', - val: 'fan', - img: '/static/images/4877/fan.png', - activeImg: '/static/images/4877/fanActive.png' - } - ], - gropus: [{ - text: '红配组', - val: 'red_group', - img: '/static/images/4877/light.png', - activeImg: '/static/images/4877/lightActive.png' - }, - { - text: '蓝配组', - val: 'blue_group', - img: '/static/images/4877/light.png', - activeImg: '/static/images/4877/lightActive.png' - }, - { - text: '绿配组', - val: 'green_group', - img: '/static/images/4877/light.png', - activeImg: '/static/images/4877/lightActive.png' - }, - { - text: '黄配组', - val: 'yellow_group', - img: '/static/images/4877/light.png', - activeImg: '/static/images/4877/lightActive.png' - } - - ] + sta_VoiceType: { + "0": '关闭', + "1": '消防', + "2": '公安', + "3": '交警', + "4": '市政', + "5": '应急', + "6": '医疗', + "7": '铁道', + "8": 'app语音', + }, + + sta_LightType: { + "0": '关闭', + "1": '红蓝闪', + "2": '红闪', + "3": '黄闪', + "4": '蓝闪', + "5": '红流水', + "6": '黄流水', + "7": '蓝流水' + }, + + + sta_system: { + "0": '关机', + "1": '仅充电', + "2": '开机未充电', + "3": '开机且充电' + } + }, device: { id: "", diff --git a/pages/210/deviceControl/index.vue b/pages/210/deviceControl/index.vue index 7db6436..80f02b9 100644 --- a/pages/210/deviceControl/index.vue +++ b/pages/210/deviceControl/index.vue @@ -240,7 +240,7 @@ - diff --git a/pages/4877/BJQ4877.vue b/pages/4877/BJQ4877.vue index 9dba199..8e37021 100644 --- a/pages/4877/BJQ4877.vue +++ b/pages/4877/BJQ4877.vue @@ -24,20 +24,20 @@ - 蓝牙名称 - {{formData.blename}} + 设备名称 + {{device.deviceName}} - 设备名称 - {{formData.deviceName}} - + 蓝牙名称 + {{device.bluetoothName}} + 蓝牙状态 {{formData.bleStatu?'已连接':'未连接'}} - 设备强制报警中! diff --git a/pages/6155/deviceDetail.vue b/pages/6155/deviceDetail.vue index e49632b..ecc5333 100644 --- a/pages/6155/deviceDetail.vue +++ b/pages/6155/deviceDetail.vue @@ -22,18 +22,19 @@ - - 蓝牙名称 - {{formData.blename}} - + 设备名称 - {{formData.deviceName}} + {{device.deviceName}} - 充电状态 + 设备状态 {{formData.statu}} + + 蓝牙名称 + {{device.bluetoothName}} + 蓝牙状态 {{formData.bleStatu?'已连接':'未连接'}} diff --git a/pages/6331/BJQ6331.vue b/pages/6331/BJQ6331.vue index 8a5fcc9..c5a3c0e 100644 --- a/pages/6331/BJQ6331.vue +++ b/pages/6331/BJQ6331.vue @@ -22,15 +22,15 @@ - + + 设备名称 + {{device.deviceName}} + 蓝牙名称 - {{formData.blename}} - - - 设备名称 - {{formData.deviceName}} + {{device.bluetoothName}} + 蓝牙状态 {{formData.bleStatu?'已连接':'未连接'}} diff --git a/pages/650/HBY650.vue b/pages/650/HBY650.vue index 641c8a3..9c495a7 100644 --- a/pages/650/HBY650.vue +++ b/pages/650/HBY650.vue @@ -24,11 +24,11 @@ 蓝牙名称 - {{formData.blename}} + {{device.bluetoothName}} 设备名称 - {{formData.deviceName}} + {{device.deviceName}} 蓝牙状态 @@ -40,14 +40,14 @@ - + 警告!环境存在漏电电源! - - - - - + + + + + diff --git a/pages/670/HBY670.vue b/pages/670/HBY670.vue index 120cf2c..64f81f7 100644 --- a/pages/670/HBY670.vue +++ b/pages/670/HBY670.vue @@ -33,6 +33,10 @@ 设备名称 {{device.deviceName}} + + 蓝牙名称 + {{device.bluetoothName}} + 蓝牙状态 {{formData.bleStatu?'已连接':'未连接'}} @@ -69,17 +73,17 @@ - + 警告!设备静止报警中! - - - - - + + + + + - 设备强制报警中! diff --git a/pages/7305/BJQ7305.vue b/pages/7305/BJQ7305.vue index b7d5d34..c571ca5 100644 --- a/pages/7305/BJQ7305.vue +++ b/pages/7305/BJQ7305.vue @@ -22,18 +22,20 @@ - - 蓝牙名称 - {{formData.blename}} - 设备名称 - {{formData.deviceName}} + {{device.deviceName}} - 充电状态 + 设备状态 {{formData.statu}} + + 蓝牙名称 + {{device.bluetoothName}} + + + 蓝牙状态 {{formData.bleStatu?'已连接':'未连接'}} diff --git a/pages/common/addBLE/LinkBle.vue b/pages/common/addBLE/LinkBle.vue index b3d95a3..2596e2b 100644 --- a/pages/common/addBLE/LinkBle.vue +++ b/pages/common/addBLE/LinkBle.vue @@ -20,7 +20,7 @@ 设备IMEI:{{device.imei}} - + {{Statu.boundRemark}} diff --git a/utils/BleHelper.js b/utils/BleHelper.js index 7a861bd..337f7b7 100644 --- a/utils/BleHelper.js +++ b/utils/BleHelper.js @@ -511,9 +511,11 @@ class BleHelper { uni.onBluetoothAdapterStateChange((state) => { // console.log('蓝牙状态发生变化:' + JSON.stringify(state)); + this.data.discovering = state.discovering; + if (this.data.available !== state.available) { this.data.available = state.available; - this.data.discovering = state.discovering; + if (this.data.available && this.data .isOpenBlue) { //蓝牙状态再次可用,重连所有设备 @@ -870,10 +872,7 @@ class BleHelper { return Promise.resolve(); } return new Promise((resolve, reject) => { - this.data.available = false; - this.data.discovering = false; - this.data.isOpenBlue = false; - this.data.searchList = []; + this.StopSearch(); @@ -882,15 +881,19 @@ class BleHelper { uni.closeBluetoothAdapter({ success: () => { // console.log("蓝牙模块已关闭"); - + this.data.available = false; + this.data.discovering = false; + this.data.isOpenBlue = false; + this.data.searchList = []; + resolve(); }, fail: (ex) => { console.error('无法关闭蓝牙模块:', ex); ex = this.getError(ex); - + reject(ex); }, complete: () => { - resolve(); + } }); @@ -963,7 +966,8 @@ class BleHelper { //停止搜索 StopSearch() { - if (this.data.platform == 'web') { + if (this.data.platform == 'web' || !this.data.discovering) { + console.error("web平台或当前没有搜索,直接返回"); return Promise.resolve(); } let p1 = new Promise((resolve, reject) => { @@ -1481,7 +1485,9 @@ class BleHelper { // 处理 MTU 设置 if (plus.os.name === 'Android') { - this.setMtu(deviceId); + this.setMtu(deviceId).catch(ex=>{ + console.error("mtu设置失败=",ex); + }); } resolve(true); @@ -1579,12 +1585,11 @@ class BleHelper { _succ(mtuRes); }, fail: (ex) => { - console.error( - "mtu设置失败", ex); + ex = this.getError(ex); _err( ex - ); // MTU设置失败不影响连接成功 + ); }, complete() { console.log("设置mtu完毕");