蓝牙设备均添加可主动断开蓝牙
This commit is contained in:
@ -57,9 +57,9 @@
|
|||||||
<text class="lbl">蓝牙名称</text>
|
<text class="lbl">蓝牙名称</text>
|
||||||
<text class="value">{{device.bluetoothName}}</text>
|
<text class="value">{{device.bluetoothName}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item" @click.top="bleStatuToggle">
|
||||||
<text class="lbl">蓝牙状态</text>
|
<text class="lbl">蓝牙状态</text>
|
||||||
<text class="value" :class="formData.bleStatu?'green':'red'">{{formData.bleStatu?'已连接':'未连接'}}</text>
|
<text class="value" :class="formData.bleStatu?'green':'red'">{{getbleStatu}}</text>
|
||||||
</view>
|
</view>
|
||||||
<!-- <view class="item">
|
<!-- <view class="item">
|
||||||
<text class="lbl">设备状态</text>
|
<text class="lbl">设备状态</text>
|
||||||
@ -572,8 +572,11 @@
|
|||||||
|
|
||||||
these.formData.bleStatu = false;
|
these.formData.bleStatu = false;
|
||||||
these.formData.deviceId = f.deviceId;
|
these.formData.deviceId = f.deviceId;
|
||||||
|
these.formData.bleStatu = 'connecting';
|
||||||
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
||||||
these.formData.bleStatu = true;
|
these.formData.bleStatu = true;
|
||||||
|
}).catch(ex=>{
|
||||||
|
these.formData.bleStatu = 'err';
|
||||||
});
|
});
|
||||||
these.setBleFormData();
|
these.setBleFormData();
|
||||||
|
|
||||||
@ -589,7 +592,21 @@
|
|||||||
this.Status.pageHide = false;
|
this.Status.pageHide = false;
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
getbleStatu(){
|
||||||
|
if(this.formData.bleStatu===true){
|
||||||
|
return '已连接';
|
||||||
|
}
|
||||||
|
if(this.formData.bleStatu==='connecting'){
|
||||||
|
return '连接中';
|
||||||
|
}
|
||||||
|
if(this.formData.bleStatu==='dicconnect'){
|
||||||
|
return '正在断开';
|
||||||
|
}
|
||||||
|
if(this.formData.bleStatu==='err'){
|
||||||
|
return '连接异常';
|
||||||
|
}
|
||||||
|
return '未连接';
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleRightClick(item, s) {
|
handleRightClick(item, s) {
|
||||||
@ -1212,12 +1229,14 @@
|
|||||||
showLoading(this, {
|
showLoading(this, {
|
||||||
text: "蓝牙恢复可用,正在连接设备"
|
text: "蓝牙恢复可用,正在连接设备"
|
||||||
});
|
});
|
||||||
|
these.formData.bleStatu='connecting';
|
||||||
ble.LinkBlue(these.formData.deviceId).then(() => {
|
ble.LinkBlue(these.formData.deviceId).then(() => {
|
||||||
these.formData.bleStatu = true;
|
these.formData.bleStatu = true;
|
||||||
updateLoading(these, {
|
updateLoading(these, {
|
||||||
text: '连接成功'
|
text: '连接成功'
|
||||||
});
|
});
|
||||||
}).catch(ex => {
|
}).catch(ex => {
|
||||||
|
these.formData.bleStatu='err';
|
||||||
updateLoading(these, {
|
updateLoading(these, {
|
||||||
text: ex.msg
|
text: ex.msg
|
||||||
})
|
})
|
||||||
@ -1304,6 +1323,33 @@
|
|||||||
|
|
||||||
return f;
|
return f;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
bleStatuToggle(){
|
||||||
|
let f=this.getDevice();
|
||||||
|
if(!f){
|
||||||
|
this.showBleUnConnect();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(this.formData.bleStatu===true){
|
||||||
|
this.formData.bleStatu='dicconnect';
|
||||||
|
ble.disconnectDevice(f.deviceId).finally(r=>{
|
||||||
|
this.formData.bleStatu=false;
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.formData.bleStatu===false || this.formData.bleStatu==='err'){
|
||||||
|
this.formData.bleStatu='connecting';
|
||||||
|
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
||||||
|
these.formData.bleStatu = true;
|
||||||
|
}).catch(ex=>{
|
||||||
|
these.formData.bleStatu = 'err';
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
setBleFormData() {
|
setBleFormData() {
|
||||||
|
|||||||
@ -58,9 +58,9 @@
|
|||||||
<text class="lbl">蓝牙名称</text>
|
<text class="lbl">蓝牙名称</text>
|
||||||
<text class="value">{{device.bluetoothName}}</text>
|
<text class="value">{{device.bluetoothName}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item" @click.top="bleStatuToggle">
|
||||||
<text class="lbl">蓝牙状态</text>
|
<text class="lbl">蓝牙状态</text>
|
||||||
<text class="value" :class="formData.bleStatu?'green':'red'">{{formData.bleStatu?'已连接':'未连接'}}</text>
|
<text class="value" :class="formData.bleStatu?'green':'red'">{{getbleStatu}}</text>
|
||||||
</view>
|
</view>
|
||||||
<!-- <view class="item">
|
<!-- <view class="item">
|
||||||
<text class="lbl">设备状态</text>
|
<text class="lbl">设备状态</text>
|
||||||
@ -147,7 +147,7 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
<view style="padding-bottom: 20rpx;">
|
<view style="padding-bottom: 20rpx;">
|
||||||
|
|
||||||
|
|
||||||
<view class="proinfo lamp">
|
<view class="proinfo lamp">
|
||||||
@ -489,8 +489,11 @@
|
|||||||
|
|
||||||
these.formData.bleStatu = false;
|
these.formData.bleStatu = false;
|
||||||
these.formData.deviceId = f.deviceId;
|
these.formData.deviceId = f.deviceId;
|
||||||
|
these.formData.bleStatu = 'connecting';
|
||||||
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
||||||
these.formData.bleStatu = true;
|
these.formData.bleStatu = true;
|
||||||
|
}).catch(ex => {
|
||||||
|
these.formData.bleStatu = 'err';
|
||||||
});
|
});
|
||||||
these.formData.sta_IntrusTime = 0;
|
these.formData.sta_IntrusTime = 0;
|
||||||
these.formData.sta_sosadd = "";
|
these.formData.sta_sosadd = "";
|
||||||
@ -530,10 +533,25 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
return active;
|
return active;
|
||||||
|
},
|
||||||
|
getbleStatu() {
|
||||||
|
if (this.formData.bleStatu === true) {
|
||||||
|
return '已连接';
|
||||||
|
}
|
||||||
|
if (this.formData.bleStatu === 'connecting') {
|
||||||
|
return '连接中';
|
||||||
|
}
|
||||||
|
if (this.formData.bleStatu === 'dicconnect') {
|
||||||
|
return '正在断开';
|
||||||
|
}
|
||||||
|
if (this.formData.bleStatu === 'err') {
|
||||||
|
return '连接异常';
|
||||||
|
}
|
||||||
|
return '未连接';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getLinkedCnt() {//获取在线设备的数量
|
getLinkedCnt() { //获取在线设备的数量
|
||||||
|
|
||||||
let f = this.getDevice();
|
let f = this.getDevice();
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
@ -552,11 +570,11 @@
|
|||||||
let buffer = {
|
let buffer = {
|
||||||
ins_Quantity: "query"
|
ins_Quantity: "query"
|
||||||
};
|
};
|
||||||
ble.sendString(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId, 30).then(res=>{
|
ble.sendString(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId, 30).then(res => {
|
||||||
setTimeout(()=>{
|
setTimeout(() => {
|
||||||
this.getWarns();
|
this.getWarns();
|
||||||
},1500);
|
}, 1500);
|
||||||
}).catch(()=>{
|
}).catch(() => {
|
||||||
this.getWarns();
|
this.getWarns();
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -591,12 +609,12 @@
|
|||||||
uni.getStorage({
|
uni.getStorage({
|
||||||
key: linkKey,
|
key: linkKey,
|
||||||
success(res) {
|
success(res) {
|
||||||
console.error("获取到联机数据",res);
|
console.error("获取到联机数据", res);
|
||||||
let data = res.data;
|
let data = res.data;
|
||||||
let fs = data.filter(v => {
|
let fs = data.filter(v => {
|
||||||
return !v.read
|
return !v.read
|
||||||
});
|
});
|
||||||
console.error("未读联机数据",fs);
|
console.error("未读联机数据", fs);
|
||||||
succ(fs);
|
succ(fs);
|
||||||
},
|
},
|
||||||
fail(ex) {
|
fail(ex) {
|
||||||
@ -609,12 +627,12 @@
|
|||||||
let fs = [];
|
let fs = [];
|
||||||
|
|
||||||
if (results[0].status == 'fulfilled') {
|
if (results[0].status == 'fulfilled') {
|
||||||
fs=fs.concat(results[0].value);
|
fs = fs.concat(results[0].value);
|
||||||
}
|
}
|
||||||
if (results[1].status == 'fulfilled') {
|
if (results[1].status == 'fulfilled') {
|
||||||
fs=fs.concat(results[1].value);
|
fs = fs.concat(results[1].value);
|
||||||
}
|
}
|
||||||
console.error("获取到未读消息",fs);
|
console.error("获取到未读消息", fs);
|
||||||
these.$set(these.Status.navbar.icons[0], "math", fs.length);
|
these.$set(these.Status.navbar.icons[0], "math", fs.length);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -994,12 +1012,14 @@ console.error("获取到未读消息",fs);
|
|||||||
showLoading(this, {
|
showLoading(this, {
|
||||||
text: "蓝牙恢复可用,正在连接设备"
|
text: "蓝牙恢复可用,正在连接设备"
|
||||||
});
|
});
|
||||||
|
this.formData.bleStatu = 'connecting';
|
||||||
ble.LinkBlue(these.formData.deviceId).then(() => {
|
ble.LinkBlue(these.formData.deviceId).then(() => {
|
||||||
these.formData.bleStatu = true;
|
these.formData.bleStatu = true;
|
||||||
updateLoading(these, {
|
updateLoading(these, {
|
||||||
text: '连接成功'
|
text: '连接成功'
|
||||||
});
|
});
|
||||||
}).catch(ex => {
|
}).catch(ex => {
|
||||||
|
these.formData.bleStatu = 'err';
|
||||||
updateLoading(these, {
|
updateLoading(these, {
|
||||||
text: ex.msg
|
text: ex.msg
|
||||||
})
|
})
|
||||||
@ -1031,9 +1051,9 @@ console.error("获取到未读消息",fs);
|
|||||||
let json = recei.ReceiveData(receive, device, pagePath, recArr);
|
let json = recei.ReceiveData(receive, device, pagePath, recArr);
|
||||||
|
|
||||||
console.log("json=", json)
|
console.log("json=", json)
|
||||||
setTimeout(()=>{
|
setTimeout(() => {
|
||||||
this.getWarns();
|
this.getWarns();
|
||||||
},500);
|
}, 500);
|
||||||
|
|
||||||
|
|
||||||
let active = -1;
|
let active = -1;
|
||||||
@ -1216,6 +1236,32 @@ console.error("获取到未读消息",fs);
|
|||||||
return f;
|
return f;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
bleStatuToggle() {
|
||||||
|
let f = this.getDevice();
|
||||||
|
if (!f) {
|
||||||
|
this.showBleUnConnect();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (this.formData.bleStatu === true) {
|
||||||
|
this.formData.bleStatu = 'dicconnect';
|
||||||
|
ble.disconnectDevice(f.deviceId).finally(r => {
|
||||||
|
this.formData.bleStatu = false;
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.formData.bleStatu === false || this.formData.bleStatu === 'err') {
|
||||||
|
this.formData.bleStatu = 'connecting';
|
||||||
|
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
||||||
|
these.formData.bleStatu = true;
|
||||||
|
}).catch(ex => {
|
||||||
|
these.formData.bleStatu = 'err';
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
setBleFormData() {
|
setBleFormData() {
|
||||||
ble.data.LinkedList.find((v) => {
|
ble.data.LinkedList.find((v) => {
|
||||||
|
|||||||
@ -14,11 +14,11 @@
|
|||||||
<image class="img" :src="item.src" mode="aspectFit"></image>
|
<image class="img" :src="item.src" mode="aspectFit"></image>
|
||||||
<view class="baber" v-if="item.math">{{item.math>9?'9+':item.math}}</view>
|
<view class="baber" v-if="item.math">{{item.math>9?'9+':item.math}}</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</uni-nav-bar>
|
</uni-nav-bar>
|
||||||
<view class="eq">
|
<view class="eq">
|
||||||
<view class="leftImg" @click.stop="previewImg(device.devicePic?device.devicePic:formData.img)">
|
<view class="leftImg" @click.stop="previewImg(device.devicePic?device.devicePic:formData.img)">
|
||||||
@ -54,9 +54,9 @@
|
|||||||
<text class="lbl">蓝牙名称</text>
|
<text class="lbl">蓝牙名称</text>
|
||||||
<text class="value">{{device.bluetoothName}}</text>
|
<text class="value">{{device.bluetoothName}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item" @click.top="bleStatuToggle">
|
||||||
<text class="lbl">蓝牙状态</text>
|
<text class="lbl">蓝牙状态</text>
|
||||||
<text class="value" :class="formData.bleStatu?'green':'red'">{{formData.bleStatu?'已连接':'未连接'}}</text>
|
<text class="value" :class="formData.bleStatu?'green':'red'">{{getbleStatu}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<text class="lbl">信道:{{formData.sta_Channel}}</text>
|
<text class="lbl">信道:{{formData.sta_Channel}}</text>
|
||||||
@ -175,15 +175,15 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="text">朝右</view>
|
<view class="text">朝右</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
<view class="line"></view>
|
<view class="line"></view>
|
||||||
|
|
||||||
<view class="modeSetting">
|
<view class="modeSetting">
|
||||||
|
|
||||||
<view class="arrow" @click.stop="ArrowSet('red_front')"
|
<view class="arrow" @click.stop="ArrowSet('red_front')"
|
||||||
:class="formData.sta_ArrowType=='red_front'?'redactive':''">
|
:class="formData.sta_ArrowType=='red_front'?'redactive':''">
|
||||||
<view class="outCircle">
|
<view class="outCircle">
|
||||||
@ -191,7 +191,7 @@
|
|||||||
<view class="text">红色</view>
|
<view class="text">红色</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
<view class="arrow" @click.stop="ArrowSet('green_back')"
|
<view class="arrow" @click.stop="ArrowSet('green_back')"
|
||||||
:class="formData.sta_ArrowType=='green_back'?'greenactive':''">
|
:class="formData.sta_ArrowType=='green_back'?'greenactive':''">
|
||||||
@ -200,10 +200,10 @@
|
|||||||
<view class="text">绿色</view>
|
<view class="text">绿色</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="lamp noPadding">
|
<view class="lamp noPadding">
|
||||||
@ -295,7 +295,9 @@
|
|||||||
hideLoading,
|
hideLoading,
|
||||||
updateLoading
|
updateLoading
|
||||||
} from '@/utils/loading.js'
|
} from '@/utils/loading.js'
|
||||||
import request, { baseURL } from '@/utils/request.js';
|
import request, {
|
||||||
|
baseURL
|
||||||
|
} from '@/utils/request.js';
|
||||||
import Common from '@/utils/Common.js';
|
import Common from '@/utils/Common.js';
|
||||||
import {
|
import {
|
||||||
colors as groupColors
|
colors as groupColors
|
||||||
@ -323,7 +325,7 @@ import request, { baseURL } from '@/utils/request.js';
|
|||||||
apiType: 'listA'
|
apiType: 'listA'
|
||||||
}],
|
}],
|
||||||
title: 'BJQ4877'
|
title: 'BJQ4877'
|
||||||
|
|
||||||
},
|
},
|
||||||
ShowEditChannel: false,
|
ShowEditChannel: false,
|
||||||
pageHide: false,
|
pageHide: false,
|
||||||
@ -403,9 +405,9 @@ import request, { baseURL } from '@/utils/request.js';
|
|||||||
sta_ArrowType: '', //箭头方向
|
sta_ArrowType: '', //箭头方向
|
||||||
warnTime: 0,
|
warnTime: 0,
|
||||||
sta_Channel: 31,
|
sta_Channel: 31,
|
||||||
sta_ArrowMode:'',
|
sta_ArrowMode: '',
|
||||||
groups: [
|
groups: [
|
||||||
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
dic: {
|
dic: {
|
||||||
@ -422,7 +424,7 @@ import request, { baseURL } from '@/utils/request.js';
|
|||||||
activeImg: '/static/images/4877/fanActive.png'
|
activeImg: '/static/images/4877/fanActive.png'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
},
|
},
|
||||||
device: {
|
device: {
|
||||||
id: "",
|
id: "",
|
||||||
@ -480,7 +482,7 @@ import request, { baseURL } from '@/utils/request.js';
|
|||||||
// console.log("收到父页面的参数:" + JSON.stringify(data));
|
// console.log("收到父页面的参数:" + JSON.stringify(data));
|
||||||
let device = data.data;
|
let device = data.data;
|
||||||
these.device = device;
|
these.device = device;
|
||||||
|
|
||||||
these.Status.apiType = data.apiType;
|
these.Status.apiType = data.apiType;
|
||||||
these.Status.navbar.title = device.deviceName;
|
these.Status.navbar.title = device.deviceName;
|
||||||
if (data.apiType !== 'listA') {
|
if (data.apiType !== 'listA') {
|
||||||
@ -492,7 +494,7 @@ import request, { baseURL } from '@/utils/request.js';
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
let checkIds = uni.getStorageSync("4877CheckColor_" + data.data.id);
|
let checkIds = uni.getStorageSync("4877CheckColor_" + data.data.id);
|
||||||
if (checkIds && checkIds.length) {
|
if (checkIds && checkIds.length) {
|
||||||
let groups = groupColors.filter(v => {
|
let groups = groupColors.filter(v => {
|
||||||
@ -508,7 +510,7 @@ import request, { baseURL } from '@/utils/request.js';
|
|||||||
these.formData.groups = groups;
|
these.formData.groups = groups;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
let arr = [{
|
let arr = [{
|
||||||
topic: 'C/4877_Groups_' + these.device.id,
|
topic: 'C/4877_Groups_' + these.device.id,
|
||||||
@ -556,6 +558,7 @@ import request, { baseURL } from '@/utils/request.js';
|
|||||||
these.formData.deviceId = f.deviceId;
|
these.formData.deviceId = f.deviceId;
|
||||||
these.formData.warnTime = null;
|
these.formData.warnTime = null;
|
||||||
these.formData.sta_SOSType = 'sos_off';
|
these.formData.sta_SOSType = 'sos_off';
|
||||||
|
these.formData.bleStatu = 'connecting';
|
||||||
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
||||||
these.formData.bleStatu = true;
|
these.formData.bleStatu = true;
|
||||||
});
|
});
|
||||||
@ -573,9 +576,50 @@ import request, { baseURL } from '@/utils/request.js';
|
|||||||
this.Status.pageHide = false;
|
this.Status.pageHide = false;
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
getbleStatu() {
|
||||||
|
if (this.formData.bleStatu === true) {
|
||||||
|
return '已连接';
|
||||||
|
}
|
||||||
|
if (this.formData.bleStatu === 'connecting') {
|
||||||
|
return '连接中';
|
||||||
|
}
|
||||||
|
if (this.formData.bleStatu === 'dicconnect') {
|
||||||
|
return '正在断开';
|
||||||
|
}
|
||||||
|
if (this.formData.bleStatu === 'err') {
|
||||||
|
return '连接异常';
|
||||||
|
}
|
||||||
|
return '未连接';
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
|
bleStatuToggle() {
|
||||||
|
let f = this.getDevice();
|
||||||
|
if (!f) {
|
||||||
|
this.showBleUnConnect();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (this.formData.bleStatu === true) {
|
||||||
|
this.formData.bleStatu = 'dicconnect';
|
||||||
|
ble.disconnectDevice(f.deviceId).finally(r => {
|
||||||
|
this.formData.bleStatu = false;
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.formData.bleStatu === false || this.formData.bleStatu === 'err') {
|
||||||
|
these.formData.bleStatu = 'connecting';
|
||||||
|
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
||||||
|
these.formData.bleStatu = true;
|
||||||
|
}).catch(ex => {
|
||||||
|
these.formData.bleStatu = 'err';
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
handleRightClick(item, s) {
|
handleRightClick(item, s) {
|
||||||
if (item && item.callback) {
|
if (item && item.callback) {
|
||||||
item.callback(item, s);
|
item.callback(item, s);
|
||||||
@ -583,7 +627,7 @@ import request, { baseURL } from '@/utils/request.js';
|
|||||||
uni.showModal({
|
uni.showModal({
|
||||||
content: '敬请期待'
|
content: '敬请期待'
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
navigatorBack() {
|
navigatorBack() {
|
||||||
@ -612,11 +656,11 @@ import request, { baseURL } from '@/utils/request.js';
|
|||||||
|
|
||||||
let str = rec.receive.payloadString;
|
let str = rec.receive.payloadString;
|
||||||
let json = JSON.parse(str);
|
let json = JSON.parse(str);
|
||||||
if('ins_channel' in json){
|
if ('ins_channel' in json) {
|
||||||
this.formData.sta_Channel=json.ins_channel;
|
this.formData.sta_Channel = json.ins_channel;
|
||||||
these.setBleFormData();
|
these.setBleFormData();
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -636,8 +680,8 @@ import request, { baseURL } from '@/utils/request.js';
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
these.formData.groups = groups;
|
these.formData.groups = groups;
|
||||||
console.error("groups=",these.formData.groups);
|
console.error("groups=", these.formData.groups);
|
||||||
let checks = groups.map(item => {
|
let checks = groups.map(item => {
|
||||||
return item.id
|
return item.id
|
||||||
});
|
});
|
||||||
@ -655,9 +699,9 @@ import request, { baseURL } from '@/utils/request.js';
|
|||||||
|
|
||||||
},
|
},
|
||||||
ShowChannelEdit() {
|
ShowChannelEdit() {
|
||||||
|
|
||||||
if (!this.permissions.includes('55') && this.Status.apiType !== 'listA') {
|
if (!this.permissions.includes('55') && this.Status.apiType !== 'listA') {
|
||||||
|
|
||||||
this.showPop({
|
this.showPop({
|
||||||
message: '无操作权限',
|
message: '无操作权限',
|
||||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||||
@ -668,7 +712,7 @@ import request, { baseURL } from '@/utils/request.js';
|
|||||||
})
|
})
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.Status.ShowEditChannel = true;
|
this.Status.ShowEditChannel = true;
|
||||||
this.showPop({
|
this.showPop({
|
||||||
showPop: true, //是否显示弹窗
|
showPop: true, //是否显示弹窗
|
||||||
@ -736,9 +780,9 @@ import request, { baseURL } from '@/utils/request.js';
|
|||||||
|
|
||||||
},
|
},
|
||||||
ArrowModeSet(val) {
|
ArrowModeSet(val) {
|
||||||
|
|
||||||
if (!this.permissions.includes('53') && this.Status.apiType !== 'listA') {
|
if (!this.permissions.includes('53') && this.Status.apiType !== 'listA') {
|
||||||
|
|
||||||
this.showPop({
|
this.showPop({
|
||||||
message: '无操作权限',
|
message: '无操作权限',
|
||||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||||
@ -749,12 +793,12 @@ import request, { baseURL } from '@/utils/request.js';
|
|||||||
})
|
})
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.formData.sta_SOSType === 'sos') {
|
if (this.formData.sta_SOSType === 'sos') {
|
||||||
this.showMsg("设备强制报警中,请先关闭报警")
|
this.showMsg("设备强制报警中,请先关闭报警")
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let f = this.getDevice();
|
let f = this.getDevice();
|
||||||
if (!f) {
|
if (!f) {
|
||||||
this.showBleUnConnect();
|
this.showBleUnConnect();
|
||||||
@ -763,7 +807,7 @@ import request, { baseURL } from '@/utils/request.js';
|
|||||||
if (this.formData.sta_ArrowMode === val) {
|
if (this.formData.sta_ArrowMode === val) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var json = {
|
var json = {
|
||||||
ins_right_side: val
|
ins_right_side: val
|
||||||
}
|
}
|
||||||
@ -800,8 +844,8 @@ import request, { baseURL } from '@/utils/request.js';
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
groupCheck() {
|
groupCheck() {
|
||||||
if (!this.permissions.includes('54') && this.Status.apiType !== 'listA') {
|
if (!this.permissions.includes('54') && this.Status.apiType !== 'listA') {
|
||||||
|
|
||||||
this.showPop({
|
this.showPop({
|
||||||
message: '无操作权限',
|
message: '无操作权限',
|
||||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||||
@ -882,9 +926,9 @@ if (!this.permissions.includes('54') && this.Status.apiType !== 'listA') {
|
|||||||
// });
|
// });
|
||||||
},
|
},
|
||||||
groupSetting(item, index) {
|
groupSetting(item, index) {
|
||||||
|
|
||||||
if (!this.permissions.includes('54') && this.Status.apiType !== 'listA') {
|
if (!this.permissions.includes('54') && this.Status.apiType !== 'listA') {
|
||||||
|
|
||||||
this.showPop({
|
this.showPop({
|
||||||
message: '无操作权限',
|
message: '无操作权限',
|
||||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||||
@ -895,7 +939,7 @@ if (!this.permissions.includes('54') && this.Status.apiType !== 'listA') {
|
|||||||
})
|
})
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.formData.sta_SOSType === 'sos') {
|
if (this.formData.sta_SOSType === 'sos') {
|
||||||
this.showMsg("设备强制报警中,请先关闭报警")
|
this.showMsg("设备强制报警中,请先关闭报警")
|
||||||
return;
|
return;
|
||||||
@ -942,8 +986,8 @@ if (!this.permissions.includes('54') && this.Status.apiType !== 'listA') {
|
|||||||
},
|
},
|
||||||
|
|
||||||
sosSetting(item, index) {
|
sosSetting(item, index) {
|
||||||
if (!this.permissions.includes('42') && this.Status.apiType !== 'listA') {
|
if (!this.permissions.includes('42') && this.Status.apiType !== 'listA') {
|
||||||
|
|
||||||
this.showPop({
|
this.showPop({
|
||||||
message: '无操作权限',
|
message: '无操作权限',
|
||||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||||
@ -1076,6 +1120,7 @@ if (!this.permissions.includes('42') && this.Status.apiType !== 'listA') {
|
|||||||
showLoading(this, {
|
showLoading(this, {
|
||||||
text: "蓝牙恢复可用,正在连接设备"
|
text: "蓝牙恢复可用,正在连接设备"
|
||||||
});
|
});
|
||||||
|
these.formData.bleStatu = 'connecting';
|
||||||
ble.LinkBlue(these.formData.deviceId).then(() => {
|
ble.LinkBlue(these.formData.deviceId).then(() => {
|
||||||
these.formData.bleStatu = true;
|
these.formData.bleStatu = true;
|
||||||
updateLoading(these, {
|
updateLoading(these, {
|
||||||
@ -1822,22 +1867,23 @@ if (!this.permissions.includes('42') && this.Status.apiType !== 'listA') {
|
|||||||
letter-spacing: 0.14rpx;
|
letter-spacing: 0.14rpx;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.modeSetting .arrow .outCircle .text {
|
.modeSetting .arrow .outCircle .text {
|
||||||
margin-top:0rpx !important;
|
margin-top: 0rpx !important;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.arrowContent .line {
|
.arrowContent .line {
|
||||||
width:calc(100% - 60rpx);
|
width: calc(100% - 60rpx);
|
||||||
|
|
||||||
height: 0rpx;
|
height: 0rpx;
|
||||||
border-bottom:1px solid #ffffff30;
|
border-bottom: 1px solid #ffffff30;
|
||||||
margin: 30rpx ;
|
margin: 30rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modeSetting .arrow .outCircle {
|
.modeSetting .arrow .outCircle {
|
||||||
width: 120rpx;
|
width: 120rpx;
|
||||||
height: 120rpx;
|
height: 120rpx;
|
||||||
@ -1881,33 +1927,33 @@ if (!this.permissions.includes('42') && this.Status.apiType !== 'listA') {
|
|||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.modeSetting .arrow.redactive .outCircle {
|
.modeSetting .arrow.redactive .outCircle {
|
||||||
border: 4rpx solid #EC2A2A;
|
border: 4rpx solid #EC2A2A;
|
||||||
padding: 4rpx;
|
padding: 4rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modeSetting .arrow.redactive .item {
|
.modeSetting .arrow.redactive .item {
|
||||||
background: #EC2A2A;
|
background: #EC2A2A;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.modeSetting .arrow.greenactive .outCircle {
|
.modeSetting .arrow.greenactive .outCircle {
|
||||||
border: 4rpx solid #00BD00;
|
border: 4rpx solid #00BD00;
|
||||||
padding: 4rpx;
|
padding: 4rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modeSetting .arrow.greenactive .item {
|
.modeSetting .arrow.greenactive .item {
|
||||||
background: #00BD00;
|
background: #00BD00;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.modeSetting .arrow.redactive .item .text,
|
.modeSetting .arrow.redactive .item .text,
|
||||||
.modeSetting .arrow.greenactive .item .text{
|
.modeSetting .arrow.greenactive .item .text {
|
||||||
color:#FFFFFFde !important;
|
color: #FFFFFFde !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2202,29 +2248,29 @@ if (!this.permissions.includes('42') && this.Status.apiType !== 'listA') {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.navbarRight {
|
.navbarRight {
|
||||||
width: 40px;
|
width: 40px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.navbarRight .imgContent {
|
.navbarRight .imgContent {
|
||||||
width: 36rpx;
|
width: 36rpx;
|
||||||
height: 36rpx;
|
height: 36rpx;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.navbarRight .imgContent:first-child {
|
.navbarRight .imgContent:first-child {
|
||||||
|
|
||||||
width: 38rpx !important;
|
width: 38rpx !important;
|
||||||
height: 38rpx !important;
|
height: 38rpx !important;
|
||||||
margin-top: -2rpx;
|
margin-top: -2rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.navbarRight .imgContent .baber {
|
.navbarRight .imgContent .baber {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
@ -2240,33 +2286,33 @@ if (!this.permissions.includes('42') && this.Status.apiType !== 'listA') {
|
|||||||
font-style: Regular;
|
font-style: Regular;
|
||||||
font-size: 20rpx;
|
font-size: 20rpx;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.navbarRight .imgContent .img {
|
.navbarRight .imgContent .img {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.navbarRight .imgContent .img:last-child {
|
.navbarRight .imgContent .img:last-child {
|
||||||
padding: 1rpx;
|
padding: 1rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nvbar {
|
.nvbar {
|
||||||
top: 0px;
|
top: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/deep/ .uni-navbar--fixed {
|
/deep/ .uni-navbar--fixed {
|
||||||
top: 0px;
|
top: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uninavebartext {
|
.uninavebartext {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
|
|||||||
@ -9,8 +9,8 @@
|
|||||||
</view>
|
</view>
|
||||||
<view slot="right">
|
<view slot="right">
|
||||||
<view class="navbarRight center">
|
<view class="navbarRight center">
|
||||||
<view class="imgContent" :class="{'visibilityHidden':Status.apiType!=item.apiType}" @click.stop="handleRightClick(item,index)"
|
<view class="imgContent" :class="{'visibilityHidden':Status.apiType!=item.apiType}"
|
||||||
v-for="item,index in Status.navbar.icons">
|
@click.stop="handleRightClick(item,index)" v-for="item,index in Status.navbar.icons">
|
||||||
<image class="img" :src="item.src" mode="aspectFit"></image>
|
<image class="img" :src="item.src" mode="aspectFit"></image>
|
||||||
<view class="baber" v-if="item.math">{{item.math>9?'9+':item.math}}</view>
|
<view class="baber" v-if="item.math">{{item.math>9?'9+':item.math}}</view>
|
||||||
</view>
|
</view>
|
||||||
@ -61,9 +61,9 @@
|
|||||||
<text class="lbl">蓝牙名称</text>
|
<text class="lbl">蓝牙名称</text>
|
||||||
<text class="value">{{device.bluetoothName}}</text>
|
<text class="value">{{device.bluetoothName}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item" @click.top="bleStatuToggle">
|
||||||
<text class="lbl">蓝牙状态</text>
|
<text class="lbl">蓝牙状态</text>
|
||||||
<text class="value" :class="formData.bleStatu?'green':'red'">{{formData.bleStatu?'已连接':'未连接'}}</text>
|
<text class="value" :class="formData.bleStatu?'green':'red'">{{getbleStatu}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="lamp">
|
<view class="lamp">
|
||||||
@ -219,7 +219,7 @@
|
|||||||
icons: [{
|
icons: [{
|
||||||
src: '/static/images/common/shape.png',
|
src: '/static/images/common/shape.png',
|
||||||
callback: this.gotoShare,
|
callback: this.gotoShare,
|
||||||
apiType:'listA'
|
apiType: 'listA'
|
||||||
}],
|
}],
|
||||||
title: 'BJQ6155'
|
title: 'BJQ6155'
|
||||||
|
|
||||||
@ -373,7 +373,7 @@
|
|||||||
let device = data.data;
|
let device = data.data;
|
||||||
these.device = device;
|
these.device = device;
|
||||||
these.Status.apiType = data.apiType;
|
these.Status.apiType = data.apiType;
|
||||||
these.Status.navbar.title=device.deviceName;
|
these.Status.navbar.title = device.deviceName;
|
||||||
if (data.apiType !== 'listA') {
|
if (data.apiType !== 'listA') {
|
||||||
Common.getdeviceShareId(data.data.id).then(res => {
|
Common.getdeviceShareId(data.data.id).then(res => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
@ -410,7 +410,7 @@
|
|||||||
|
|
||||||
these.formData.id = device.id;
|
these.formData.id = device.id;
|
||||||
these.formData.deviceId = f.deviceId;
|
these.formData.deviceId = f.deviceId;
|
||||||
these.formData.bleStatu = false;
|
these.formData.bleStatu = 'connecting';
|
||||||
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
||||||
these.formData.bleStatu = true;
|
these.formData.bleStatu = true;
|
||||||
});
|
});
|
||||||
@ -433,12 +433,50 @@
|
|||||||
|
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
cModeItems: function() {
|
getbleStatu() {
|
||||||
|
if (this.formData.bleStatu === true) {
|
||||||
|
return '已连接';
|
||||||
|
}
|
||||||
|
if (this.formData.bleStatu === 'connecting') {
|
||||||
|
return '连接中';
|
||||||
|
}
|
||||||
|
if (this.formData.bleStatu === 'dicconnect') {
|
||||||
|
return '正在断开';
|
||||||
|
}
|
||||||
|
if (this.formData.bleStatu === 'err') {
|
||||||
|
return '连接异常';
|
||||||
|
}
|
||||||
|
return '未连接';
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
bleStatuToggle() {
|
||||||
|
let f = this.getDevice();
|
||||||
|
if (!f) {
|
||||||
|
this.showBleUnConnect();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (this.formData.bleStatu === true) {
|
||||||
|
this.formData.bleStatu = 'dicconnect';
|
||||||
|
ble.disconnectDevice(f.deviceId).finally(r => {
|
||||||
|
this.formData.bleStatu = false;
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.formData.bleStatu === false || this.formData.bleStatu === 'err') {
|
||||||
|
these.formData.bleStatu = 'connecting';
|
||||||
|
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
||||||
|
these.formData.bleStatu = true;
|
||||||
|
}).catch(ex => {
|
||||||
|
these.formData.bleStatu = 'err';
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
handleRightClick(item, s) {
|
handleRightClick(item, s) {
|
||||||
if (item && item.callback) {
|
if (item && item.callback) {
|
||||||
item.callback(item, s);
|
item.callback(item, s);
|
||||||
@ -580,6 +618,7 @@
|
|||||||
showLoading(this, {
|
showLoading(this, {
|
||||||
text: "蓝牙恢复可用,正在连接设备"
|
text: "蓝牙恢复可用,正在连接设备"
|
||||||
});
|
});
|
||||||
|
these.formData.bleStatu = 'connecting';
|
||||||
ble.LinkBlue(these.formData.deviceId).then(() => {
|
ble.LinkBlue(these.formData.deviceId).then(() => {
|
||||||
these.formData.bleStatu = true;
|
these.formData.bleStatu = true;
|
||||||
updateLoading(these, {
|
updateLoading(these, {
|
||||||
@ -1745,7 +1784,7 @@
|
|||||||
|
|
||||||
},
|
},
|
||||||
sliderChange: function(evt) {
|
sliderChange: function(evt) {
|
||||||
|
|
||||||
if (!this.permissions.includes('1') && this.Status.apiType !== 'listA') {
|
if (!this.permissions.includes('1') && this.Status.apiType !== 'listA') {
|
||||||
|
|
||||||
this.showPop({
|
this.showPop({
|
||||||
|
|||||||
@ -62,9 +62,9 @@
|
|||||||
<text class="lbl">蓝牙名称</text>
|
<text class="lbl">蓝牙名称</text>
|
||||||
<text class="value">{{device.bluetoothName}}</text>
|
<text class="value">{{device.bluetoothName}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item" @click.top="bleStatuToggle">
|
||||||
<text class="lbl">蓝牙状态</text>
|
<text class="lbl">蓝牙状态</text>
|
||||||
<text class="value" :class="formData.bleStatu?'green':'red'">{{formData.bleStatu?'已连接':'未连接'}}</text>
|
<text class="value" :class="formData.bleStatu?'green':'red'">{{getbleStatu}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="lamp">
|
<view class="lamp">
|
||||||
@ -380,7 +380,7 @@
|
|||||||
|
|
||||||
these.formData.id = device.id;
|
these.formData.id = device.id;
|
||||||
these.formData.deviceId = f.deviceId;
|
these.formData.deviceId = f.deviceId;
|
||||||
these.formData.bleStatu = false;
|
these.formData.bleStatu = 'connecting';
|
||||||
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
||||||
these.formData.bleStatu = true;
|
these.formData.bleStatu = true;
|
||||||
});
|
});
|
||||||
@ -403,25 +403,50 @@
|
|||||||
|
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
RSSIRemark: function() {
|
getbleStatu() {
|
||||||
let remark = '极弱';
|
if (this.formData.bleStatu === true) {
|
||||||
if (this.formData.RSSI <= 0 && this.formData.RSSI >= -30) {
|
return '已连接';
|
||||||
remark = '强';
|
|
||||||
}
|
}
|
||||||
|
if (this.formData.bleStatu === 'connecting') {
|
||||||
if (this.formData.RSSI < -30 && this.formData.RSSI >= -60) {
|
return '连接中';
|
||||||
remark = '一般';
|
|
||||||
}
|
}
|
||||||
if (this.formData.RSSI < -60 && this.formData.RSSI >= -85) {
|
if (this.formData.bleStatu === 'dicconnect') {
|
||||||
remark = '弱';
|
return '正在断开';
|
||||||
}
|
}
|
||||||
if (this.formData.RSSI < -85 && this.formData.RSSI >= -100) {
|
if (this.formData.bleStatu === 'err') {
|
||||||
remark = '微弱';
|
return '连接异常';
|
||||||
}
|
}
|
||||||
},
|
return '未连接';
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
bleStatuToggle() {
|
||||||
|
let f = this.getDevice();
|
||||||
|
if (!f) {
|
||||||
|
this.showBleUnConnect();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (this.formData.bleStatu === true) {
|
||||||
|
this.formData.bleStatu = 'dicconnect';
|
||||||
|
ble.disconnectDevice(f.deviceId).finally(r => {
|
||||||
|
this.formData.bleStatu = false;
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.formData.bleStatu === false || this.formData.bleStatu === 'err') {
|
||||||
|
these.formData.bleStatu = 'connecting';
|
||||||
|
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
||||||
|
these.formData.bleStatu = true;
|
||||||
|
}).catch(ex => {
|
||||||
|
these.formData.bleStatu = 'err';
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
handleRightClick(item, s) {
|
handleRightClick(item, s) {
|
||||||
if (item && item.callback) {
|
if (item && item.callback) {
|
||||||
item.callback(item, s);
|
item.callback(item, s);
|
||||||
@ -574,6 +599,7 @@
|
|||||||
showLoading(this, {
|
showLoading(this, {
|
||||||
text: "蓝牙恢复可用,正在连接设备"
|
text: "蓝牙恢复可用,正在连接设备"
|
||||||
});
|
});
|
||||||
|
these.formData.bleStatu = 'connecting';
|
||||||
ble.LinkBlue(these.formData.deviceId).then(() => {
|
ble.LinkBlue(these.formData.deviceId).then(() => {
|
||||||
these.formData.bleStatu = true;
|
these.formData.bleStatu = true;
|
||||||
updateLoading(these, {
|
updateLoading(these, {
|
||||||
@ -1794,7 +1820,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -55,9 +55,9 @@
|
|||||||
<text class="lbl">设备名称</text>
|
<text class="lbl">设备名称</text>
|
||||||
<text class="value">{{device.deviceName}}</text>
|
<text class="value">{{device.deviceName}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item" @click.top="bleStatuToggle">
|
||||||
<text class="lbl">蓝牙状态</text>
|
<text class="lbl">蓝牙状态</text>
|
||||||
<text class="value" :class="formData.bleStatu?'green':'red'">{{formData.bleStatu?'已连接':'未连接'}}</text>
|
<text class="value" :class="formData.bleStatu?'green':'red'">{{getbleStatu}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<text class="lbl">预警级别</text>
|
<text class="lbl">预警级别</text>
|
||||||
@ -401,6 +401,7 @@ import request, { baseURL } from '@/utils/request.js';
|
|||||||
|
|
||||||
these.formData.bleStatu = false;
|
these.formData.bleStatu = false;
|
||||||
these.formData.deviceId = f.deviceId;
|
these.formData.deviceId = f.deviceId;
|
||||||
|
these.formData.bleStatu='connecting';
|
||||||
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
||||||
these.formData.bleStatu = true;
|
these.formData.bleStatu = true;
|
||||||
});
|
});
|
||||||
@ -419,24 +420,49 @@ import request, { baseURL } from '@/utils/request.js';
|
|||||||
this.Status.pageHide = false;
|
this.Status.pageHide = false;
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
RSSIRemark: function() {
|
getbleStatu(){
|
||||||
let remark = '极弱';
|
if(this.formData.bleStatu===true){
|
||||||
if (this.formData.RSSI <= 0 && this.formData.RSSI >= -30) {
|
return '已连接';
|
||||||
remark = '强';
|
}
|
||||||
}
|
if(this.formData.bleStatu==='connecting'){
|
||||||
|
return '连接中';
|
||||||
if (this.formData.RSSI < -30 && this.formData.RSSI >= -60) {
|
}
|
||||||
remark = '一般';
|
if(this.formData.bleStatu==='dicconnect'){
|
||||||
}
|
return '正在断开';
|
||||||
if (this.formData.RSSI < -60 && this.formData.RSSI >= -85) {
|
}
|
||||||
remark = '弱';
|
if(this.formData.bleStatu==='err'){
|
||||||
}
|
return '连接异常';
|
||||||
if (this.formData.RSSI < -85 && this.formData.RSSI >= -100) {
|
}
|
||||||
remark = '微弱';
|
return '未连接';
|
||||||
}
|
}
|
||||||
}
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
bleStatuToggle(){
|
||||||
|
let f=this.getDevice();
|
||||||
|
if(!f){
|
||||||
|
this.showBleUnConnect();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(this.formData.bleStatu===true){
|
||||||
|
this.formData.bleStatu='dicconnect';
|
||||||
|
ble.disconnectDevice(f.deviceId).finally(r=>{
|
||||||
|
this.formData.bleStatu=false;
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.formData.bleStatu===false || this.formData.bleStatu==='err'){
|
||||||
|
this.formData.bleStatu='connecting';
|
||||||
|
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
||||||
|
these.formData.bleStatu = true;
|
||||||
|
}).catch(ex=>{
|
||||||
|
these.formData.bleStatu = 'err';
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
handleRightClick(item, s) {
|
handleRightClick(item, s) {
|
||||||
if (item && item.callback) {
|
if (item && item.callback) {
|
||||||
item.callback(item, s);
|
item.callback(item, s);
|
||||||
@ -521,6 +547,7 @@ import request, { baseURL } from '@/utils/request.js';
|
|||||||
showLoading(this, {
|
showLoading(this, {
|
||||||
text: "蓝牙恢复可用,正在连接设备"
|
text: "蓝牙恢复可用,正在连接设备"
|
||||||
});
|
});
|
||||||
|
this.formData.bleStatu='connecting';
|
||||||
ble.LinkBlue(these.formData.deviceId).then(() => {
|
ble.LinkBlue(these.formData.deviceId).then(() => {
|
||||||
these.formData.bleStatu = true;
|
these.formData.bleStatu = true;
|
||||||
updateLoading(these, {
|
updateLoading(these, {
|
||||||
|
|||||||
@ -1,8 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="content contentBg">
|
<view class="content contentBg">
|
||||||
<!-- <custom-navbar :title="Status.navbar.title" :showBack="Status.navbar.showBack" color="#FFFFFF"
|
|
||||||
:rightIcons="Status.navbar.icons" @icon-click="handleRightClick" backgroundColor="#121212"></custom-navbar>
|
|
||||||
-->
|
|
||||||
<uni-nav-bar :border="false" @clickLeft="prevPage" fixed="true" statusBar="true"
|
<uni-nav-bar :border="false" @clickLeft="prevPage" fixed="true" statusBar="true"
|
||||||
background-color="#121212" color="#FFFFFF" :title="Status.navbar.title">
|
background-color="#121212" color="#FFFFFF" :title="Status.navbar.title">
|
||||||
<template v-slot:left><view>
|
<template v-slot:left><view>
|
||||||
@ -58,9 +55,9 @@
|
|||||||
<text class="lbl">蓝牙名称</text>
|
<text class="lbl">蓝牙名称</text>
|
||||||
<text class="value valueFont">{{device.bluetoothName}}</text>
|
<text class="value valueFont">{{device.bluetoothName}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item" @click.top="bleStatuToggle">
|
||||||
<text class="lbl">蓝牙状态</text>
|
<text class="lbl">蓝牙状态</text>
|
||||||
<text class="value" :class="formData.bleStatu?'green':'red'">{{formData.bleStatu?'已连接':'未连接'}}</text>
|
<text class="value" :class="formData.bleStatu?'green':'red'">{{getbleStatu}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<text class="lbl">设备状态</text>
|
<text class="lbl">设备状态</text>
|
||||||
@ -550,7 +547,8 @@
|
|||||||
these.formData['imei'] = these.device.deviceImei;
|
these.formData['imei'] = these.device.deviceImei;
|
||||||
}
|
}
|
||||||
these.getDetail();
|
these.getDetail();
|
||||||
these.formData.bleStatu = false;
|
|
||||||
|
these.formData.bleStatu='connecting';
|
||||||
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
||||||
these.formData.bleStatu = true;
|
these.formData.bleStatu = true;
|
||||||
});
|
});
|
||||||
@ -567,9 +565,49 @@
|
|||||||
ble.removeReceiveCallback(pagePath);
|
ble.removeReceiveCallback(pagePath);
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
getbleStatu(){
|
||||||
|
if(this.formData.bleStatu===true){
|
||||||
|
return '已连接';
|
||||||
|
}
|
||||||
|
if(this.formData.bleStatu==='connecting'){
|
||||||
|
return '连接中';
|
||||||
|
}
|
||||||
|
if(this.formData.bleStatu==='dicconnect'){
|
||||||
|
return '正在断开';
|
||||||
|
}
|
||||||
|
if(this.formData.bleStatu==='err'){
|
||||||
|
return '连接异常';
|
||||||
|
}
|
||||||
|
return '未连接';
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
bleStatuToggle(){
|
||||||
|
let f=this.getDevice();
|
||||||
|
if(!f){
|
||||||
|
this.showBleUnConnect();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(this.formData.bleStatu===true){
|
||||||
|
this.formData.bleStatu='dicconnect';
|
||||||
|
ble.disconnectDevice(f.deviceId).finally(r=>{
|
||||||
|
this.formData.bleStatu=false;
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.formData.bleStatu===false || this.formData.bleStatu==='err'){
|
||||||
|
this.formData.bleStatu='connecting';
|
||||||
|
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
||||||
|
these.formData.bleStatu = true;
|
||||||
|
}).catch(ex=>{
|
||||||
|
these.formData.bleStatu = 'err';
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
prevPage() {
|
prevPage() {
|
||||||
uni.navigateBack({
|
uni.navigateBack({
|
||||||
|
|
||||||
@ -629,6 +667,7 @@
|
|||||||
showLoading(this, {
|
showLoading(this, {
|
||||||
text: "蓝牙恢复可用,正在连接设备"
|
text: "蓝牙恢复可用,正在连接设备"
|
||||||
});
|
});
|
||||||
|
this.formData.bleStatu='connecting';
|
||||||
ble.LinkBlue(these.formData.deviceId).then(() => {
|
ble.LinkBlue(these.formData.deviceId).then(() => {
|
||||||
these.formData.bleStatu = true;
|
these.formData.bleStatu = true;
|
||||||
updateLoading(these, {
|
updateLoading(these, {
|
||||||
|
|||||||
@ -60,9 +60,9 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
<view class="item">
|
<view class="item" @click.top="bleStatuToggle">
|
||||||
<text class="lbl">蓝牙状态</text>
|
<text class="lbl">蓝牙状态</text>
|
||||||
<text class="value" :class="formData.bleStatu?'green':'red'">{{formData.bleStatu?'已连接':'未连接'}}</text>
|
<text class="value" :class="formData.bleStatu?'green':'red'">{{getbleStatu}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="lamp">
|
<view class="lamp">
|
||||||
@ -358,7 +358,7 @@ these.Status.apiType = data.apiType;
|
|||||||
|
|
||||||
these.formData.id = device.id;
|
these.formData.id = device.id;
|
||||||
these.formData.deviceId = f.deviceId;
|
these.formData.deviceId = f.deviceId;
|
||||||
these.formData.bleStatu = false;
|
these.formData.bleStatu = 'connecting';
|
||||||
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
||||||
console.log("连接成功")
|
console.log("连接成功")
|
||||||
these.formData.bleStatu = true;
|
these.formData.bleStatu = true;
|
||||||
@ -378,22 +378,21 @@ these.Status.apiType = data.apiType;
|
|||||||
this.Status.pageHide = false;
|
this.Status.pageHide = false;
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
RSSIRemark: function() {
|
getbleStatu(){
|
||||||
let remark = '极弱';
|
if(this.formData.bleStatu===true){
|
||||||
if (this.formData.RSSI <= 0 && this.formData.RSSI >= -30) {
|
return '已连接';
|
||||||
remark = '强';
|
}
|
||||||
}
|
if(this.formData.bleStatu==='connecting'){
|
||||||
|
return '连接中';
|
||||||
if (this.formData.RSSI < -30 && this.formData.RSSI >= -60) {
|
}
|
||||||
remark = '一般';
|
if(this.formData.bleStatu==='dicconnect'){
|
||||||
}
|
return '正在断开';
|
||||||
if (this.formData.RSSI < -60 && this.formData.RSSI >= -85) {
|
}
|
||||||
remark = '弱';
|
if(this.formData.bleStatu==='err'){
|
||||||
}
|
return '连接异常';
|
||||||
if (this.formData.RSSI < -85 && this.formData.RSSI >= -100) {
|
}
|
||||||
remark = '微弱';
|
return '未连接';
|
||||||
}
|
},
|
||||||
},
|
|
||||||
getMode() {
|
getMode() {
|
||||||
let txt = "关闭";
|
let txt = "关闭";
|
||||||
if (this.Status.BottomMenu.type == 'fu') {
|
if (this.Status.BottomMenu.type == 'fu') {
|
||||||
@ -425,6 +424,32 @@ these.Status.apiType = data.apiType;
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
bleStatuToggle(){
|
||||||
|
let f=this.getDevice();
|
||||||
|
if(!f){
|
||||||
|
this.showBleUnConnect();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(this.formData.bleStatu===true){
|
||||||
|
this.formData.bleStatu='dicconnect';
|
||||||
|
ble.disconnectDevice(f.deviceId).finally(r=>{
|
||||||
|
this.formData.bleStatu=false;
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.formData.bleStatu===false || this.formData.bleStatu==='err'){
|
||||||
|
these.formData.bleStatu = 'connecting';
|
||||||
|
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
||||||
|
these.formData.bleStatu = true;
|
||||||
|
}).catch(ex=>{
|
||||||
|
these.formData.bleStatu = 'err';
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
handleRightClick(item, s) {
|
handleRightClick(item, s) {
|
||||||
if (item && item.callback) {
|
if (item && item.callback) {
|
||||||
item.callback(item, s);
|
item.callback(item, s);
|
||||||
@ -513,6 +538,7 @@ these.Status.apiType = data.apiType;
|
|||||||
showLoading(this, {
|
showLoading(this, {
|
||||||
text: "蓝牙恢复可用,正在连接设备"
|
text: "蓝牙恢复可用,正在连接设备"
|
||||||
});
|
});
|
||||||
|
these.formData.bleStatu = 'connecting';
|
||||||
ble.LinkBlue(these.formData.deviceId).then(() => {
|
ble.LinkBlue(these.formData.deviceId).then(() => {
|
||||||
these.formData.bleStatu = true;
|
these.formData.bleStatu = true;
|
||||||
updateLoading(these, {
|
updateLoading(these, {
|
||||||
|
|||||||
@ -37,6 +37,7 @@ class BleReceive {
|
|||||||
});
|
});
|
||||||
|
|
||||||
uni.setStorageSync(this.StorageKey, linkedList);
|
uni.setStorageSync(this.StorageKey, linkedList);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user