蓝牙设备添加断开重连提示
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,16 +9,16 @@
|
||||
</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>
|
||||
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
</uni-nav-bar>
|
||||
<view class="eq">
|
||||
<view class="leftImg" @click.stop="previewImg(device.devicePic?device.devicePic:formData.img)">
|
||||
@ -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,10 +201,10 @@ import Common from '@/utils/Common.js';
|
||||
icons: [{
|
||||
src: '/static/images/common/shape.png',
|
||||
callback: this.gotoShare,
|
||||
apiType:'listA'
|
||||
apiType: 'listA'
|
||||
}],
|
||||
title: 'BJQ6155'
|
||||
|
||||
|
||||
},
|
||||
pageHide: false,
|
||||
Pop: {
|
||||
@ -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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
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) {
|
||||
if (item && item.callback) {
|
||||
item.callback(item, s);
|
||||
@ -457,7 +457,7 @@ these.Status.apiType = data.apiType;
|
||||
uni.showModal({
|
||||
content: '敬请期待'
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
navigatorBack() {
|
||||
@ -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();
|
||||
@ -580,9 +585,9 @@ these.Status.apiType = data.apiType;
|
||||
if (this.Status.pageHide) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
let json = recei.ReceiveData(receive, device, path, recArr);
|
||||
console.log("收到消息:",receive.hexs);
|
||||
console.log("收到消息:", receive.hexs);
|
||||
if (!json) {
|
||||
return;
|
||||
}
|
||||
@ -913,7 +918,7 @@ these.Status.apiType = data.apiType;
|
||||
},
|
||||
UploadOpenImg: function() {
|
||||
if (!this.permissions.includes('3') && this.Status.apiType !== 'listA') {
|
||||
|
||||
|
||||
this.showPop({
|
||||
message: '无操作权限',
|
||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||
@ -924,7 +929,7 @@ these.Status.apiType = data.apiType;
|
||||
})
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//上传开机画面
|
||||
this.Status.BottomMenu.menuItems = [];
|
||||
this.Status.BottomMenu.title = "上传开机画面";
|
||||
@ -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: '无操作权限',
|
||||
@ -1177,7 +1182,7 @@ if (!this.permissions.includes('1') && this.Status.apiType !== 'listA') {
|
||||
},
|
||||
sendUsr() {
|
||||
if (!this.permissions.includes('4') && this.Status.apiType !== 'listA') {
|
||||
|
||||
|
||||
this.showPop({
|
||||
message: '无操作权限',
|
||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||
@ -1392,7 +1397,7 @@ if (!this.permissions.includes('1') && this.Status.apiType !== 'listA') {
|
||||
//给蓝牙设备发送信号更新亮度
|
||||
BrighInteval = setTimeout(() => {
|
||||
if (!this.permissions.includes('1') && this.Status.apiType !== 'listA') {
|
||||
|
||||
|
||||
this.showPop({
|
||||
message: '无操作权限',
|
||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||
@ -1403,7 +1408,7 @@ if (!this.permissions.includes('1') && this.Status.apiType !== 'listA') {
|
||||
})
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
this.sendBrightness();
|
||||
this.setBleFormData();
|
||||
}, 100);
|
||||
@ -1922,27 +1927,27 @@ if (!this.permissions.includes('1') && this.Status.apiType !== 'listA') {
|
||||
left: -99999rpx;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
.navbarRight {
|
||||
width: 40px;
|
||||
height: 100%;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
.navbarRight .imgContent {
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
|
||||
.navbarRight .imgContent:first-child {
|
||||
|
||||
|
||||
width: 38rpx !important;
|
||||
height: 38rpx !important;
|
||||
margin-top: -2rpx;
|
||||
}
|
||||
|
||||
|
||||
.navbarRight .imgContent .baber {
|
||||
position: absolute;
|
||||
z-index: 100;
|
||||
@ -1958,33 +1963,33 @@ if (!this.permissions.includes('1') && this.Status.apiType !== 'listA') {
|
||||
font-style: Regular;
|
||||
font-size: 20rpx;
|
||||
font-weight: 400;
|
||||
|
||||
|
||||
text-align: center;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
.navbarRight .imgContent .img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
|
||||
.navbarRight .imgContent .img:last-child {
|
||||
padding: 1rpx;
|
||||
}
|
||||
|
||||
|
||||
.nvbar {
|
||||
top: 0px;
|
||||
}
|
||||
|
||||
|
||||
/deep/ .uni-navbar--fixed {
|
||||
top: 0px;
|
||||
}
|
||||
|
||||
|
||||
.uninavebartext {
|
||||
width: 100%;
|
||||
font-size: 32rpx;
|
||||
|
||||
Reference in New Issue
Block a user