Переглянути джерело

feature: 处理ios输入框,自动填充密码,获取不到值的问题

332777428@qq.com 2 місяців тому
батько
коміт
4a9ba044d7

+ 24 - 13
pages/pageB/deviceConnect1/deviceConnect1.js

@@ -41,23 +41,29 @@ 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);
-    }
+    var that = this;
+    console.log("onBlur", event);
+    // var value = event.detail.value;
+    // if (value !== that.data.pwdData) {
+    //   that.setData({
+    //     pwdData: value,
+    //   });
+    // }
   },
+
   ///Wifi名称
   setPwd: function (e) {
     console.log("设置密码:", e.detail.value)
     var that = this;
-    constant.app.globalData.pwdData = e.detail.value;
     that.setData({
       pwdData: e.detail.value,
     });
@@ -123,17 +129,18 @@ Page({
       return;
     };
 
-    // if (that.data.pwdData === "") {
-    //   wx.showToast({
-    //     title: '请输入WIFI密码',
-    //     icon: 'none',
-    //     duration: 2000
-    //   })
-    //   return;
-    // };
+    if (that.data.pwdData === "") {
+      wx.showToast({
+        title: '请输入WIFI密码',
+        icon: 'none',
+        duration: 2000
+      })
+      return;
+    };
 
     constant.app.globalData.ssid = that.data.ssid;
     constant.app.globalData.pwdData = that.data.pwdData;
+    console.log("gadsfadfqwer==aaa=" + constant.app.globalData.pwdData);
 
     var param = "?param=" + that.data.connectDevice;
     constant.routeUtil.jumpParam(constant.routePath.deviceConnect2, param);
@@ -152,4 +159,8 @@ Page({
     })
   },
 
+  onUnload: function () {
+    var that = this;
+  },
+
 })

+ 6 - 3
pages/pageB/deviceConnect1/deviceConnect1.wxml

@@ -7,11 +7,14 @@
   </view>
   <view class="wifiInfo">
     <view class="ssid">
-      <input placeholder="请输入WIFI名称" bindinput="setSsid" type="text" value="{{ssid}}" maxlength="30" />
+      <input placeholder="请输入WIFI名称" bindinput="setSsid" type="text" value="{{ssid}}" maxlength="30" focus="false" />
     </view>
     <view class="ssid pwd" maxlength="30">
-      <input wx:if="{{!isShowPwd}}" class="notShow" bindinput="setPwd" bindfocus="onFocus" bindblur="onBlur" password="true" placeholder="请输入WiFi密码" value="{{pwdData}}" />
-      <input wx:else class="isShow" bindinput="setPwd" placeholder="请输入WiFi密码" value="{{pwdData}}" />
+
+      <input wx:if="{{!isShowPwd}}" id="passwordInput" class="notShow" bindinput="setPwd" bindfocus="onFocus" bindblur="onBlur" password="true" placeholder="请输入WiFi密码" value="{{pwdData}}" />
+
+      <input wx:else class="isShow" bindinput="setPwd" placeholder="请输入WiFi密码" value="{{pwdData}}" bindfocus="onFocus" bindblur="onBlur" />
+
       <view class="yz" bindtap="showPwd">
         <image mode="widthFix" src="./../../../img/yj{{isShowPwd ? '1' : '0'}}.png"></image>
       </view>

+ 8 - 3
pages/pageB/deviceConnect1/deviceConnect1.wxss

@@ -3,7 +3,12 @@
   padding: 0 66rpx;
 }
 
-.deviceRoter1 .wifiInfo > view.ssid {
+.fake-password {
+  /* 自定义密文样式 */
+  -webkit-text-security: disc;
+}
+
+.deviceRoter1 .wifiInfo>view.ssid {
   width: calc(100vw - 136rpx);
   height: 96rpx;
   border-radius: 48rpx;
@@ -14,7 +19,7 @@
   justify-content: center;
 }
 
-.deviceRoter1 .wifiInfo > view.ssid input {
+.deviceRoter1 .wifiInfo>view.ssid input {
   width: calc(100% - 104rpx);
   height: 98rpx;
   line-height: 98rpx;
@@ -59,4 +64,4 @@
   line-height: 48rpx;
   color: #FA5151;
   width: calc(100% - 68rpx);
-}
+}

+ 2 - 1
pages/pageB/deviceConnect2/deviceConnect2.js

@@ -192,7 +192,8 @@ Page({
 
     var name = devicesList[0].name;
     var deviceId = devicesList[0].deviceId;
-    console.log("gadsfqwerqwerq==00==" + name + "===" + deviceId);
+
+    console.log("获取蓝牙BLE名称和小程序mac地址=" + name + "=====" + deviceId);
     var isJungzheng1 = junzhengUtil.isJungzheng1(name);
     var isJungzheng2 = junzhengUtil.isJungzheng2(name);