登录和绑定微信的完善,我的页面需要登录验证

This commit is contained in:
姚亚男
2021-10-18 17:39:06 +08:00
parent 78715f6712
commit 78f894957a
9 changed files with 150 additions and 127 deletions
+9 -5
View File
@@ -13,9 +13,9 @@ Page({
form: {
currdatetime: '',
requestCodeSuccess: true,
randCodeImage: '', // 验证码
rsaPublicKey: '', // 公钥
randCodeImage: '' // 验证码
},
rsaPublicKey: '', // 公钥
flag: false
},
@@ -108,8 +108,11 @@ Page({
if(this.data.flag){
UserApi.passWordLogin(params).then(res => {
if(res.success){
// 微信绑定
this.wxBind()
// 如果绑定过微信就不再进行绑定
if(!res.result.userInfo.openId){
// 绑定微信
this.wxBindPhone()
}
// 存token和userInfo
wx.setStorage({
key: 'X-Access-Token',
@@ -137,7 +140,8 @@ Page({
},
// 绑定微信
wxBind(){
wxBindPhone(){
const that = this
// 获取openid进行手机号和微信的绑定
wxBind((res)=>{
let params = {