Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
sys-sdk
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Jira
Jira
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ui
sys-sdk
Commits
6e0bc319
Commit
6e0bc319
authored
Aug 07, 2025
by
shida.liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 更新token过期时间
parent
e58c1e18
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
+12
-12
http.js
lib/http.js
+12
-12
No files found.
lib/http.js
View file @
6e0bc319
...
@@ -113,12 +113,12 @@ const openWindow = url => {
...
@@ -113,12 +113,12 @@ const openWindow = url => {
};
};
/**
/**
* 验证token是否超过
5
小时
* 验证token是否超过
24
小时
* **/
* **/
const
checkTokenTimeOut
5
Hours
=
()
=>
{
const
checkTokenTimeOut
24
Hours
=
()
=>
{
const
tokenTime
=
+
localStorage
.
get
(
'
token-time
'
);
const
tokenTime
=
+
localStorage
.
get
(
"
token-time
"
);
const
now
=
new
Date
().
getTime
();
const
now
=
new
Date
().
getTime
();
return
now
-
tokenTime
>
5
*
60
*
60
*
1000
;
return
now
-
tokenTime
>
24
*
60
*
60
*
1000
;
};
};
/**
/**
...
@@ -131,22 +131,22 @@ const refreshTokenTimeOut = debounce(() => {
...
@@ -131,22 +131,22 @@ const refreshTokenTimeOut = debounce(() => {
/**
/**
* token 过期处理函数
* token 过期处理函数
* token过期超过
5
小时,直接跳转登录页
* token过期超过
24
小时,直接跳转登录页
* 未超过
5
小时,弹窗提示跳转新标签页登录
* 未超过
24
小时,弹窗提示跳转新标签页登录
* **/
* **/
const
showLoginPopups
=
debounce
(()
=>
{
const
showLoginPopups
=
debounce
(()
=>
{
let
href
=
window
.
location
.
href
;
let
href
=
window
.
location
.
href
;
href
=
href
.
replace
(
/
\?
token=
[
a-z0-9
\-
A-Z
]
+/g
,
''
);
href
=
href
.
replace
(
/
\?
token=
[
a-z0-9
\-
A-Z
]
+/g
,
''
);
href
=
instance
.
_extend
.
loginUrl
+
'
?url=
'
+
window
.
btoa
(
href
);
href
=
instance
.
_extend
.
loginUrl
+
'
?url=
'
+
window
.
btoa
(
href
);
if
(
checkTokenTimeOut
5
Hours
()
||
!
instance
.
_extend
.
modal
)
{
if
(
checkTokenTimeOut
24
Hours
()
||
!
instance
.
_extend
.
modal
)
{
window
.
location
.
href
=
href
;
window
.
location
.
href
=
href
;
}
else
{
}
else
{
instance
.
_extend
.
modal
.
confirm
({
instance
.
_extend
.
modal
.
confirm
({
title
:
'
会话过期
'
,
title
:
"
会话过期
"
,
content
:
'
当前会话已过期,请重新登录。
'
,
content
:
"
当前会话已过期,请重新登录。
"
,
okText
:
'
登录
'
,
okText
:
"
登录
"
,
cancelText
:
'
关闭
'
,
cancelText
:
"
关闭
"
,
onOk
:
function
()
{
onOk
:
function
()
{
openWindow
(
href
);
openWindow
(
href
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
showLoginResultPopups
();
showLoginResultPopups
();
...
...
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