Commit af5ed6ad by zhangzhen

处理wifi连接相关

parent a69592a1
......@@ -120,7 +120,7 @@
<script>
import fTabbar from '@/components/module/f-tabbar/f-tabbar';
import {getUserInfo,loginOut} from "@/api/index.js"
import {getUserInfo,loginOut,systemConfig} from "@/api/index.js"
import config from "@/config/index.config"
import LoginPop from "@/components/login/login"
......@@ -178,8 +178,8 @@
}
},
onShow() {
this.onGetSysConfig();
this.onCheckUserLogin();
this.onGetSysConfig();
},
onLoad() {
// 隐藏原生的tabbar
......@@ -188,6 +188,21 @@
methods: {
onGetSysConfig(){
let sysConfigList = uni.getStorageSync('sysConfig')
if(!sysConfigList){
systemConfig().then(res=>{
if(res.data.code == 200){
uni.setStorage({
key:'sysConfig',
data: res.data.rows,
success: () => {
this.onGetSysConfig();
}
})
}
})
return;
}
let wifi = sysConfigList.find(item=>item.configKey === 'wechat.wifi')
if(wifi){
let w = wifi.configValue.split(';')
......@@ -254,7 +269,15 @@
phoneNumber:this.servicePhone
})
}else if(val == 2){
if(this.wifiData.name && this.wifiData.password){
this.$refs.popup.open()
}else{
uni.showToast({
icon:"none",
title:"无法进行WIFI连接"
})
}
}else if(val === 3){
uni.navigateTo({
url:'/pages/storeList/storeList'
......@@ -274,6 +297,8 @@
})
},
onConnectWifi(){
uni.startWifi({
success:()=>{
uni.connectWifi({
SSID:this.wifiData.name,
BSSID:this.wifiData.name,
......@@ -287,13 +312,15 @@
fail: (err) => {
uni.showToast({
icon:'none',
title:err.errMsg
title:"WIFI连接失败"
})
},
complete: (res) => {
console.log(res,909090)
}
})
}
})
},
onProview(){
uni.previewImage({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment