Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
take_order
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
和慭琛
take_order
Commits
00ac6488
Commit
00ac6488
authored
May 19, 2021
by
Damon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
降低检查token有效期频率
parent
ce49bcff
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
App.vue
take-order/App.vue
+8
-2
No files found.
take-order/App.vue
View file @
00ac6488
...
...
@@ -150,8 +150,13 @@ export default {
},
onShow
:
function
()
{
const
loginTime
=
cache
.
getCache
(
'loginTime'
)
const
validityTime
=
3600000
*
24
*
7
// 7天检查一次token是否过期
if
(
util
.
getToken
())
{
this
.
loginCheck
()
if
(
Date
.
now
()
-
loginTime
>
validityTime
)
{
// 超过有效期,检查token是否过期
this
.
loginCheck
()
}
}
else
{
this
.
autoLogin
()
}
...
...
@@ -391,7 +396,8 @@ export default {
// 如果已经登录则直接获取相关信息
util
.
setOpenid
(
userInfo
.
wxopenid
)
util
.
setToken
(
userInfo
.
token
)
uni
.
setStorageSync
(
'user-info'
,
userInfo
);
uni
.
setStorageSync
(
'user-info'
,
userInfo
);
uni
.
setStorageSync
(
'loginTime'
,
new
Date
())
}
else
{
util
.
setToken
(
''
)
}
...
...
Write
Preview
Markdown
is supported
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