明树Git Lab
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
J
jt_front
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
Administrator
jt_front
Commits
10974de1
Commit
10974de1
authored
Apr 14, 2026
by
zhanghan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
加上全局loading状态
parent
ba4efeac
Pipeline
#109752
passed with stage
in 20 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
index.html
index.html
+7
-0
index.js
src/router/index.js
+10
-0
No files found.
index.html
View file @
10974de1
...
@@ -7,6 +7,13 @@
...
@@ -7,6 +7,13 @@
<title>
葛洲坝交投
</title>
<title>
葛洲坝交投
</title>
</head>
</head>
<body>
<body>
<div
id=
"app-loading"
style=
"display:none;position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(255,255,255,0.7);z-index:9999;justify-content:center;align-items:center;"
>
<div
style=
"display:flex;flex-direction:column;align-items:center;gap:12px;"
>
<div
style=
"width:36px;height:36px;border:3px solid #e0e0e0;border-top-color:#409eff;border-radius:50%;animation:spin .6s linear infinite;"
></div>
<span
style=
"color:#666;font-size:14px;"
>
页面加载中...
</span>
</div>
</div>
<style>
@keyframes
spin
{
to
{
transform
:
rotate
(
360deg
)}}
</style>
<div
id=
"app"
></div>
<div
id=
"app"
></div>
<script
type=
"module"
src=
"/src/main.js"
></script>
<script
type=
"module"
src=
"/src/main.js"
></script>
</body>
</body>
...
...
src/router/index.js
View file @
10974de1
...
@@ -8,6 +8,10 @@ const router = createRouter({
...
@@ -8,6 +8,10 @@ const router = createRouter({
// 路由守卫 - 登录验证
// 路由守卫 - 登录验证
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
// 显示 loading
const
loadingEl
=
document
.
getElementById
(
'app-loading'
);
if
(
loadingEl
)
loadingEl
.
style
.
display
=
'flex'
;
const
userStore
=
useUserStore
();
const
userStore
=
useUserStore
();
let
token
=
userStore
.
authToken
||
sessionStorage
.
getItem
(
"authToken"
)
||
""
;
let
token
=
userStore
.
authToken
||
sessionStorage
.
getItem
(
"authToken"
)
||
""
;
if
(
!
token
)
{
if
(
!
token
)
{
...
@@ -25,4 +29,10 @@ router.beforeEach((to, from, next) => {
...
@@ -25,4 +29,10 @@ router.beforeEach((to, from, next) => {
}
}
})
})
router
.
afterEach
(()
=>
{
// 隐藏 loading
const
loadingEl
=
document
.
getElementById
(
'app-loading'
);
if
(
loadingEl
)
loadingEl
.
style
.
display
=
'none'
;
})
export
default
router
export
default
router
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