Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Litemall
Commits
b93b341c
You need to sign in or sign up before continuing.
Commit
b93b341c
authored
Apr 18, 2021
by
linlinjava
Committed by
Gitee
Apr 18, 2021
Browse files
!60 feat:小程序登录、用户信息相关接口调整.
Merge pull request !60 from yy/feature_20210416_update_wxapi
parents
7c099e64
19f88395
Changes
2
Hide whitespace changes
Inline
Side-by-side
litemall-wx/pages/auth/login/login.js
View file @
b93b341c
...
...
@@ -24,25 +24,21 @@ Page({
},
wxLogin
:
function
(
e
)
{
if
(
e
.
detail
.
userInfo
==
undefined
)
{
app
.
globalData
.
hasLogin
=
false
;
util
.
showErrorToast
(
'
微信登录失败
'
);
return
;
}
user
.
checkLogin
().
catch
(()
=>
{
user
.
loginByWeixin
(
e
.
detail
.
userInfo
).
then
(
res
=>
{
app
.
globalData
.
hasLogin
=
true
;
wx
.
navigateBack
({
delta
:
1
})
}).
catch
((
err
)
=>
{
app
.
globalData
.
hasLogin
=
false
;
util
.
showErrorToast
(
'
微信登录失败
'
);
});
wx
.
getUserProfile
({
desc
:
'
用于完善会员资料
'
,
success
:
(
res
)
=>
{
user
.
loginByWeixin
(
res
.
userInfo
).
then
(
res
=>
{
app
.
globalData
.
hasLogin
=
true
;
wx
.
navigateBack
({
delta
:
1
})
}).
catch
((
err
)
=>
{
app
.
globalData
.
hasLogin
=
false
;
util
.
showErrorToast
(
'
微信登录失败
'
);
});
}
})
});
},
accountLogin
:
function
()
{
...
...
litemall-wx/pages/auth/login/login.wxml
View file @
b93b341c
<view class="container">
<view class="login-box">
<button type="primary" open-type="getUser
Info
" class="wx-login-btn" bind
getuserinfo
="wxLogin">微信直接登录</button>
<button type="primary" open-type="getUser
Profile
" class="wx-login-btn" bind
tap
="wxLogin">微信直接登录</button>
<button type="primary" class="account-login-btn" bindtap="accountLogin">账号登录</button>
</view>
</view>
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment