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
67b386de
Commit
67b386de
authored
Mar 31, 2018
by
Junling Bu
Browse files
fix[litemall-wx]: 当后台服务返回未登录信息时,清除当前的登录相关信息。
parent
3e443506
Changes
1
Hide whitespace changes
Inline
Side-by-side
litemall-wx/utils/util.js
View file @
67b386de
var
api
=
require
(
'
../config/api.js
'
);
var
app
=
getApp
();
function
formatTime
(
date
)
{
var
year
=
date
.
getFullYear
()
...
...
@@ -36,7 +37,16 @@ function request(url, data = {}, method = "GET") {
if
(
res
.
statusCode
==
200
)
{
if
(
res
.
data
.
errno
==
401
)
{
//需要登录后才可以操作
// 清除登录相关内容
try
{
wx
.
removeStorageSync
(
'
userInfo
'
);
wx
.
removeStorageSync
(
'
token
'
);
}
catch
(
e
)
{
// Do something when catch error
}
// 重置app的未登录状态
app
.
globalData
.
hasLogin
=
false
;
// 切换到登录页面
wx
.
navigateTo
({
url
:
'
/pages/auth/login/login
'
});
...
...
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