python学习

This commit is contained in:
2020-11-20 14:06:42 +08:00
parent 51fd976127
commit ea0e57b9f2
7 changed files with 548 additions and 458 deletions

View File

@@ -20,10 +20,22 @@ async function checkHasLogined() {
}
async function login(page){
const _this = this
wx.login({
success: function (res) {
WXAPI.login_wx(res.code).then(function (res) {
// 必须是在用户已经授权的情况下调用
let code = res.code; // 微信登录接口返回的 code 参数,下面注册接口需要用到
wx.getUserInfo({
success: function (res) {
var userInfo = res.userInfo
var nickName = userInfo.nickName
var avatarUrl = userInfo.avatarUrl
var gender = userInfo.gender //性别 0未知、1男、2
var province = userInfo.province
var city = userInfo.city
var country = userInfo.country
WXAPI.login_wx(res.code,nickName,avatarUrl,gender,province,city,country).then(function (res) {
if (res.code == 10000) {
// 去注册
//_this.register(page)
@@ -44,6 +56,10 @@ async function login(page){
page.onShow()
}
})
}
})
}
})
}