|
@@ -288,12 +288,24 @@
|
|
|
startSearchWifi() {
|
|
|
wx.showLoading({title:'设备初始化获取WiFi中...'})
|
|
|
this.wifiList = [];
|
|
|
+ let that = this;
|
|
|
uni.startWifi({
|
|
|
success: (res) => {
|
|
|
console.log('初始化WiFi模块成功', res);
|
|
|
this.getWifiList();
|
|
|
},
|
|
|
fail: (err) => {
|
|
|
+ wx.hideLoading();
|
|
|
+ wx.showModal({
|
|
|
+ title: '温馨提示',
|
|
|
+ content: '初始化WiFi模块失败,请确保已打开手机WiFi。',
|
|
|
+ showCancel: false,
|
|
|
+ success: (res) => {
|
|
|
+ if(res.confirm){
|
|
|
+ that.startSearchWifi(); // 尝试重新初始化
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
console.error('startWifi fail:', err);
|
|
|
}
|
|
|
});
|