Ver código fonte

登录修复登录方式

xyg 2 anos atrás
pai
commit
632245c687

+ 20 - 0
light-application-wx/pages/login/login.js

@@ -18,6 +18,8 @@ Page({
         grant_type: "password",
         longitude: null,
         latitude: null,
+        showPwd: false,
+        loginType: '密码登录'
     },
 
     /**
@@ -436,6 +438,24 @@ Page({
                 util.toast('获取设备系统类型失败');
             }
         });
+    },
+
+    /**
+     * 点击切换登录方式
+     */
+    changeType: function () {
+        let f = this.data.showPwd;
+        if (f) {
+            this.setData({
+                showPwd: false,
+                loginType: '密码登录'
+            });
+        } else {
+            this.setData({
+                showPwd: true,
+                loginType: '验证码登录'
+            });
+        }
     }
 
 })

+ 9 - 1
light-application-wx/pages/login/login.wxml

@@ -9,11 +9,19 @@
                 <image class="login-phone" mode="heightFix" src="{{imgPath}}/login-phone.png"></image>
                 <input type="number" class="login-input" name="phone" maxlength="11" placeholder="请输入手机号" placeholder-style="color:#fff" bindinput="setPhone" />
             </view>
-            <view class="login-row">
+            <view class="login-row" wx:if="{{!showPwd}}">
                 <image class="login-phone" mode="heightFix" src="{{imgPath}}/login-verify.png"></image>
                 <input type="number" class="login-input" name="code" maxlength="6" style="width: 50%;" placeholder="请输入验证码" placeholder-style="color:#fff" bindinput="setVcode" />
                 <text class="send_btn" bindtap="getVerifyCode">{{sendText}}</text>
             </view>
+            <view class="login-row" wx:if="{{showPwd}}">
+                <image class="login-phone" mode="heightFix" src="{{imgPath}}/login-pwd.png"></image>
+                <input type="text" password="true" class="login-input" name="password" maxlength="20" placeholder="请输入密码" placeholder-style="color:#fff" />
+            </view>
+            <view class="login-type">
+                <view></view>
+                <view bindtap="changeType">{{loginType}}</view>
+            </view>
             <button class="login-btn" formType="submit" style="background-image: url({{imgPath}}/login-btn.png);">登录</button>
         </form>
     </view>

+ 12 - 5
light-application-wx/pages/login/login.wxss

@@ -17,7 +17,7 @@
     padding: 0 80rpx;
     width: 100%;
     box-sizing: border-box;
-    margin-top: 110rpx;
+    margin-top: 60rpx;
 }
 
 form {
@@ -35,10 +35,7 @@ form {
     padding-bottom: 16rpx;
     padding-left: 24rpx;
     box-sizing: border-box;
-}
-
-.login-row:nth-child(2) {
-    margin-top: 70rpx;
+    margin-top: 50rpx;
 }
 
 .login-phone {
@@ -59,6 +56,16 @@ form {
     position: absolute;
     margin-left: 30rpx;
     right: 90rpx;
+    font-size: .9rem;
+}
+
+.login-type {
+    color: #FFFFFFAA;
+    font-size: .9rem;
+    margin-top: 30rpx;
+    display: flex;
+    flex-direction: row;
+    justify-content: space-between;
 }
 
 .login-btn {