修复有时候蓝牙配对成功依然提示未连接的异常
This commit is contained in:
@ -45,34 +45,34 @@
|
||||
<view class="title">
|
||||
<text>照明模式</text>
|
||||
<text @click="showLihgtPercent('shuxie')"
|
||||
:class="formData.lightCurr=='shuxie'?'active':'noActive'">亮度</text>
|
||||
:class="formData.lightCurr=='shuxie'?'active':'noActive'">亮度</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<view class="lightMode">
|
||||
<view class="item" @click="lightSetting('shuxie')" @longpress="showLihgtPercent('shuxie')"
|
||||
:class="formData.lightCurr=='shuxie'?'active':''">
|
||||
:class="formData.lightCurr=='shuxie'?'active':''">
|
||||
<view class="imgContent center">
|
||||
<image class="img"
|
||||
:src="formData.lightCurr=='shuxie'?'/static/images/6331/shuxieActive.png':'/static/images/6331/shuXie.png'"
|
||||
mode="aspectFit"></image>
|
||||
:src="formData.lightCurr=='shuxie'?'/static/images/6331/shuxieActive.png':'/static/images/6331/shuXie.png'"
|
||||
mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="txt">书写</view>
|
||||
</view>
|
||||
<view class="item" @click="lightSetting('work')" :class="formData.lightCurr=='work'?'active':''">
|
||||
<view class="imgContent center">
|
||||
<image class="img"
|
||||
:src="formData.lightCurr=='work'?'/static/images/6331/workActive.png':'/static/images/6331/work.png'"
|
||||
mode="aspectFit"></image>
|
||||
:src="formData.lightCurr=='work'?'/static/images/6331/workActive.png':'/static/images/6331/work.png'"
|
||||
mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="txt">工作光</view>
|
||||
</view>
|
||||
<view class="item" @click="lightSetting('jieN')" :class="formData.lightCurr=='jieN'?'active':''">
|
||||
<view class="imgContent center">
|
||||
<image class="img"
|
||||
:src="formData.lightCurr=='jieN'?'/static/images/lightImg/jieNActive.png':'/static/images/lightImg/jieN.png'"
|
||||
mode="aspectFit"></image>
|
||||
:src="formData.lightCurr=='jieN'?'/static/images/lightImg/jieNActive.png':'/static/images/lightImg/jieN.png'"
|
||||
mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="txt">节能光</view>
|
||||
</view>
|
||||
@ -130,7 +130,7 @@
|
||||
</view>
|
||||
|
||||
<view class="mode fleft marginLeft noMargintop" :class="formData.cMode?'active':''"
|
||||
v-on:click.stop="audioManage()">
|
||||
v-on:click.stop="audioManage()">
|
||||
<view class="leftImg">
|
||||
<image class="img" src="/static/images/6331/upload.png" mode="aspectFit"></image>
|
||||
</view>
|
||||
@ -153,15 +153,15 @@
|
||||
</view>
|
||||
|
||||
|
||||
<ProParams :id="device.id"></ProParams>
|
||||
<ProParams :id="device.id"></ProParams>
|
||||
|
||||
<!-- 弹窗通知 -->
|
||||
<MessagePopup :visible="Status.Pop.showPop" :type="Status.Pop.popType" :bgColor="Status.Pop.bgColor"
|
||||
:borderColor="Status.Pop.borderColor" :textColor="Status.Pop.textColor"
|
||||
:buttonBgColor="Status.Pop.buttonBgColor" :buttonTextColor="Status.Pop.buttonTextColor"
|
||||
:iconUrl="Status.Pop.iconUrl" :message="Status.Pop.message" :buttonText="Status.Pop.buttonText"
|
||||
@buttonClick="HidePop" :visiblePrompt="Status.Pop.visiblePrompt" :promptTitle="Status.Pop.promptTitle"
|
||||
v-model="Status.Pop.modelValue" @closePop="closePop" :showSlot="Status.Pop.showSlot">
|
||||
:borderColor="Status.Pop.borderColor" :textColor="Status.Pop.textColor"
|
||||
:buttonBgColor="Status.Pop.buttonBgColor" :buttonTextColor="Status.Pop.buttonTextColor"
|
||||
:iconUrl="Status.Pop.iconUrl" :message="Status.Pop.message" :buttonText="Status.Pop.buttonText"
|
||||
@buttonClick="HidePop" :visiblePrompt="Status.Pop.visiblePrompt" :promptTitle="Status.Pop.promptTitle"
|
||||
v-model="Status.Pop.modelValue" @closePop="closePop" :showSlot="Status.Pop.showSlot">
|
||||
|
||||
<view :class="Status.showLightingSet?'':'displayNone'">
|
||||
<view class="slideTitle">
|
||||
@ -170,8 +170,8 @@
|
||||
</view>
|
||||
<view class="slider-container">
|
||||
<slider min="1" max="100" step="1" :disabled="false" :value="formData.liangDu" activeColor="#bbe600"
|
||||
backgroundColor="#00000000" block-size="20" block-color="#ffffffde" @change="sliderChange"
|
||||
@changing="sliderChange" class="custom-slider" />
|
||||
backgroundColor="#00000000" block-size="20" block-color="#ffffffde" @change="sliderChange"
|
||||
@changing="sliderChange" class="custom-slider" />
|
||||
|
||||
</view>
|
||||
</view>
|
||||
@ -183,8 +183,8 @@
|
||||
</view>
|
||||
<view class="slider-container">
|
||||
<slider min="1" max="100" step="1" :disabled="false" :value="formData.volume" activeColor="#bbe600"
|
||||
backgroundColor="#00000000" block-size="20" block-color="#ffffffde" @change="sliderChange"
|
||||
@changing="sliderChange" class="custom-slider" />
|
||||
backgroundColor="#00000000" block-size="20" block-color="#ffffffde" @change="sliderChange"
|
||||
@changing="sliderChange" class="custom-slider" />
|
||||
|
||||
</view>
|
||||
</view>
|
||||
@ -193,7 +193,7 @@
|
||||
|
||||
<!-- 下方菜单 -->
|
||||
<BottomSlideMenuPlus :config="Status.BottomMenu" @close="closeMenu" @itemClick="handleItemClick"
|
||||
@btnClick="btnClick">
|
||||
@btnClick="btnClick">
|
||||
<view>
|
||||
<view class="addIco">
|
||||
<view class="icoContent center" v-on:click.stop="checkImgUpload()">
|
||||
@ -218,17 +218,19 @@
|
||||
hideLoading,
|
||||
updateLoading
|
||||
} from '@/utils/loading.js'
|
||||
import request, { baseURL } from '@/utils/request.js';
|
||||
import request, {
|
||||
baseURL
|
||||
} from '@/utils/request.js';
|
||||
|
||||
import usrApi from '@/api/670/HBY670.js';
|
||||
import {
|
||||
MsgSuccess,
|
||||
MsgError,
|
||||
MsgClose,
|
||||
MsgWarning,
|
||||
showPop,
|
||||
MsgInfo
|
||||
} from '@/utils/MsgPops.js'
|
||||
import {
|
||||
MsgSuccess,
|
||||
MsgError,
|
||||
MsgClose,
|
||||
MsgWarning,
|
||||
showPop,
|
||||
MsgInfo
|
||||
} from '@/utils/MsgPops.js'
|
||||
const pagePath = "pages/6331/BJQ6331";
|
||||
|
||||
var ble = null;
|
||||
@ -360,14 +362,7 @@ import request, { baseURL } from '@/utils/request.js';
|
||||
// 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) {
|
||||
|
||||
|
||||
@ -388,15 +383,15 @@ import request, { baseURL } from '@/utils/request.js';
|
||||
}
|
||||
these.formData.blename = f.name ? f.name : "Unname";
|
||||
these.formData.deviceName = device.deviceName;
|
||||
|
||||
|
||||
|
||||
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();
|
||||
these.getDetail();
|
||||
|
||||
@ -409,17 +404,17 @@ import request, { baseURL } from '@/utils/request.js';
|
||||
},
|
||||
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: {
|
||||
|
||||
@ -467,7 +462,7 @@ import request, { baseURL } from '@/utils/request.js';
|
||||
modelValue: '',
|
||||
visibleClose: true,
|
||||
okCallback: play
|
||||
},these);
|
||||
}, these);
|
||||
},
|
||||
audioManage() { //语音管理
|
||||
uni.navigateTo({
|
||||
@ -597,7 +592,7 @@ import request, { baseURL } from '@/utils/request.js';
|
||||
iconUrl: "/static/images/common/uploadErr.png",
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
},these);
|
||||
}, these);
|
||||
});
|
||||
|
||||
},
|
||||
@ -608,7 +603,7 @@ import request, { baseURL } from '@/utils/request.js';
|
||||
}
|
||||
if (res.deviceId == these.formData.deviceId) {
|
||||
this.formData.bleStatu = true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
@ -617,9 +612,9 @@ import request, { baseURL } from '@/utils/request.js';
|
||||
// return;
|
||||
//}
|
||||
if (res.deviceId == these.formData.deviceId) {
|
||||
if(res.device){
|
||||
if (res.device) {
|
||||
these.formData.bleStatu = 'connecting';
|
||||
}else{
|
||||
} else {
|
||||
this.formData.bleStatu = false;
|
||||
}
|
||||
setTimeout(() => {
|
||||
@ -663,7 +658,7 @@ import request, { baseURL } from '@/utils/request.js';
|
||||
updateLoading(these, {
|
||||
text: ex.msg
|
||||
});
|
||||
these.formData.bleStatu = 'err';
|
||||
these.formData.bleStatu = 'err';
|
||||
}).finally(() => {
|
||||
setTimeout(() => {
|
||||
hideLoading(these);
|
||||
@ -693,12 +688,23 @@ import request, { baseURL } from '@/utils/request.js';
|
||||
},
|
||||
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;
|
||||
},
|
||||
getDetail() {
|
||||
@ -733,7 +739,7 @@ import request, { baseURL } from '@/utils/request.js';
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
buttonText: '去连接',
|
||||
buttonTextColor: '#FFFFFFde',
|
||||
buttonTextColor: '#FFFFFFde',
|
||||
okCallback: function() {
|
||||
|
||||
uni.navigateTo({
|
||||
@ -755,7 +761,7 @@ import request, { baseURL } from '@/utils/request.js';
|
||||
}
|
||||
})
|
||||
}
|
||||
},these);
|
||||
}, these);
|
||||
|
||||
|
||||
|
||||
@ -763,7 +769,7 @@ import request, { baseURL } from '@/utils/request.js';
|
||||
|
||||
},
|
||||
|
||||
|
||||
|
||||
closePop: function() {
|
||||
this.Status.Pop.showPop = false;
|
||||
|
||||
@ -1155,7 +1161,7 @@ import request, { baseURL } from '@/utils/request.js';
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.slider-container {
|
||||
|
||||
Reference in New Issue
Block a user