修复有时候蓝牙配对成功依然提示未连接的异常
This commit is contained in:
@ -75,12 +75,12 @@
|
||||
<view class="h50">
|
||||
<view class="workMode">
|
||||
<view class="item" @click.stop="highSpeedSetting(item,index,true)"
|
||||
:class="{'active':formData.sta_highSpeed && formData.sta_LedType===item.key}">
|
||||
:class="{'active':formData.sta_highSpeed && formData.sta_LedType===item.key}">
|
||||
<view class="checkbox"></view>
|
||||
<text>强光</text>
|
||||
</view>
|
||||
<view class="item " @click.stop="highSpeedSetting(item,index,false)"
|
||||
:class="{'active':formData.sta_highSpeed===false && formData.sta_LedType===item.key}">
|
||||
:class="{'active':formData.sta_highSpeed===false && formData.sta_LedType===item.key}">
|
||||
<view class="checkbox "></view>
|
||||
<text>工作光</text>
|
||||
</view>
|
||||
@ -94,7 +94,7 @@
|
||||
<view class="mode fleft marginLeft" :class="{'rbActive':formData.SOS}" v-on:click.stop="sosSetting()">
|
||||
<view class="leftImg">
|
||||
<image class="img" :src="formData.SOS?'/static/images/670/sgActive.png':'/static/images/670/sg.png'"
|
||||
mode="aspectFit">
|
||||
mode="aspectFit">
|
||||
</image>
|
||||
</view>
|
||||
<view class="rightTxt">
|
||||
@ -115,9 +115,9 @@
|
||||
<view class="mode fleft " @click.stop="playVolume()" :class="{'active':formData.isPlay}">
|
||||
<view class="leftImg">
|
||||
<image class="img" :class="{'displayNone':formData.isPlay}" src="/static/images/common/play.png"
|
||||
mode="aspectFit"></image>
|
||||
mode="aspectFit"></image>
|
||||
<image class="img" :class="{'displayNone':!formData.isPlay}"
|
||||
src="/static/images/common/playingActive.png" mode="aspectFit"></image>
|
||||
src="/static/images/common/playingActive.png" mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="rightTxt">
|
||||
<text class="bigTxt">{{formData.isPlay?'正在播放':'播放语音'}}</text>
|
||||
@ -184,14 +184,14 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<ProParams :id="device.id"></ProParams>
|
||||
<ProParams :id="device.id"></ProParams>
|
||||
<!-- 弹窗通知 -->
|
||||
<MessagePopup v-for="item,key in Msgboxs" :visible="item.showPop" :type="item.popType" :bgColor="item.bgColor"
|
||||
:borderColor="item.borderColor" :textColor="item.textColor" :buttonBgColor="item.buttonBgColor"
|
||||
:buttonTextColor="item.buttonTextColor" :iconUrl="item.iconUrl" :message="item.message"
|
||||
:buttonText="item.buttonText" @buttonClick="item.okCallback(item)" :visiblePrompt="item.visiblePrompt"
|
||||
:promptTitle="item.promptTitle" v-model="item.modelValue" @closePop="closePop(item)"
|
||||
:buttonCancelText="item.buttonCancelText" :showCancel="item.showCancel" @cancelPop="closePop(item)" />
|
||||
:borderColor="item.borderColor" :textColor="item.textColor" :buttonBgColor="item.buttonBgColor"
|
||||
:buttonTextColor="item.buttonTextColor" :iconUrl="item.iconUrl" :message="item.message"
|
||||
:buttonText="item.buttonText" @buttonClick="item.okCallback(item)" :visiblePrompt="item.visiblePrompt"
|
||||
:promptTitle="item.promptTitle" v-model="item.modelValue" @closePop="closePop(item)"
|
||||
:buttonCancelText="item.buttonCancelText" :showCancel="item.showCancel" @cancelPop="closePop(item)" />
|
||||
|
||||
<!-- 下方菜单 -->
|
||||
|
||||
@ -205,7 +205,7 @@
|
||||
|
||||
<view class="header">
|
||||
<uni-icons @click.stop="Status.showVolumPop=false" type="closeempty" size="15"
|
||||
color="#FFFFFFde"></uni-icons>
|
||||
color="#FFFFFFde"></uni-icons>
|
||||
</view>
|
||||
<view class="txtContent">
|
||||
<view class="volTxt">
|
||||
@ -218,8 +218,8 @@
|
||||
<view class="slider-container">
|
||||
|
||||
<slider min="0" max="100" step="1" :disabled="false" :value="formData.volumn" activeColor="#bbe600"
|
||||
backgroundColor="#686767" block-size="20" block-color="#ffffffde" @change="volumechange"
|
||||
@changing="volumechange" class="custom-slider" />
|
||||
backgroundColor="#686767" block-size="20" block-color="#ffffffde" @change="volumechange"
|
||||
@changing="volumechange" class="custom-slider" />
|
||||
|
||||
|
||||
</view>
|
||||
@ -245,13 +245,13 @@
|
||||
} from '@/utils/request.js'
|
||||
|
||||
import Common from '@/utils/Common.js';
|
||||
import {
|
||||
MsgSuccess,
|
||||
MsgError,
|
||||
MsgClose,
|
||||
MsgWarning,
|
||||
showPop,
|
||||
MsgInfo
|
||||
import {
|
||||
MsgSuccess,
|
||||
MsgError,
|
||||
MsgClose,
|
||||
MsgWarning,
|
||||
showPop,
|
||||
MsgInfo
|
||||
} from '@/utils/MsgPops.js'
|
||||
|
||||
const pagePath = "/pages/018A/HBY018A";
|
||||
@ -377,14 +377,7 @@
|
||||
// console.log("收到父页面的参数:" + JSON.stringify(data));
|
||||
var device = data.data;
|
||||
these.device = device;
|
||||
let f = ble.data.LinkedList.find((v) => {
|
||||
if (v.macAddress == device.deviceMac) {
|
||||
// console.log("找到设备了", v);
|
||||
these.formData.deviceId = v.deviceId;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
let f = these.getDevice();
|
||||
if (!f) {
|
||||
|
||||
|
||||
@ -407,10 +400,10 @@
|
||||
these.formData.deviceId = f.deviceId;
|
||||
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
||||
these.formData.bleStatu = true;
|
||||
}).catch(ex => {
|
||||
these.formData.bleStatu = 'err';
|
||||
MsgError("连接错误:" + ex.msg, "确定", these);
|
||||
});;
|
||||
}).catch(ex => {
|
||||
these.formData.bleStatu = 'err';
|
||||
MsgError("连接错误:" + ex.msg, "确定", these);
|
||||
});;
|
||||
|
||||
these.setBleFormData();
|
||||
|
||||
@ -424,17 +417,17 @@
|
||||
},
|
||||
onShow() {
|
||||
this.Status.pageHide = false;
|
||||
let f = this.getDevice();
|
||||
if (f) {
|
||||
these.formData.bleStatu = 'connecting';
|
||||
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
||||
console.log("连接成功")
|
||||
these.formData.bleStatu = true;
|
||||
}).catch(ex => {
|
||||
these.formData.bleStatu = 'err';
|
||||
MsgError("连接错误:" + ex.msg, "确定", these);
|
||||
});;
|
||||
}
|
||||
let f = this.getDevice();
|
||||
if (f) {
|
||||
these.formData.bleStatu = 'connecting';
|
||||
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
||||
console.log("连接成功")
|
||||
these.formData.bleStatu = true;
|
||||
}).catch(ex => {
|
||||
these.formData.bleStatu = 'err';
|
||||
MsgError("连接错误:" + ex.msg, "确定", these);
|
||||
});;
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
||||
@ -555,7 +548,7 @@
|
||||
buttonText: '确定',
|
||||
buttonCancelText: '取消',
|
||||
showCancel: true
|
||||
},these);
|
||||
}, these);
|
||||
} else {
|
||||
exec();
|
||||
}
|
||||
@ -582,7 +575,7 @@
|
||||
this.formData.sta_highSpeed = flag;
|
||||
},
|
||||
LighSetting(item, index) { //灯光模式切换
|
||||
|
||||
|
||||
let val = item.key;
|
||||
if (item.key === this.formData.sta_LedType) {
|
||||
val = 'led_off';
|
||||
@ -671,7 +664,7 @@
|
||||
buttonText: '确定',
|
||||
buttonCancelText: '取消',
|
||||
showCancel: true
|
||||
},these);
|
||||
}, these);
|
||||
|
||||
},
|
||||
deviceRecovry(res) {
|
||||
@ -680,7 +673,7 @@
|
||||
}
|
||||
if (res.deviceId == these.formData.deviceId) {
|
||||
this.formData.bleStatu = true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
@ -731,7 +724,7 @@
|
||||
updateLoading(these, {
|
||||
text: ex.msg
|
||||
});
|
||||
these.formData.bleStatu = 'err';
|
||||
these.formData.bleStatu = 'err';
|
||||
}).finally(() => {
|
||||
setTimeout(() => {
|
||||
hideLoading(these);
|
||||
@ -803,12 +796,23 @@
|
||||
|
||||
getDevice: function() {
|
||||
|
||||
// console.log("LinkedList=", ble.data.LinkedList);
|
||||
// console.log("formData=", these.formData);
|
||||
let f = ble.data.LinkedList.find((v) => {
|
||||
return v.macAddress == these.device.deviceMac;
|
||||
let flag = v.macAddress == these.device.deviceMac;
|
||||
if (!flag && v.device) {
|
||||
flag = v.device.id == these.device.id;
|
||||
}
|
||||
if (flag) {
|
||||
these.formData.deviceId = v.deviceId;
|
||||
}
|
||||
return flag;
|
||||
});
|
||||
|
||||
// #ifdef WEB
|
||||
f = {
|
||||
deviceId: '123'
|
||||
}
|
||||
// #endif
|
||||
|
||||
return f;
|
||||
},
|
||||
|
||||
@ -834,7 +838,7 @@
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
buttonText: '去连接',
|
||||
buttonTextColor: '#FFFFFFde',
|
||||
buttonTextColor: '#FFFFFFde',
|
||||
okCallback: function() {
|
||||
|
||||
uni.navigateTo({
|
||||
@ -856,10 +860,10 @@
|
||||
}
|
||||
})
|
||||
}
|
||||
},these);
|
||||
}, these);
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//关闭某个弹窗,并执行关闭的回调函数
|
||||
@ -883,7 +887,7 @@
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
|
||||
showMsg(msg, type) {
|
||||
|
||||
let cfg = {
|
||||
@ -922,7 +926,7 @@
|
||||
buttonText: '确定',
|
||||
okCallback: this.closePop
|
||||
};
|
||||
showPop(options,these);
|
||||
showPop(options, these);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1401,7 +1405,7 @@
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.slider-container {
|
||||
@ -1846,6 +1850,4 @@
|
||||
.volMath {
|
||||
color: rgba(174, 214, 0, 1);
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user