登录逻辑修改,扫码签到逻辑完善

This commit is contained in:
姚亚男
2021-10-14 20:04:19 +08:00
parent 2f3f9aba1d
commit 7895fc5191
26 changed files with 864 additions and 172 deletions
+27 -1
View File
@@ -86,6 +86,8 @@ Page({
wx.switchTab({
url: '../home/home',
})
// 绑定微信
this.wxBind()
} else {
wx.showToast({
title: '登录失败',
@@ -94,10 +96,34 @@ Page({
})
}
})
// 登录失败
}
},
// 绑定微信
wxBind(){
// 获取openid进行手机号和微信的绑定
wx.login({
success (res) {
if (res.code) {
//发起网络请求
wx.request({
url: 'https://api.weixin.qq.com/sns/jscode2session',
data: {
appid: 'wx24914e866df035fb',
secret: '0d2830f26f57722716249f2b2236f409',
js_code: res.code,
grant_type: 'authorization_code'
},
success (res) { // 成功拿到openId
// 微信和该账号绑定
}
})
} else {
console.log('授权失败!' + res.errMsg)
}
}
})
},
/**
* 生命周期函数--监听页面显示
*/