蓝牙设备添加断开重连提示
This commit is contained in:
@ -505,7 +505,11 @@
|
||||
return;
|
||||
}
|
||||
if (res.deviceId == these.formData.deviceId) {
|
||||
this.formData.bleStatu = false;
|
||||
if(res.device){
|
||||
these.formData.bleStatu = 'connecting';
|
||||
}else{
|
||||
this.formData.bleStatu = false;
|
||||
}
|
||||
setTimeout(() => {
|
||||
hideLoading(these, 1000);
|
||||
});
|
||||
|
||||
@ -1196,7 +1196,11 @@
|
||||
return;
|
||||
}
|
||||
if (res.deviceId == these.formData.deviceId) {
|
||||
this.formData.bleStatu = false;
|
||||
if(res.device){
|
||||
these.formData.bleStatu = 'connecting';
|
||||
}else{
|
||||
this.formData.bleStatu = false;
|
||||
}
|
||||
setTimeout(() => {
|
||||
hideLoading(these, 1000);
|
||||
});
|
||||
|
||||
@ -979,7 +979,11 @@
|
||||
return;
|
||||
}
|
||||
if (res.deviceId == these.formData.deviceId) {
|
||||
this.formData.bleStatu = false;
|
||||
if(res.device){
|
||||
these.formData.bleStatu = 'connecting';
|
||||
}else{
|
||||
this.formData.bleStatu = false;
|
||||
}
|
||||
setTimeout(() => {
|
||||
hideLoading(these, 1000);
|
||||
});
|
||||
|
||||
@ -1087,7 +1087,11 @@
|
||||
return;
|
||||
}
|
||||
if (res.deviceId == these.formData.deviceId) {
|
||||
this.formData.bleStatu = false;
|
||||
if(res.device){
|
||||
these.formData.bleStatu = 'connecting';
|
||||
}else{
|
||||
this.formData.bleStatu = false;
|
||||
}
|
||||
setTimeout(() => {
|
||||
hideLoading(these, 1000);
|
||||
});
|
||||
|
||||
@ -603,7 +603,11 @@ import request, { baseURL } from '@/utils/request.js';
|
||||
return;
|
||||
}
|
||||
if (res.deviceId == these.formData.deviceId) {
|
||||
this.formData.bleStatu = false;
|
||||
if(res.device){
|
||||
these.formData.bleStatu = 'connecting';
|
||||
}else{
|
||||
this.formData.bleStatu = false;
|
||||
}
|
||||
setTimeout(() => {
|
||||
hideLoading(these, 1000);
|
||||
});
|
||||
|
||||
@ -585,7 +585,11 @@
|
||||
return;
|
||||
}
|
||||
if (res.deviceId == these.formData.deviceId) {
|
||||
this.formData.bleStatu = false;
|
||||
if(res.device){
|
||||
these.formData.bleStatu = 'connecting';
|
||||
}else{
|
||||
this.formData.bleStatu = false;
|
||||
}
|
||||
setTimeout(() => {
|
||||
hideLoading(these, 1000);
|
||||
});
|
||||
|
||||
@ -566,7 +566,11 @@
|
||||
return;
|
||||
}
|
||||
if (res.deviceId == these.formData.deviceId) {
|
||||
this.formData.bleStatu = false;
|
||||
if(res.device){
|
||||
these.formData.bleStatu = 'connecting';
|
||||
}else{
|
||||
this.formData.bleStatu = false;
|
||||
}
|
||||
setTimeout(() => {
|
||||
hideLoading(these, 1000);
|
||||
});
|
||||
|
||||
@ -617,7 +617,11 @@ import request, { baseURL } from '@/utils/request.js';
|
||||
return;
|
||||
}
|
||||
if (res.deviceId == these.formData.deviceId) {
|
||||
this.formData.bleStatu = false;
|
||||
if(res.device){
|
||||
these.formData.bleStatu = 'connecting';
|
||||
}else{
|
||||
this.formData.bleStatu = false;
|
||||
}
|
||||
setTimeout(() => {
|
||||
hideLoading(these, 1000);
|
||||
});
|
||||
|
||||
@ -514,7 +514,11 @@ import request, { baseURL } from '@/utils/request.js';
|
||||
return;
|
||||
}
|
||||
if (res.deviceId == these.formData.deviceId) {
|
||||
this.formData.bleStatu = false;
|
||||
if(res.device){
|
||||
these.formData.bleStatu = 'connecting';
|
||||
}else{
|
||||
this.formData.bleStatu = false;
|
||||
}
|
||||
setTimeout(() => {
|
||||
hideLoading(these, 1000);
|
||||
});
|
||||
|
||||
@ -634,7 +634,11 @@
|
||||
return;
|
||||
}
|
||||
if (res.deviceId == these.formData.deviceId) {
|
||||
this.formData.bleStatu = false;
|
||||
if(res.device){
|
||||
these.formData.bleStatu = 'connecting';
|
||||
}else{
|
||||
this.formData.bleStatu = false;
|
||||
}
|
||||
setTimeout(() => {
|
||||
hideLoading(these, 1000);
|
||||
});
|
||||
|
||||
@ -9,8 +9,8 @@
|
||||
</view>
|
||||
<view slot="right">
|
||||
<view class="navbarRight center">
|
||||
<view class="imgContent" :class="{'visibilityHidden':Status.apiType!=item.apiType}" @click.stop="handleRightClick(item,index)"
|
||||
v-for="item,index in Status.navbar.icons">
|
||||
<view class="imgContent" :class="{'visibilityHidden':Status.apiType!=item.apiType}"
|
||||
@click.stop="handleRightClick(item,index)" v-for="item,index in Status.navbar.icons">
|
||||
<image class="img" :src="item.src" mode="aspectFit"></image>
|
||||
<view class="baber" v-if="item.math">{{item.math>9?'9+':item.math}}</view>
|
||||
</view>
|
||||
@ -182,7 +182,7 @@
|
||||
updateLoading
|
||||
} from '@/utils/loading.js'
|
||||
import BleReceive from '@/utils/BleReceive';
|
||||
import Common from '@/utils/Common.js';
|
||||
import Common from '@/utils/Common.js';
|
||||
|
||||
var ble = null;
|
||||
var these = null;
|
||||
@ -201,7 +201,7 @@ import Common from '@/utils/Common.js';
|
||||
icons: [{
|
||||
src: '/static/images/common/shape.png',
|
||||
callback: this.gotoShare,
|
||||
apiType:'listA'
|
||||
apiType: 'listA'
|
||||
}],
|
||||
title: 'BJQ6155'
|
||||
|
||||
@ -320,8 +320,8 @@ import Common from '@/utils/Common.js';
|
||||
|
||||
let device = data.data;
|
||||
these.device = device;
|
||||
these.Status.apiType = data.apiType;
|
||||
these.Status.navbar.title=device.deviceName;
|
||||
these.Status.apiType = data.apiType;
|
||||
these.Status.navbar.title = device.deviceName;
|
||||
if (data.apiType !== 'listA') {
|
||||
Common.getdeviceShareId(data.data.id).then(res => {
|
||||
if (res.code == 200) {
|
||||
@ -378,21 +378,21 @@ these.Status.apiType = data.apiType;
|
||||
this.Status.pageHide = false;
|
||||
},
|
||||
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 '未连接';
|
||||
},
|
||||
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 '未连接';
|
||||
},
|
||||
getMode() {
|
||||
let txt = "关闭";
|
||||
if (this.Status.BottomMenu.type == 'fu') {
|
||||
@ -424,32 +424,32 @@ these.Status.apiType = data.apiType;
|
||||
}
|
||||
},
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
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) {
|
||||
if (item && item.callback) {
|
||||
item.callback(item, s);
|
||||
@ -502,7 +502,12 @@ these.Status.apiType = data.apiType;
|
||||
return;
|
||||
}
|
||||
if (res.deviceId == these.formData.deviceId) {
|
||||
this.formData.bleStatu = false;
|
||||
if (res.device) {
|
||||
these.formData.bleStatu = 'connecting';
|
||||
} else {
|
||||
this.formData.bleStatu = false;
|
||||
}
|
||||
|
||||
// 断开连接时先将充电状态复位,避免保持旧值
|
||||
this.formData.statu = '未充电';
|
||||
this.setBleFormData();
|
||||
@ -582,7 +587,7 @@ these.Status.apiType = data.apiType;
|
||||
}
|
||||
|
||||
let json = recei.ReceiveData(receive, device, path, recArr);
|
||||
console.log("收到消息:",receive.hexs);
|
||||
console.log("收到消息:", receive.hexs);
|
||||
if (!json) {
|
||||
return;
|
||||
}
|
||||
@ -932,7 +937,7 @@ these.Status.apiType = data.apiType;
|
||||
this.Status.BottomMenu.show = true;
|
||||
},
|
||||
ModeSetting: function(type) {
|
||||
if (!this.permissions.includes('1') && this.Status.apiType !== 'listA') {
|
||||
if (!this.permissions.includes('1') && this.Status.apiType !== 'listA') {
|
||||
|
||||
this.showPop({
|
||||
message: '无操作权限',
|
||||
|
||||
Reference in New Issue
Block a user