|
@@ -36,9 +36,10 @@ Page({
|
|
},
|
|
},
|
|
getConnectedWifi: function () {
|
|
getConnectedWifi: function () {
|
|
const that = this;
|
|
const that = this;
|
|
- let wifiDic = store.getStore("wifiInfo")
|
|
|
|
- let wifiName = wifiDic.wifiName
|
|
|
|
- let pwd = wifiDic.wifiPassword
|
|
|
|
|
|
+ let wifiDic = store.getStore("wifiInfo") ?? "{}";
|
|
|
|
+ let json = JSON.parse(wifiDic)
|
|
|
|
+ let wifiName = json.ssid
|
|
|
|
+ let pwd = json.password
|
|
// if (wifiName && pwd) {
|
|
// if (wifiName && pwd) {
|
|
if (wifiName) {
|
|
if (wifiName) {
|
|
console.log("获取Wi-Fi信息", wifiName, pwd);
|
|
console.log("获取Wi-Fi信息", wifiName, pwd);
|
|
@@ -180,25 +181,17 @@ Page({
|
|
// icon: 'none'
|
|
// icon: 'none'
|
|
// })
|
|
// })
|
|
if (name === EnumCmdEvent.otaWifi && otaCmd === 1) {
|
|
if (name === EnumCmdEvent.otaWifi && otaCmd === 1) {
|
|
- store.setStore("wifiInfo", {
|
|
|
|
- wifiName: _this.data.wifiName,
|
|
|
|
- wifiPassword: _this.data.wifiPassword
|
|
|
|
|
|
+ let json = JSON.stringify({
|
|
|
|
+ "password": _this.data.wifiPassword,
|
|
|
|
+ "ssid": _this.data.wifiName
|
|
})
|
|
})
|
|
|
|
+ store.setStore("wifiInfo", json)
|
|
}
|
|
}
|
|
}, _this)
|
|
}, _this)
|
|
},
|
|
},
|
|
wifiPageSuccess() {
|
|
wifiPageSuccess() {
|
|
this.data._onNavigateBack = true
|
|
this.data._onNavigateBack = true
|
|
},
|
|
},
|
|
- // 获取保存的 Wi-Fi 账号和密码
|
|
|
|
- getSavedWiFiInfo() {
|
|
|
|
- const wifiName = wx.getStorageSync('wifiName') || '';
|
|
|
|
- const wifiPassword = wx.getStorageSync('wifiPassword');
|
|
|
|
- this.setData({
|
|
|
|
- wifiName: wifiName,
|
|
|
|
- wifiPassword: wifiPassword
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
onLoad: function (options) {
|
|
onLoad: function (options) {
|
|
let param = options.param ?? "{}";
|
|
let param = options.param ?? "{}";
|
|
let url = JSON.parse(param).url ?? "";
|
|
let url = JSON.parse(param).url ?? "";
|