手机好授权

This commit is contained in:
zoujiandong 2023-12-19 16:53:12 +08:00
parent a36ff7e890
commit a3ad5139b3
2 changed files with 43 additions and 33 deletions

View File

@ -129,6 +129,7 @@ Page({
let THIS=this;
let usertype = wx.getStorageSync('usertype');
let next_url = wx.getStorageSync('next_url');
if(e.detail.errMsg == 'getPhoneNumber:ok'){
wx.login({
success (res) {
if (res.code) {
@ -161,5 +162,14 @@ Page({
}
}
})
}else if(e.detail.errMsg == 'getPhoneNumber:fail user deny'){
console.log('您拒绝手机号授权')
}else{
wx.showToast({
title: '手机号授权失败',
icon:'none'
})
}
},
})

View File

@ -18,11 +18,11 @@
wx:if="{{ checked }}"
open-type="getPhoneNumber"
bindgetphonenumber="getPhoneNumber"
color="#09BB07" custom-style="font-size: 36rpx;" type="primary" round block>微信授权手机号登录</van-button>
color="#09BB07" custom-style="font-size: 36rpx;" type="primary" round block>手机号快捷登录</van-button>
<van-button
wx:else
bindtap="getPhoneNumber"
color="#09BB07" custom-style="font-size: 36rpx;" type="primary" round block>微信授权手机号登录</van-button>
color="#09BB07" custom-style="font-size: 36rpx;" type="primary" round block>手机号快捷登录</van-button>
<view style="display: flex;margin-top: 30rpx;line-height: 50rpx;">
<van-checkbox value="{{ checked }}" bind:change="onChange"></van-checkbox>