Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
华
华夏模拟理财_20250701
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
华夏模拟理财_20250701
Commits
2e903a73
Commit
2e903a73
authored
Jul 10, 2025
by
俞嘉婷
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 首页迭代
parent
3383a62d
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
166 additions
and
18 deletions
+166
-18
main.ts
mock/main.ts
+1
-1
virtual_assets_bg_new.png
src/assets/homePage/virtual_assets_bg_new.png
+0
-0
index.jsx
src/core/components/ComCountdown/index.jsx
+99
-0
index.less
src/core/components/ComCountdown/index.less
+4
-0
HomePage.less
src/pages/HomePage/HomePage.less
+36
-8
HomePage.tsx
src/pages/HomePage/HomePage.tsx
+24
-7
store.ts
src/store/store.ts
+2
-2
No files found.
mock/main.ts
View file @
2e903a73
...
...
@@ -51,7 +51,7 @@ export default [
data
:
{
actStartTime
:
Date
.
now
()
-
1
*
24
*
60
*
60
*
1000
,
actEndTime
:
Date
.
now
()
+
3
*
24
*
60
*
60
*
1000
,
myEndTime
:
Date
.
now
()
+
1
*
24
*
60
*
60
*
1000
,
endPoint
:
Date
.
now
()
+
0.000
1
*
24
*
60
*
60
*
1000
,
endPop
:
false
,
productEnd
:
true
,
uid
:
'234234'
,
...
...
src/assets/homePage/virtual_assets_bg_new.png
0 → 100644
View file @
2e903a73
7.94 KB
src/core/components/ComCountdown/index.jsx
0 → 100644
View file @
2e903a73
"use strict"
;
/** 前置补零 */
export
function
zeroize
(
num
,
n
=
2
)
{
let
len
=
num
.
toString
().
length
while
(
len
<
n
)
{
num
=
'0'
+
num
len
++
}
return
num
}
import
React
,
{
useEffect
,
useReducer
}
from
"react"
;
import
"./index.less"
;
const
initialState
=
{
time
:
{
day
:
0
,
hour
:
"00"
,
minute
:
"00"
,
second
:
"00"
,
},
};
function
reducer
(
state
,
action
)
{
switch
(
action
.
type
)
{
case
"change"
:
return
{
time
:
{
...
action
.
data
}
};
default
:
throw
new
Error
();
}
}
const
Countdown
=
(
props
)
=>
{
const
[
state
,
dispatch
]
=
useReducer
(
reducer
,
initialState
);
const
{
countdownOver
,
syst
,
endt
,
leftT
,
renderText
}
=
props
;
let
countdownTimer
=
null
;
const
setTimeFun
=
(
leftTime
)
=>
{
let
day
=
Math
.
floor
(
leftTime
/
(
3600
*
24
*
1000
));
let
hour
=
Math
.
floor
((
leftTime
/
1000
/
3600
)
%
24
);
let
minute
=
Math
.
floor
((
leftTime
/
1000
/
60
)
%
60
);
let
second
=
Math
.
floor
((
leftTime
/
1000
)
%
60
);
day
=
zeroize
(
day
);
hour
=
zeroize
(
hour
);
minute
=
zeroize
(
minute
);
second
=
zeroize
(
second
);
dispatch
({
type
:
"change"
,
data
:
{
day
,
hour
,
minute
,
second
}
});
}
const
countFun
=
()
=>
{
if
(
!
leftT
&&
(
!
syst
||
!
endt
))
{
return
;
}
let
leftTime
=
null
;
if
(
syst
&&
endt
)
{
leftTime
=
endt
-
syst
+
1000
;
}
else
{
leftTime
=
leftT
;
}
// console.log(leftTime, "leftTime");
if
(
leftTime
<=
0
)
return
;
setTimeFun
(
leftTime
)
countdownTimer
&&
clearInterval
(
countdownTimer
);
// setStatus(true);
countdownTimer
=
setInterval
(()
=>
{
leftTime
-=
1000
;
if
(
leftTime
<=
0
)
{
// 倒计时结束
clearInterval
(
countdownTimer
);
countdownOver
();
dispatch
({
type
:
"change"
,
data
:
{
day
:
"00"
,
hour
:
"00"
,
minute
:
"00"
,
second
:
"00"
},
});
}
else
{
setTimeFun
(
leftTime
)
}
},
1000
);
};
useEffect
(()
=>
{
countFun
(
syst
,
endt
);
return
()
=>
{
countdownTimer
&&
clearInterval
(
countdownTimer
);
};
},
[
syst
,
endt
,
leftT
]);
return
(
renderText
?
renderText
(
state
.
time
)
:
<
span
className=
"com_countdown"
>
{
state
.
time
.
day
==
"0"
?
""
:
`${state.time.day}天`
}
{
state
.
time
.
hour
}
:
{
state
.
time
.
minute
}
:
{
state
.
time
.
second
}
</
span
>
);
};
export
default
Countdown
;
src/core/components/ComCountdown/index.less
0 → 100644
View file @
2e903a73
.com_countdown {
font-size: 18px;
color: #fff;
}
src/pages/HomePage/HomePage.less
View file @
2e903a73
...
...
@@ -92,21 +92,48 @@
}
.virtual_assets {
width: 712px;
height:
440
px;
height:
513
px;
left: 19px;
// top: 1060px;
position: relative;
margin-top: 18px;
.sparkBg("homePage/virtual_assets_bg.png");
// .sparkBg("homePage/virtual_assets_bg.png");
.sparkBg("homePage/virtual_assets_bg_new.png");
&.short_height {
height: 330px;
.sparkBg("homePage/virtual_assets_bg_short.png");
}
.time_box {
width: 100%;
height: 40px;
position: absolute;
top: 20px;
left: 0;
display: flex;
align-items: center;
justify-content: flex-end;
color: rgb(153, 108, 0);
padding-right: 32px;
box-sizing: border-box;
font-size: 22px;
line-height: 40px;
.time_item {
width: 40px;
height: 40px;
border: 1px solid rgb(255, 255, 255);
box-sizing: border-box;
border-radius: 10px;
background-image: linear-gradient( 0deg, rgb(237,88,29) 0%, rgb(255,144,65) 100%);
.flex_center();
color: rgb(255, 255, 255);
margin: 0 4px;
}
}
.yesterday_label {
width: 153px;
height: 27px;
left: 30px;
top:
56
px;
top:
121
px;
position: absolute;
opacity: 0.6;
font-size: 26px;
...
...
@@ -117,7 +144,7 @@
width: 228px;
height: 56px;
left: 29px;
top: 1
06
px;
top: 1
71
px;
position: absolute;
font-size: 66px;
line-height: 56px;
...
...
@@ -128,7 +155,7 @@
width: 176px;
height: 24px;
left: 507px;
top:
56
px;
top:
121
px;
position: absolute;
.record_btn_text {
width: 162px;
...
...
@@ -155,7 +182,7 @@
width: 666px;
height: 70px;
left: 23px;
top: 2
03
px;
top: 2
68
px;
position: absolute;
.other_assets1 {
width: 195px;
...
...
@@ -207,7 +234,7 @@
width: 227px;
height: 50px;
left: 288px;
top:
146
px;
top:
211
px;
position: absolute;
.canuse_popover_bg {
width: 227px;
...
...
@@ -234,7 +261,7 @@
width: 302px;
height: 86px;
left: 205px;
top: 3
15
px;
top: 3
80
px;
position: absolute;
font-size: 35px;
line-height: 34px;
...
...
@@ -280,6 +307,7 @@
color: rgba(220, 80, 63, 1);
font-weight: bold;
.flex_center();
.breathAnimation();
}
.signed_btn {
width: 211px;
...
...
src/pages/HomePage/HomePage.tsx
View file @
2e903a73
...
...
@@ -12,6 +12,7 @@ import { diffJump, RATE_NAME } from '@/AppTools';
import
API
from
'@/api'
;
import
DetailPage
from
'../DetailPage/DetailPage'
;
import
ResPage
from
'../ResPage/ResPage'
;
import
Countdown
from
'@/core/components/ComCountdown/index.jsx'
;
@
observer
class
HomePage
extends
React
.
Component
<
any
,
any
>
{
...
...
@@ -93,8 +94,8 @@ class HomePage extends React.Component<any, any> {
if
(
item
.
days
>
checkIn
?.
totalCheckIn
)
return
false
if
(
!
store
.
judgeActTime
())
return
const
{
myEndTime
,
currentTime
}
=
store
.
indexData
||
{}
if
(
myEndTime
<=
currentTime
)
{
const
{
endPoint
,
currentTime
}
=
store
.
indexData
||
{}
if
(
endPoint
<=
currentTime
)
{
Toast
.
show
(
"模拟理财已结束~"
)
return
false
}
...
...
@@ -120,7 +121,7 @@ class HomePage extends React.Component<any, any> {
}
render
()
{
const
{
curTab
}
=
this
.
state
;
const
{
bigStartConfig
,
virtualAssets
,
checkIn
,
recommendProductConfig
,
productEnd
}
=
store
.
indexData
const
{
bigStartConfig
,
virtualAssets
,
checkIn
,
recommendProductConfig
,
productEnd
,
endPoint
,
currentTime
}
=
store
.
indexData
// 推荐产品
const
rProductList
=
recommendProductConfig
?.
filter
((
item
)
=>
+
item
.
status
===
0
)
// 我的持仓
...
...
@@ -151,8 +152,24 @@ class HomePage extends React.Component<any, any> {
</
div
>
}
{
/* 模拟资产 */
}
<
div
className=
{
`virtual_assets ${!virtualAssets?.realBuyJumpUrl ? 'short_height' : ''}`
}
>
<
span
className=
"yesterday_label"
>
昨日收益(元)
</
span
>
<
span
className=
"yesterday_amount"
>
{
this
.
settleMoney
(
virtualAssets
?.
preDayIncome
||
0
)
}
</
span
>
{
endPoint
>
currentTime
&&
<
Countdown
leftT=
{
endPoint
-
currentTime
}
renderText=
{
data
=>
{
const
{
day
,
hour
,
minute
,
second
}
=
data
return
<
div
className=
"time_box"
>
<
span
className=
"time_item"
>
{
day
}
</
span
>
天
<
span
className=
"time_item"
>
{
hour
}
</
span
>
时
<
span
className=
"time_item"
>
{
minute
}
</
span
>
分
<
span
className=
"time_item"
>
{
second
}
</
span
>
秒后失效
</
div
>
}
}
countdownOver=
{
()
=>
store
.
updateIndex
()
}
/>
}
<
span
className=
"yesterday_label"
>
累计收益(元)
</
span
>
<
span
className=
"yesterday_amount"
>
{
this
.
settleMoney
(
virtualAssets
?.
totalIncome
||
0
)
}
</
span
>
<
div
className=
"record_btn md6"
onClick=
{
this
.
recordHadnle
}
>
<
span
className=
"record_btn_text"
>
模拟交易记录
</
span
>
<
span
className=
"arrow_right"
></
span
>
...
...
@@ -167,8 +184,8 @@ class HomePage extends React.Component<any, any> {
<
span
className=
"other_assets_value"
>
{
this
.
settleMoney
(
virtualAssets
?.
availableFunds
||
0
)
}
</
span
>
</
div
>
<
div
className=
"other_assets3"
>
<
span
className=
"other_assets_label"
>
累计
收益
</
span
>
<
span
className=
"other_assets_value"
>
{
this
.
settleMoney
(
virtualAssets
?.
total
Income
||
0
)
}
</
span
>
<
span
className=
"other_assets_label"
>
昨日
收益
</
span
>
<
span
className=
"other_assets_value"
>
{
this
.
settleMoney
(
virtualAssets
?.
preDay
Income
||
0
)
}
</
span
>
</
div
>
</
div
>
<
div
className=
"canuse_popover"
>
...
...
src/store/store.ts
View file @
2e903a73
...
...
@@ -60,8 +60,8 @@ class Store {
actStartTime
?:
number
,
actEndTime
?:
number
,
currentTime
?:
number
,
// 前端自定义
//
我的终点时间
myEndTime
?:
number
,
//
终点倒计时时间戳
endPoint
?:
number
,
ruleText
?:
string
,
uid
?:
string
,
// 大明星配置
...
...
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