蓝牙小优化,App隐藏时断开设备连接
This commit is contained in:
@ -16,7 +16,7 @@
|
||||
|
||||
|
||||
|
||||
<view class="eq" :style="{marginTop:Status.navbar.height+'px'}">
|
||||
<view class="eq" >
|
||||
<view class="leftImg" @click.stop="previewImg(device.devicePic?device.devicePic:formData.img)">
|
||||
<image class="img" :src="device.devicePic?device.devicePic:formData.img" mode="aspectFit"></image>
|
||||
</view>
|
||||
@ -561,6 +561,15 @@
|
||||
},
|
||||
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;
|
||||
});
|
||||
}
|
||||
},
|
||||
onHide: function() {
|
||||
this.Status.pageHide = true;
|
||||
@ -634,9 +643,9 @@
|
||||
|
||||
},
|
||||
deviceDispose(res) {
|
||||
if (this.Status.pageHide) {
|
||||
return;
|
||||
}
|
||||
// if (this.Status.pageHide) {
|
||||
// return;
|
||||
// }
|
||||
if (res.deviceId == these.formData.deviceId) {
|
||||
if(res.device){
|
||||
these.formData.bleStatu = 'connecting';
|
||||
@ -1871,7 +1880,7 @@
|
||||
var gotoCutImg = (imgPath) => {
|
||||
|
||||
uni.navigateTo({
|
||||
url: "/pages/ImgCrop/ImgCrop",
|
||||
url: "/pages/common/ImgCrop/ImgCrop",
|
||||
events: {
|
||||
ImgCutOver: function(data) {
|
||||
// console.log("我收到裁剪后的图片了,感谢老铁," + data)
|
||||
|
||||
Reference in New Issue
Block a user