优化配网没反应 增加配网没反应超时处理
This commit is contained in:
parent
2033c9c985
commit
0492af2a8f
|
@ -678,7 +678,7 @@
|
||||||
// 将去重后的数组重新赋值给 this.devicesList
|
// 将去重后的数组重新赋值给 this.devicesList
|
||||||
this.devicesList = uniqueDevicesList
|
this.devicesList = uniqueDevicesList
|
||||||
let list = []
|
let list = []
|
||||||
filteredDevices.forEach(device => {
|
uniqueDevicesList.forEach(device => {
|
||||||
// 从设备名称中提取 MAC 地址(假设 MAC 地址是设备名称的后6个字符)
|
// 从设备名称中提取 MAC 地址(假设 MAC 地址是设备名称的后6个字符)
|
||||||
let macFromName = device.name.substring(device.name.length - 12)
|
let macFromName = device.name.substring(device.name.length - 12)
|
||||||
this.$u.get(`/app/device/${macFromName}/isBind`).then((res) => {
|
this.$u.get(`/app/device/${macFromName}/isBind`).then((res) => {
|
||||||
|
|
|
@ -540,6 +540,20 @@
|
||||||
xBlufi.notifySendCustomData({
|
xBlufi.notifySendCustomData({
|
||||||
customData: "ssid@" + this.ssid + "pass@" + this.password
|
customData: "ssid@" + this.ssid + "pass@" + this.password
|
||||||
})
|
})
|
||||||
|
setTimeout(()=>{
|
||||||
|
if(this.textwifi != '连接'){
|
||||||
|
uni.showModal({
|
||||||
|
title: '温馨提示',
|
||||||
|
content: '配网失败,请重新操作',
|
||||||
|
showCancel: false,
|
||||||
|
success: function(res) {
|
||||||
|
uni.switchTab({
|
||||||
|
url:'/pages/index/index'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},20000)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
@ -572,11 +586,26 @@
|
||||||
if (!options.result)
|
if (!options.result)
|
||||||
this.textwifi = '连接',
|
this.textwifi = '连接',
|
||||||
this.statusflag = false,
|
this.statusflag = false,
|
||||||
uni.hideLoading(),
|
// uni.hideLoading(),
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '温馨提示',
|
title: '温馨提示',
|
||||||
content: '配网失败,请选择2.4GWiFi连接并确保密码正确',
|
content: '配网失败,请选择2.4GWiFi连接并确保密码正确',
|
||||||
showCancel: false //是否显示取消按钮
|
showCancel: false ,//是否显示取消按钮
|
||||||
|
success:function(res) {
|
||||||
|
let systemInfo = uni.getSystemInfoSync();
|
||||||
|
if (systemInfo.platform == 'android') {
|
||||||
|
// 当前设备是 Android
|
||||||
|
uni.navigateBack()
|
||||||
|
} else if (systemInfo.platform == 'ios') {
|
||||||
|
// 当前设备是 iOS
|
||||||
|
uni.navigateBack({
|
||||||
|
delta:2
|
||||||
|
})
|
||||||
|
}
|
||||||
|
wx.closeBLEConnection({
|
||||||
|
deviceId: this.objlist.deviceId,
|
||||||
|
})
|
||||||
|
}
|
||||||
});
|
});
|
||||||
else {
|
else {
|
||||||
if (options.data.progress == 100) {
|
if (options.data.progress == 100) {
|
||||||
|
@ -589,6 +618,7 @@
|
||||||
content: `连接成功`,
|
content: `连接成功`,
|
||||||
showCancel: false,
|
showCancel: false,
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
|
uni.hideLoading()
|
||||||
let systemInfo = uni.getSystemInfoSync();
|
let systemInfo = uni.getSystemInfoSync();
|
||||||
if (systemInfo.platform == 'android') {
|
if (systemInfo.platform == 'android') {
|
||||||
// 当前设备是 Android
|
// 当前设备是 Android
|
||||||
|
@ -625,9 +655,6 @@
|
||||||
console.log('初始化成功');
|
console.log('初始化成功');
|
||||||
} else {
|
} else {
|
||||||
console.log('初始化失败');
|
console.log('初始化失败');
|
||||||
wx.closeBLEConnection({
|
|
||||||
deviceId: this.objlist.deviceId,
|
|
||||||
})
|
|
||||||
// uni.showModal({
|
// uni.showModal({
|
||||||
// title: '温馨提示',
|
// title: '温馨提示',
|
||||||
// content: `设备初始化失败,请重新连接`,
|
// content: `设备初始化失败,请重新连接`,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user