Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
csbr-daop
/
fe-data-trusted-space
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
c4d5a5f7
authored
2025-04-28 14:48:50 +0800
by
lihua
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
尝试解决登录成功后又报token过期重新登录的问题
1 parent
423e0317
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
9 deletions
src/App.vue
src/store/modules/user.ts
src/views/data_asset/qualityEvaluate.vue
src/views/data_asset/valueEvaluate.vue
src/App.vue
View file @
c4d5a5f
...
...
@@ -56,14 +56,22 @@ onMounted(() => {
hotkeys
(
'alt+i'
,
()
=>
{
eventBus
.
emit
(
'global-system-info-toggle'
)
})
//判断token的过期时间。
if
(
!
route
.
fullPath
?.
includes
(
'?code='
))
{
if
(
!
window
.
location
?.
href
?.
includes
(
'?code='
))
{
userStore
.
refreshUserToken
();
}
else
{
localStorage
.
setItem
(
'token'
,
''
);
localStorage
.
setItem
(
'code'
,
''
);
localStorage
.
setItem
(
'state'
,
''
);
localStorage
.
setItem
(
'refresh_token'
,
""
);
localStorage
.
setItem
(
'expiresIn'
,
''
);
}
})
import
.
meta
.
env
.
VITE_APP_DEBUG_TOOL
===
'eruda'
&&
eruda
.
init
()
onUnmounted
(()
=>
{
window
.
onresize
=
null
})
</
script
>
<
template
>
...
...
src/store/modules/user.ts
View file @
c4d5a5f
...
...
@@ -82,9 +82,9 @@ const useUserStore = defineStore(
});
}
function
refreshUserToken
(
isExec
=
true
)
{
async
function
refreshUserToken
(
isExec
=
true
)
{
let
expiresIn
=
localStorage
.
getItem
(
'expiresIn'
);
if
(
!
expiresIn
)
{
if
(
!
expiresIn
||
(
parseInt
(
expiresIn
)
-
Date
.
now
())
<
0
)
{
return
;
}
const
process
=
async
()
=>
{
...
...
@@ -98,7 +98,9 @@ const useUserStore = defineStore(
}
}
}
isExec
&&
process
();
if
(
isExec
)
{
await
process
();
}
/** 轮询是否需要刷新token。如果是同步多个调用,则不处理错误的信息。 */
setInterval
(
async
()
=>
{
process
();
...
...
src/views/data_asset/qualityEvaluate.vue
View file @
c4d5a5f
...
...
@@ -119,7 +119,8 @@ const searchItemList = ref([
{
label
:
'审批中'
,
value
:
'A'
},
{
label
:
'已通过'
,
value
:
'Y'
},
{
label
:
'已驳回'
,
value
:
'R'
},
{
label
:
'已撤销'
,
value
:
'C'
}
{
label
:
'已撤销'
,
value
:
'C'
},
{
label
:
'--'
,
value
:
'null'
}
],
clearable
:
true
},
...
...
@@ -144,7 +145,8 @@ const getTableData = () => {
pageSize
:
page
.
value
.
limit
,
pageIndex
:
page
.
value
.
curr
,
daName
:
page
.
value
.
daName
,
approveState
:
page
.
value
.
approveState
,
isApprove
:
page
.
value
.
approveState
==
'null'
?
'N'
:
''
,
approveState
:
page
.
value
.
approveState
==
'null'
?
null
:
page
.
value
.
approveState
,
currentStaffGuid
:
userData
.
staffGuid
}).
then
((
res
:
any
)
=>
{
tableInfo
.
value
.
loading
=
false
...
...
src/views/data_asset/valueEvaluate.vue
View file @
c4d5a5f
...
...
@@ -109,6 +109,7 @@ const searchItemList = ref([
{
label
:
'已通过'
,
value
:
'Y'
},
{
label
:
'已驳回'
,
value
:
'R'
},
{
label
:
'已撤销'
,
value
:
'C'
},
{
label
:
'--'
,
value
:
'null'
}
],
clearable
:
true
},
...
...
@@ -133,7 +134,8 @@ const getTableData = () => {
pageSize
:
page
.
value
.
limit
,
pageIndex
:
page
.
value
.
curr
,
daName
:
page
.
value
.
daName
,
approveState
:
page
.
value
.
approveState
,
isApprove
:
page
.
value
.
approveState
==
'null'
?
'N'
:
''
,
approveState
:
page
.
value
.
approveState
==
'null'
?
null
:
page
.
value
.
approveState
,
currentStaffGuid
:
userData
.
staffGuid
}).
then
((
res
:
any
)
=>
{
tableInfo
.
value
.
loading
=
false
;
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment