|
@@ -53,6 +53,17 @@
|
|
|
this.getCurrentWifi();
|
|
|
this.dealWifi(true)
|
|
|
},
|
|
|
+ onShow() {
|
|
|
+ let sysInfo = wx.getSystemInfoSync();
|
|
|
+ console.log(sysInfo,'sysInfo');
|
|
|
+ let platform = sysInfo.platform;
|
|
|
+ console.log(platform,'platform');
|
|
|
+ if(platform == "ios"){
|
|
|
+ wx.onGetWifiList(res => {
|
|
|
+ console.log(res,'res:onShow');
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
methods:{
|
|
|
getCurrentWifi(){
|
|
|
let that = this;
|
|
@@ -79,10 +90,14 @@
|
|
|
})
|
|
|
wx.startWifi({
|
|
|
success (res) {
|
|
|
+ console.log(res,'res');
|
|
|
wx.getWifiList({
|
|
|
success(res2) {
|
|
|
+ console.log(res2,'res2');
|
|
|
wx.onGetWifiList(res3 => {
|
|
|
let temp = [];
|
|
|
+ console.log(res3,'res3');
|
|
|
+ console.log(res3.wifiList,'res3.wifiList');
|
|
|
res3.wifiList.forEach(w=>{
|
|
|
if(w.SSID){
|
|
|
let exit = temp.find(t=>t.SSID===w.SSID);
|
|
@@ -95,8 +110,14 @@
|
|
|
uni.hideLoading();
|
|
|
})
|
|
|
})
|
|
|
+ },
|
|
|
+ fail: (err2) => {
|
|
|
+ console.log(err2,'err2');
|
|
|
}
|
|
|
})
|
|
|
+ },
|
|
|
+ fail: (err) => {
|
|
|
+ console.log(err,'err');
|
|
|
}
|
|
|
})
|
|
|
}else{
|
|
@@ -106,17 +127,26 @@
|
|
|
toSet(item){
|
|
|
let that = this;
|
|
|
if(item.SSID.indexOf('Xiaozhi-')>-1){
|
|
|
- uni.connectWifi({
|
|
|
+ uni.showLoading({
|
|
|
+ title:'热点连接中'
|
|
|
+ })
|
|
|
+ wx.connectWifi({
|
|
|
SSID: item.SSID,
|
|
|
password: '',
|
|
|
success: (resu) => {
|
|
|
- if(resu.errCode===0){
|
|
|
+ console.log(resu,'resu');
|
|
|
+ uni.hideLoading();
|
|
|
+ // if(resu.errCode===0||resu.errMsg==='connectWifi:ok'){
|
|
|
setTimeout(()=>{
|
|
|
uni.navigateTo({
|
|
|
url:'/pagesMy/wifiSet'
|
|
|
})
|
|
|
},2000)
|
|
|
- }
|
|
|
+ // }
|
|
|
+ },
|
|
|
+ fail: (err) => {
|
|
|
+ uni.hideLoading();
|
|
|
+ console.log(err,'err:connectWifi');
|
|
|
}
|
|
|
});
|
|
|
}else this.$showToast('请选择Xiaozhi开头的热点')
|