蓝牙设备添加断开重连提示
This commit is contained in:
@ -505,7 +505,11 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (res.deviceId == these.formData.deviceId) {
|
if (res.deviceId == these.formData.deviceId) {
|
||||||
this.formData.bleStatu = false;
|
if(res.device){
|
||||||
|
these.formData.bleStatu = 'connecting';
|
||||||
|
}else{
|
||||||
|
this.formData.bleStatu = false;
|
||||||
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
hideLoading(these, 1000);
|
hideLoading(these, 1000);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1196,7 +1196,11 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (res.deviceId == these.formData.deviceId) {
|
if (res.deviceId == these.formData.deviceId) {
|
||||||
this.formData.bleStatu = false;
|
if(res.device){
|
||||||
|
these.formData.bleStatu = 'connecting';
|
||||||
|
}else{
|
||||||
|
this.formData.bleStatu = false;
|
||||||
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
hideLoading(these, 1000);
|
hideLoading(these, 1000);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -979,7 +979,11 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (res.deviceId == these.formData.deviceId) {
|
if (res.deviceId == these.formData.deviceId) {
|
||||||
this.formData.bleStatu = false;
|
if(res.device){
|
||||||
|
these.formData.bleStatu = 'connecting';
|
||||||
|
}else{
|
||||||
|
this.formData.bleStatu = false;
|
||||||
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
hideLoading(these, 1000);
|
hideLoading(these, 1000);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1087,7 +1087,11 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (res.deviceId == these.formData.deviceId) {
|
if (res.deviceId == these.formData.deviceId) {
|
||||||
this.formData.bleStatu = false;
|
if(res.device){
|
||||||
|
these.formData.bleStatu = 'connecting';
|
||||||
|
}else{
|
||||||
|
this.formData.bleStatu = false;
|
||||||
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
hideLoading(these, 1000);
|
hideLoading(these, 1000);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -603,7 +603,11 @@ import request, { baseURL } from '@/utils/request.js';
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (res.deviceId == these.formData.deviceId) {
|
if (res.deviceId == these.formData.deviceId) {
|
||||||
this.formData.bleStatu = false;
|
if(res.device){
|
||||||
|
these.formData.bleStatu = 'connecting';
|
||||||
|
}else{
|
||||||
|
this.formData.bleStatu = false;
|
||||||
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
hideLoading(these, 1000);
|
hideLoading(these, 1000);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -585,7 +585,11 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (res.deviceId == these.formData.deviceId) {
|
if (res.deviceId == these.formData.deviceId) {
|
||||||
this.formData.bleStatu = false;
|
if(res.device){
|
||||||
|
these.formData.bleStatu = 'connecting';
|
||||||
|
}else{
|
||||||
|
this.formData.bleStatu = false;
|
||||||
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
hideLoading(these, 1000);
|
hideLoading(these, 1000);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -566,7 +566,11 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (res.deviceId == these.formData.deviceId) {
|
if (res.deviceId == these.formData.deviceId) {
|
||||||
this.formData.bleStatu = false;
|
if(res.device){
|
||||||
|
these.formData.bleStatu = 'connecting';
|
||||||
|
}else{
|
||||||
|
this.formData.bleStatu = false;
|
||||||
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
hideLoading(these, 1000);
|
hideLoading(these, 1000);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -617,7 +617,11 @@ import request, { baseURL } from '@/utils/request.js';
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (res.deviceId == these.formData.deviceId) {
|
if (res.deviceId == these.formData.deviceId) {
|
||||||
this.formData.bleStatu = false;
|
if(res.device){
|
||||||
|
these.formData.bleStatu = 'connecting';
|
||||||
|
}else{
|
||||||
|
this.formData.bleStatu = false;
|
||||||
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
hideLoading(these, 1000);
|
hideLoading(these, 1000);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -514,7 +514,11 @@ import request, { baseURL } from '@/utils/request.js';
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (res.deviceId == these.formData.deviceId) {
|
if (res.deviceId == these.formData.deviceId) {
|
||||||
this.formData.bleStatu = false;
|
if(res.device){
|
||||||
|
these.formData.bleStatu = 'connecting';
|
||||||
|
}else{
|
||||||
|
this.formData.bleStatu = false;
|
||||||
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
hideLoading(these, 1000);
|
hideLoading(these, 1000);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -634,7 +634,11 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (res.deviceId == these.formData.deviceId) {
|
if (res.deviceId == these.formData.deviceId) {
|
||||||
this.formData.bleStatu = false;
|
if(res.device){
|
||||||
|
these.formData.bleStatu = 'connecting';
|
||||||
|
}else{
|
||||||
|
this.formData.bleStatu = false;
|
||||||
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
hideLoading(these, 1000);
|
hideLoading(these, 1000);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -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>
|
||||||
@ -182,7 +182,7 @@
|
|||||||
updateLoading
|
updateLoading
|
||||||
} from '@/utils/loading.js'
|
} from '@/utils/loading.js'
|
||||||
import BleReceive from '@/utils/BleReceive';
|
import BleReceive from '@/utils/BleReceive';
|
||||||
import Common from '@/utils/Common.js';
|
import Common from '@/utils/Common.js';
|
||||||
|
|
||||||
var ble = null;
|
var ble = null;
|
||||||
var these = null;
|
var these = null;
|
||||||
@ -201,7 +201,7 @@ import Common from '@/utils/Common.js';
|
|||||||
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'
|
||||||
|
|
||||||
@ -320,8 +320,8 @@ import Common from '@/utils/Common.js';
|
|||||||
|
|
||||||
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) {
|
||||||
@ -378,21 +378,21 @@ these.Status.apiType = data.apiType;
|
|||||||
this.Status.pageHide = false;
|
this.Status.pageHide = false;
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
getbleStatu(){
|
getbleStatu() {
|
||||||
if(this.formData.bleStatu===true){
|
if (this.formData.bleStatu === true) {
|
||||||
return '已连接';
|
return '已连接';
|
||||||
}
|
}
|
||||||
if(this.formData.bleStatu==='connecting'){
|
if (this.formData.bleStatu === 'connecting') {
|
||||||
return '连接中';
|
return '连接中';
|
||||||
}
|
}
|
||||||
if(this.formData.bleStatu==='dicconnect'){
|
if (this.formData.bleStatu === 'dicconnect') {
|
||||||
return '正在断开';
|
return '正在断开';
|
||||||
}
|
}
|
||||||
if(this.formData.bleStatu==='err'){
|
if (this.formData.bleStatu === 'err') {
|
||||||
return '连接异常';
|
return '连接异常';
|
||||||
}
|
}
|
||||||
return '未连接';
|
return '未连接';
|
||||||
},
|
},
|
||||||
getMode() {
|
getMode() {
|
||||||
let txt = "关闭";
|
let txt = "关闭";
|
||||||
if (this.Status.BottomMenu.type == 'fu') {
|
if (this.Status.BottomMenu.type == 'fu') {
|
||||||
@ -424,32 +424,32 @@ these.Status.apiType = data.apiType;
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
bleStatuToggle(){
|
bleStatuToggle() {
|
||||||
let f=this.getDevice();
|
let f = this.getDevice();
|
||||||
if(!f){
|
if (!f) {
|
||||||
this.showBleUnConnect();
|
this.showBleUnConnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(this.formData.bleStatu===true){
|
if (this.formData.bleStatu === true) {
|
||||||
this.formData.bleStatu='dicconnect';
|
this.formData.bleStatu = 'dicconnect';
|
||||||
ble.disconnectDevice(f.deviceId).finally(r=>{
|
ble.disconnectDevice(f.deviceId).finally(r => {
|
||||||
this.formData.bleStatu=false;
|
this.formData.bleStatu = false;
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.formData.bleStatu===false || this.formData.bleStatu==='err'){
|
if (this.formData.bleStatu === false || this.formData.bleStatu === 'err') {
|
||||||
these.formData.bleStatu = 'connecting';
|
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=>{
|
}).catch(ex => {
|
||||||
these.formData.bleStatu = 'err';
|
these.formData.bleStatu = 'err';
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
handleRightClick(item, s) {
|
handleRightClick(item, s) {
|
||||||
if (item && item.callback) {
|
if (item && item.callback) {
|
||||||
item.callback(item, s);
|
item.callback(item, s);
|
||||||
@ -502,7 +502,12 @@ these.Status.apiType = data.apiType;
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (res.deviceId == these.formData.deviceId) {
|
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.formData.statu = '未充电';
|
||||||
this.setBleFormData();
|
this.setBleFormData();
|
||||||
@ -582,7 +587,7 @@ these.Status.apiType = data.apiType;
|
|||||||
}
|
}
|
||||||
|
|
||||||
let json = recei.ReceiveData(receive, device, path, recArr);
|
let json = recei.ReceiveData(receive, device, path, recArr);
|
||||||
console.log("收到消息:",receive.hexs);
|
console.log("收到消息:", receive.hexs);
|
||||||
if (!json) {
|
if (!json) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -932,7 +937,7 @@ these.Status.apiType = data.apiType;
|
|||||||
this.Status.BottomMenu.show = true;
|
this.Status.BottomMenu.show = true;
|
||||||
},
|
},
|
||||||
ModeSetting: function(type) {
|
ModeSetting: function(type) {
|
||||||
if (!this.permissions.includes('1') && this.Status.apiType !== 'listA') {
|
if (!this.permissions.includes('1') && this.Status.apiType !== 'listA') {
|
||||||
|
|
||||||
this.showPop({
|
this.showPop({
|
||||||
message: '无操作权限',
|
message: '无操作权限',
|
||||||
|
|||||||
Reference in New Issue
Block a user