|
@@ -43,9 +43,21 @@ Page({
|
|
|
is5GWifi: str
|
|
|
});
|
|
|
},
|
|
|
-
|
|
|
+ onFocus(event) {
|
|
|
+ console.log("onFocus:", event)
|
|
|
+ if (event.detail.value !== this.data.pwdData) {
|
|
|
+ this.setPwd(event);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onBlur(event) {
|
|
|
+ console.log("onBlur", event)
|
|
|
+ if (event.detail.value !== this.data.pwdData) {
|
|
|
+ this.setPwd(event);
|
|
|
+ }
|
|
|
+ },
|
|
|
///Wifi名称
|
|
|
setPwd: function (e) {
|
|
|
+ console.log("设置密码:", e.detail.value)
|
|
|
var that = this;
|
|
|
app.globalData.pwdData = e.detail.value;
|
|
|
that.setData({
|
|
@@ -81,11 +93,13 @@ Page({
|
|
|
app.globalData.ssid = ssid;
|
|
|
wx.getStorage({
|
|
|
key: 'wifiInfo',
|
|
|
- success(wifiInfo) {
|
|
|
- const resData = JSON.parse(wifiInfo.data);
|
|
|
+ success(wifiRes) {
|
|
|
+ console.log("wifiInfo:", wifiRes)
|
|
|
+ const resData = JSON.parse(wifiRes.data ?? "{}")?? {};
|
|
|
+ console.log("wifiInfo2:", resData)
|
|
|
if (resData.ssid === res.wifi.SSID) {
|
|
|
that.setData({
|
|
|
- pwdData: resData.password,
|
|
|
+ pwdData: resData.password ?? "",
|
|
|
});
|
|
|
}
|
|
|
}
|