提交 9ed248a4 authored 作者: haodaking's avatar haodaking

小程序登录用户信息接口调整

上级 b4772ae8
...@@ -42,7 +42,8 @@ Page({ ...@@ -42,7 +42,8 @@ Page({
}, },
// 获取用户信息 // 获取用户信息
getUserInfo(callback) { getUserInfo(callback) {
wx.getUserInfo({ wx.getUserProfile({
desc: '登录注册',
success(res) { success(res) {
callback && callback(res) callback && callback(res)
}, },
...@@ -53,11 +54,11 @@ Page({ ...@@ -53,11 +54,11 @@ Page({
}, },
// 微信登录 // 微信登录
wechatLogin() { wechatLogin() {
// 获取code
this.getCode(code => {
// 获取用户信息 // 获取用户信息
this.getUserInfo(user => { this.getUserInfo(user => {
const { encryptedData, iv } = user const { encryptedData, iv } = user
// 获取code
this.getCode(code => {
api.wechatLogin({ encryptedData, iv, code, identity: 'sofia-mini' }).then(response => { api.wechatLogin({ encryptedData, iv, code, identity: 'sofia-mini' }).then(response => {
if (response.code === 0) { if (response.code === 0) {
this.handleSuccess(response.data) this.handleSuccess(response.data)
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
hover-class="none" hover-class="none"
class="login-button" class="login-button"
open-type="getUserInfo" open-type="getUserInfo"
bindgetuserinfo="wechatLogin" bindtap="wechatLogin"
> >
微信登录 微信登录
</button> </button>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论