zhaoxiaohai před 3 roky
rodič
revize
6530e4bcd5
3 změnil soubory, kde provedl 36 přidání a 3 odebrání
  1. 26 0
      pages/login/phone.js
  2. 2 1
      pages/login/phone.json
  3. 8 2
      pages/login/phone.wxml

+ 26 - 0
pages/login/phone.js

@@ -26,6 +26,32 @@ Page({
         })
         this.allowOrNot()
     },
+    /* 微信登录 */
+    wechatLogin() {
+        if (!this.data.isAgree) return Toast({
+            message: '请阅读并勾选用户协议',
+            position: 'bottom'
+        });
+        wx.login({
+            success(res) {
+                if (res.code) {
+                    _Http.loginbywechat({
+                        wechat_code: res.code,
+                        "systemclient": "wechatsaletool"
+                    }).then(res => {
+                        console.log(res)
+                        if (res.code == 0) return wx.showToast({
+                            title: res.msg,
+                            icon: "none"
+                        })
+                        loginMsg.loginMsg(res);
+                    })
+                } else {
+                    console.log('登录失败!' + res.errMsg)
+                }
+            }
+        })
+    },
     /* 用户登录 */
     userLogin() {
         if (this.data.loading || this.data.disabled) return;

+ 2 - 1
pages/login/phone.json

@@ -2,6 +2,7 @@
     "navigationBarTitleText": "账户登录",
     "usingComponents": {
         "Agreement": "./modules/agreement",
-        "van-checkbox": "@vant/weapp/checkbox/index"
+        "van-checkbox": "@vant/weapp/checkbox/index",
+        "van-divider": "@vant/weapp/divider/index"
     }
 }

+ 8 - 2
pages/login/phone.wxml

@@ -1,4 +1,4 @@
-<view style="height: 420rpx;" />
+<view style="height: 340rpx;" />
 <van-cell>
     <text slot='icon' class="iconfont icon-a-biaoqianlanwodexuanzhong" />
     <input class="input" type="text" value='{{accountno}}' bindinput="inputPhone" placeholder="请输入账户名" />
@@ -19,4 +19,10 @@
     <van-button disabled='{{disabled}}' custom-class='login' bindtap="userLogin" loading='{{loading}}' loading-text="登陆中..." color='linear-gradient(90deg, #3874F6 0%, #095DE0 100%);'>登录</van-button>
 </view>
 <Agreement isAgree='{{isAgree}}' bindcallBack='agreementChange' />
-<van-toast id="van-toast" />
+<van-toast id="van-toast" />
+
+<view style="height: 100rpx;" />
+<van-divider contentPosition="center">其他登录方式</van-divider>
+<view style="width: 100%; text-align: center;">
+    <text class="iconfont icon-a-wodebangdingweixin" style="font-size: 100rpx; color:#07C160;" bindtap="wechatLogin" />
+</view>