Commit 4514653a authored by linlinjava's avatar linlinjava
Browse files

Merge branch 'master' of https://gitee.com/linlinjava/litemall

parents aac2cffc b93b341c
...@@ -24,17 +24,12 @@ Page({ ...@@ -24,17 +24,12 @@ Page({
}, },
wxLogin: function(e) { wxLogin: function(e) {
if (e.detail.userInfo == undefined) {
app.globalData.hasLogin = false;
util.showErrorToast('微信登录失败');
return;
}
user.checkLogin().catch(() => { user.checkLogin().catch(() => {
wx.getUserProfile({
user.loginByWeixin(e.detail.userInfo).then(res => { desc: '用于完善会员资料',
success: (res) => {
user.loginByWeixin(res.userInfo).then(res => {
app.globalData.hasLogin = true; app.globalData.hasLogin = true;
wx.navigateBack({ wx.navigateBack({
delta: 1 delta: 1
}) })
...@@ -42,7 +37,8 @@ Page({ ...@@ -42,7 +37,8 @@ Page({
app.globalData.hasLogin = false; app.globalData.hasLogin = false;
util.showErrorToast('微信登录失败'); util.showErrorToast('微信登录失败');
}); });
}
})
}); });
}, },
accountLogin: function() { accountLogin: function() {
......
<view class="container"> <view class="container">
<view class="login-box"> <view class="login-box">
<button type="primary" open-type="getUserInfo" class="wx-login-btn" bindgetuserinfo="wxLogin">微信直接登录</button> <button type="primary" open-type="getUserProfile" class="wx-login-btn" bindtap="wxLogin">微信直接登录</button>
<button type="primary" class="account-login-btn" bindtap="accountLogin">账号登录</button> <button type="primary" class="account-login-btn" bindtap="accountLogin">账号登录</button>
</view> </view>
</view> </view>
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment