提交 58a5f169 authored 作者: haodaking's avatar haodaking

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

上级 fc318ba7
...@@ -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 => {
// 获取用户信息 const { encryptedData, iv } = user
this.getUserInfo(user => { // 获取code
const { encryptedData, iv } = user this.getCode(code => {
api.wechatLogin({ encryptedData, iv, code, identity: 'ciis-mini' }).then(response => { api.wechatLogin({ encryptedData, iv, code, identity: 'ciis-mini' }).then(response => {
if (response.code === 0) { if (response.code === 0) {
this.handleSuccess(response.data) this.handleSuccess(response.data)
...@@ -69,9 +70,7 @@ Page({ ...@@ -69,9 +70,7 @@ Page({
wx.showModal({ title: '账号不存在', content: '是否要成为学员', showCancel: true }).then(res => { wx.showModal({ title: '账号不存在', content: '是否要成为学员', showCancel: true }).then(res => {
res.confirm && res.confirm &&
wx.navigateTo({ wx.navigateTo({
url: `/pages/web/index?url=${encodeURIComponent( url: `/pages/web/index?url=${encodeURIComponent('https://webapp-pub.ezijing.com/pages/ciis/ciis.html?channel_num=96091')}`
'https://webapp-pub.ezijing.com/pages/ciis/ciis.html?channel_num=96091'
)}`
}) })
}) })
} else { } else {
......
...@@ -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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论