Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kww_dayDayGetCredits_250512
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
SparkProjects
kww_dayDayGetCredits_250512
Commits
d4f0f3bf
Commit
d4f0f3bf
authored
May 12, 2025
by
haiyoucuv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parent
996b00fa
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
109 additions
and
111 deletions
+109
-111
bg.jpg
src/assets/LoadingPage/bg.jpg
+0
-0
loadingBg.jpg
src/assets/LoadingPage/loadingBg.jpg
+0
-0
loadingFill.png
src/assets/LoadingPage/loadingFill.png
+0
-0
loadingIp.png
src/assets/LoadingPage/loadingIp.png
+0
-0
title.png
src/assets/LoadingPage/title.png
+0
-0
LoadingDemo.less
src/pages/LoadingDemo/LoadingDemo.less
+34
-37
LoadingDemo.tsx
src/pages/LoadingDemo/LoadingDemo.tsx
+75
-74
No files found.
src/assets/LoadingPage/bg.jpg
0 → 100644
View file @
d4f0f3bf
192 KB
src/assets/LoadingPage/loadingBg.jpg
deleted
100644 → 0
View file @
996b00fa
13.3 KB
src/assets/LoadingPage/loadingFill.png
deleted
100644 → 0
View file @
996b00fa
2.84 KB
src/assets/LoadingPage/loadingIp.png
deleted
100644 → 0
View file @
996b00fa
107 KB
src/assets/LoadingPage/title.png
0 → 100644
View file @
d4f0f3bf
76.6 KB
src/pages/LoadingDemo/LoadingDemo.less
View file @
d4f0f3bf
...
...
@@ -3,52 +3,39 @@
.loading {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
top: 50%;
width: 750px;
height: 1624px;
transform: translateY(-50%);
.webpBg("LoadingPage/loadingBg.jpg");
.loading-ip {
.bg {
position: absolute;
left:
198px
;
top:
572-153px
;
width:
57
0px;
height:
508
px;
.webpBg("LoadingPage/
loadingIp.pn
g");
left:
0
;
top:
0
;
width:
75
0px;
height:
1624
px;
.webpBg("LoadingPage/
bg.jp
g");
}
.progressBarBg {
border-radius: 10px;
background-color: rgb(255, 255, 255);
position: absolute;
left: 82px;
top: 898-153px;
width: 590px;
height: 30px;
border-radius: 118px;
background: #FCE4D4;
border: 2px solid #FFFFFF;
left: 138px;
top: 899px;
width: 475px;
height: 21px;
}
.progressBar {
.progressBarFill {
background-color: rgb(254, 53, 74);
position: absolute;
left: 84px;
top: 900-153px;
width: 590px;
height: 30px;
overflow: hidden;
border-radius: 118px;
.progressBarFill {
position: absolute;
left: 0;
top: 0;
width: 590px;
height: 30px;
.webpBg("LoadingPage/loadingFill.png")
}
left: 140px;
top: 902px;
width: 470px;
height: 15px;
border-radius: 15px;
}
.progressTxt {
...
...
@@ -66,5 +53,15 @@
color: #999999;
}
}
.title {
position: fixed;
left: 67px;
top: 49px;
width: 613px;
height: 208px;
.webpBg("LoadingPage/title.png");
}
src/pages/LoadingDemo/LoadingDemo.tsx
View file @
d4f0f3bf
...
...
@@ -8,80 +8,81 @@ import HomePage from "@/pages/HomePage/HomePage.tsx";
@
observer
class
LoadingDemo
extends
React
.
Component
{
state
=
{
curPercentage
:
0
}
curPercentage
=
0
;
intervalId
:
number
=
0
;
componentDidMount
()
{
this
.
preloadAssetInit
();
// this.jump();
}
/**
* 资源预加载
*/
preloadAssetInit
=
async
()
=>
{
const
files
=
import
.
meta
.
glob
(
"../../assets/**/*"
,
{
import
:
"default"
,
eager
:
true
,
});
const
urls
=
Object
.
values
(
files
)
as
string
[];
await
preload
(
urls
,
(
progress
,
loaded
,
total
)
=>
{
const
percentage
=
Math
.
floor
(
progress
*
100
);
this
.
setEvenProgress
(
percentage
);
});
};
jump
=
()
=>
{
setTimeout
(()
=>
{
PageCtrl
.
changePage
(
HomePage
);
// 跳转页面
},
100
);
};
/**
* 以1%匀速加载进度
* @param {*} percentage
*/
setEvenProgress
=
(
percentage
)
=>
{
this
.
intervalId
&&
clearInterval
(
this
.
intervalId
);
let
curPercentage
=
this
.
curPercentage
;
this
.
intervalId
=
window
.
setInterval
(()
=>
{
if
(
curPercentage
>=
percentage
)
{
clearInterval
(
this
.
intervalId
);
this
.
jump
();
return
;
}
curPercentage
+=
1
;
this
.
curPercentage
=
curPercentage
;
this
.
setState
({
curPercentage
,
});
},
10
);
};
render
()
{
const
{
curPercentage
}
=
this
.
state
;
return
<
div
className=
"loading"
>
<
div
className=
"loading-ip"
/>
<
div
className=
"progressBarBg"
/>
<
div
className=
"progressBar"
>
<
div
className=
"progressBarFill"
style=
{
{
transform
:
`translateX(${curPercentage - 100}%)`
}
}
/>
</
div
>
<
span
className=
"progressTxt"
>
金豆正在路上......
{
curPercentage
}
%
</
span
>
</
div
>;
}
state
=
{
curPercentage
:
0
}
curPercentage
=
0
;
intervalId
:
number
=
0
;
componentDidMount
()
{
this
.
preloadAssetInit
();
// this.jump();
}
/**
* 资源预加载
*/
preloadAssetInit
=
async
()
=>
{
const
files
=
import
.
meta
.
glob
(
"../../assets/**/*"
,
{
import
:
"default"
,
eager
:
true
,
});
const
urls
=
Object
.
values
(
files
)
as
string
[];
await
preload
(
urls
,
(
progress
,
loaded
,
total
)
=>
{
const
percentage
=
Math
.
floor
(
progress
*
100
);
this
.
setEvenProgress
(
percentage
);
});
};
jump
=
()
=>
{
setTimeout
(()
=>
{
PageCtrl
.
changePage
(
HomePage
);
// 跳转页面
},
100
);
};
/**
* 以1%匀速加载进度
* @param {*} percentage
*/
setEvenProgress
=
(
percentage
)
=>
{
this
.
intervalId
&&
clearInterval
(
this
.
intervalId
);
let
curPercentage
=
this
.
curPercentage
;
this
.
intervalId
=
window
.
setInterval
(()
=>
{
if
(
curPercentage
>=
percentage
)
{
clearInterval
(
this
.
intervalId
);
this
.
jump
();
return
;
}
curPercentage
+=
1
;
this
.
curPercentage
=
curPercentage
;
this
.
setState
({
curPercentage
,
});
},
10
);
};
render
()
{
const
{
curPercentage
}
=
this
.
state
;
return
<>
<
div
className=
"loading"
>
<
div
className=
"bg"
/>
<
div
className=
"progressBarBg"
/>
<
div
className=
"progressBarFill"
style=
{
{
width
:
`${curPercentage / 100 * 4.7}rem`
}
}
/>
{
/*<span className="progressTxt">金豆正在路上...... {curPercentage}%</span>*/
}
</
div
>
<
div
className=
"title"
/>
</>;
}
}
export
default
LoadingDemo
;
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