Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
GeekLearnMathWeapp
Project
Project
Details
Activity
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
frontend
GeekLearnMathWeapp
Commits
fb7f17e8
Commit
fb7f17e8
authored
Mar 31, 2023
by
m
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: update
parent
a97f761d
Show whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
397 additions
and
142 deletions
+397
-142
app.config.ts.tpl
scripts/app.config.ts.tpl
+2
-1
index.tsx
src/components/Modal/index.tsx
+2
-2
avatar.tsx
src/components/Skeleton/components/avatar.tsx
+2
-2
paragraph.tsx
src/components/Skeleton/components/paragraph.tsx
+2
-2
title.tsx
src/components/Skeleton/components/title.tsx
+2
-2
index.tsx
src/components/Tabs/index.tsx
+2
-2
members.module.scss
src/pages/group/components/members.module.scss
+9
-19
members.tsx
src/pages/group/components/members.tsx
+46
-32
sign-in.module.scss
src/pages/group/components/sign-in.module.scss
+37
-0
sign-in.tsx
src/pages/group/components/sign-in.tsx
+26
-0
index.tsx
src/pages/group/index.tsx
+2
-2
index.tsx
src/pages/prepare/components/rank-list/index.tsx
+1
-1
timing.tsx
src/pages/prepare/components/rank-list/timing.tsx
+1
-2
user-info.tsx
src/pages/prepare/components/rank-list/user-info.tsx
+1
-2
study-league-rank.tsx
src/pages/prepare/components/study-league-rank.tsx
+1
-1
card.tsx
src/pages/study-market/components/card.tsx
+4
-4
challenge-failed.tsx
src/pages/summary/components/challenge-failed.tsx
+13
-0
challenge-success.tsx
src/pages/summary/components/challenge-success.tsx
+13
-0
glorys.module.scss
src/pages/summary/components/glorys.module.scss
+37
-0
glorys.tsx
src/pages/summary/components/glorys.tsx
+55
-0
score-result.module.scss
src/pages/summary/components/score-result.module.scss
+37
-0
score-result.tsx
src/pages/summary/components/score-result.tsx
+33
-0
score-stats.tsx
src/pages/summary/components/score-stats.tsx
+12
-0
index.module.scss
src/pages/summary/index.module.scss
+25
-28
index.tsx
src/pages/summary/index.tsx
+32
-40
No files found.
scripts/app.config.ts.tpl
View file @
fb7f17e8
...
...
@@ -7,10 +7,11 @@
export default {
pages: [
'pages/main/main',
'pages/group/index',
'pages/prepare/index',
'pages/study-market/index',
'pages/group/index',
'pages/game/play/index',
'pages/summary/index',
],
subPackages: {
{
packages
}
},
resizable: true,
...
...
src/components/Modal/index.tsx
View file @
fb7f17e8
...
...
@@ -13,7 +13,7 @@ interface ModalProps {
onClose
?:
()
=>
void
;
}
const
Modal
:
React
.
FC
<
ModalProps
>
=
({
const
Modal
=
({
isVisible
,
onClose
,
children
,
...
...
@@ -21,7 +21,7 @@ const Modal: React.FC<ModalProps> = ({
bodyClassName
,
coverNavigateBar
=
true
,
// z-index 层级高于原生的bar
maskClosable
=
true
})
=>
{
}
:
ModalProps
)
=>
{
const
wrapClass
=
classNames
(
styles
.
wrapper
,
wrapClassName
,
{
[
styles
.
visible
]:
isVisible
})
...
...
src/components/Skeleton/components/avatar.tsx
View file @
fb7f17e8
...
...
@@ -7,11 +7,11 @@ export interface SkeletonAvatarProps {
size
?:
number
;
}
const
SkeletonAvatar
:
React
.
FC
<
SkeletonAvatarProps
>
=
({
const
SkeletonAvatar
=
({
animate
=
true
,
shape
=
'circle'
,
size
=
48
,
})
=>
{
}
:
SkeletonAvatarProps
)
=>
{
const
avatarClass
=
classNames
(
'skeleton-avatar'
,
animate
?
'skeleton-loading'
:
null
,
...
...
src/components/Skeleton/components/paragraph.tsx
View file @
fb7f17e8
...
...
@@ -9,13 +9,13 @@ export interface SkeletonParagraphProps {
width
?:
string
|
number
|
(
string
|
number
)[];
}
const
SkeletonParagraph
:
React
.
FC
<
SkeletonParagraphProps
>
=
({
const
SkeletonParagraph
=
({
animate
=
true
,
rows
=
3
,
gap
=
8
,
height
=
16
,
width
=
'100%'
,
})
=>
{
}
:
SkeletonParagraphProps
)
=>
{
const
paragraphRows
=
Array
.
from
({
length
:
rows
},
(
_
,
i
)
=>
{
const
rowWidth
=
Array
.
isArray
(
width
)
?
width
[
i
]
??
width
[
width
.
length
-
1
]
...
...
src/components/Skeleton/components/title.tsx
View file @
fb7f17e8
...
...
@@ -7,11 +7,11 @@ export interface SkeletonTitleProps {
width
?:
string
|
number
;
}
const
SkeletonTitle
:
React
.
FC
<
SkeletonTitleProps
>
=
({
const
SkeletonTitle
=
({
animate
=
true
,
height
=
16
,
width
=
'30%'
,
})
=>
{
}
:
SkeletonTitleProps
)
=>
{
return
(
<
View
className=
{
classNames
(
'skeleton-title'
,
animate
?
'skeleton-loading'
:
null
)
}
...
...
src/components/Tabs/index.tsx
View file @
fb7f17e8
...
...
@@ -20,14 +20,14 @@ interface TabsProps {
onChange
?:
(
index
:
number
)
=>
void
;
}
const
Tabs
:
React
.
FC
<
TabsProps
>
=
({
const
Tabs
=
({
items
,
initialIndex
=
0
,
tabBarGutter
=
16
,
tabBarStyle
,
tabPanesStyle
,
onChange
,
})
=>
{
}
:
TabsProps
)
=>
{
const
[
activeIndex
,
setActiveIndex
]
=
useState
(
initialIndex
)
useEffect
(()
=>
{
...
...
src/pages/group/components/members.module.scss
View file @
fb7f17e8
...
...
@@ -2,35 +2,18 @@
.container
{
@include
flexLayout
(
column
);
.header
{
padding
:
16px
;
.title
{
font-size
:
64px
;
font-weight
:
500
;
}
.sign_in
{
@include
flexLayout
();
gap
:
16px
;
border
:
1px
solid
red
;
padding
:
12px
24px
;
&
_today
,
&
_invite
{
padding
:
8px
12px
;
border
:
1px
solid
red
;
border-radius
:
12px
;
}
}
}
.invite_members
{
position
:
absolute
;
width
:
100%
;
left
:
0
;
bottom
:
150px
;
padding-bottom
:
56
PX
;
@include
flexLayout
(
column
,
center
,
center
);
gap
:
16px
;
&
_btn
{
width
:
80%
;
...
...
@@ -39,5 +22,11 @@
padding
:
8px
16px
;
border-radius
:
4px
;
}
&
_info
{
margin-top
:
8
PX
;
gap
:
2
PX
;
@include
flexLayout
(
column
);
}
}
}
\ No newline at end of file
src/pages/group/components/members.tsx
View file @
fb7f17e8
import
{
useMemo
,
useState
,
useEffect
}
from
'react'
import
{
getSystemInfoSync
,
createSelectorQuery
}
from
'@tarojs/taro'
import
{
View
,
Button
,
Text
,
ScrollView
}
from
'@tarojs/components'
import
classNames
from
'classnames'
import
{
useBoolean
}
from
'@/hooks/use-boolean'
import
SignIn
from
'./sign-in'
import
styles
from
'./members.module.scss'
const
screenHeight
=
getSystemInfoSync
().
windowHeight
const
membersCls
=
'_members_const_'
const
Members
=
({
tabBarHeight
}:
{
tabBarHeight
:
number
})
=>
{
const
[
isRefresh
,
{
setTrue
,
setFalse
}]
=
useBoolean
(
false
)
cons
t
[
height
,
setHeight
]
=
useState
(
0
)
cons
ole
.
log
(
'-tabBarHeight'
,
tabBarHeight
)
const
onRefresh
=
()
=>
{
setTrue
()
...
...
@@ -21,29 +16,11 @@ const Members = ({ tabBarHeight }: { tabBarHeight: number }) => {
},
1000
)
}
useEffect
(()
=>
{
const
query
=
createSelectorQuery
()
query
.
selectAll
(
`.
${
membersCls
}
`
)
.
boundingClientRect
()
.
exec
((
res
)
=>
{
if
(
res
[
0
])
{
setHeight
(
res
[
0
]?.[
0
].
height
+
res
[
0
]?.[
1
].
height
*
1.2
)
}
})
},
[])
const
scrollHeight
=
useMemo
(()
=>
{
return
`
${
screenHeight
-
tabBarHeight
-
height
-
60
}
px`
},
[
screenHeight
,
tabBarHeight
,
height
])
return
(
<
View
className=
{
styles
.
container
}
>
<
View
className=
{
classNames
(
styles
.
header
,
membersCls
)
}
>
<
Text
className=
{
styles
.
title
}
>
阳光学习帮
</
Text
>
<
View
className=
{
styles
.
sign_in
}
>
<
Text
className=
{
styles
.
sign_in_today
}
>
今日部落津贴 +2
</
Text
>
<
Text
className=
{
styles
.
sign_in_invite
}
>
成功邀请1人 +100
</
Text
>
</
View
>
<
View
className=
{
styles
.
container
}
style=
{
{
height
:
`calc(100vh - ${tabBarHeight}px)`
}
}
>
<
View
className=
{
styles
.
header
}
>
<
Text
className=
"title"
>
阳光学习帮
</
Text
>
<
SignIn
/>
</
View
>
<
ScrollView
...
...
@@ -52,7 +29,7 @@ const Members = ({ tabBarHeight }: { tabBarHeight: number }) => {
refresherEnabled
refresherTriggered=
{
isRefresh
}
onRefresherRefresh=
{
onRefresh
}
style=
{
{
height
:
scrollHeight
}
}
style=
{
{
flexGrow
:
1
,
height
:
1
}
}
// 不知道为啥这里height: 1,就可以自适应高度了
>
<
View
>
<
View
>
123
</
View
>
...
...
@@ -78,15 +55,52 @@ const Members = ({ tabBarHeight }: { tabBarHeight: number }) => {
<
View
>
123
</
View
>
<
View
>
123
</
View
>
<
View
>
123
</
View
>
<
View
>
123
</
View
>
<
View
>
2123
</
View
>
<
View
>
3123
</
View
>
<
View
>
4123
</
View
>
<
View
>
5123
</
View
>
<
View
>
6123
</
View
>
<
View
>
123
</
View
>
<
View
>
123
</
View
>
<
View
>
123
</
View
>
<
View
>
123
</
View
>
<
View
>
123
</
View
>
<
View
>
123
</
View
>
<
View
>
123
</
View
>
<
View
>
123
</
View
>
<
View
>
123
</
View
>
<
View
>
123
</
View
>
<
View
>
123
</
View
>
<
View
>
123
</
View
>
<
View
>
123
</
View
>
<
View
>
123
</
View
>
<
View
>
123
</
View
>
<
View
>
123
</
View
>
<
View
>
123
</
View
>
<
View
>
123
</
View
>
<
View
>
123
</
View
>
<
View
>
123
</
View
>
<
View
>
123
</
View
>
<
View
>
123
</
View
>
<
View
>
123
</
View
>
<
View
>
123
</
View
>
<
View
>
2123
</
View
>
<
View
>
3123
</
View
>
<
View
>
4123
</
View
>
<
View
>
5123
</
View
>
<
View
>
6123
</
View
>
</
View
>
</
ScrollView
>
<
View
className=
{
classNames
(
styles
.
invite_members
,
membersCls
)
}
>
<
View
className=
{
styles
.
invite_members
}
>
<
Button
className=
{
styles
.
invite_members_btn
}
>
邀请人加入部落 +5答题卡
</
Button
>
<
View
className=
{
styles
.
invite_members_info
}
>
<
Text
>
赠送朋友5张答题卡,一起来进击
</
Text
>
<
Text
>
好友进入小程序通关1关+5
</
Text
>
</
View
>
</
View
>
</
View
>
)
}
...
...
src/pages/group/components/sign-in.module.scss
0 → 100644
View file @
fb7f17e8
@import
'@/styles/mixins.scss'
;
.sign_in
{
@include
flexLayout
();
gap
:
16px
;
border
:
1px
solid
red
;
padding
:
12px
24px
;
&
_today
,
&
_invite
{
position
:
relative
;
padding
:
8px
12px
;
border
:
1px
solid
gray
;
border-radius
:
12px
;
}
.success_message
{
position
:
absolute
;
right
:
0
;
bottom
:
0
;
opacity
:
0
;
transform
:
translateY
(
0
);
animation
:
fadeInUp
0
.6s
ease_out
;
}
}
@keyframes
fadeInUp
{
0
%
{
opacity
:
0
;
transform
:
translateY
(
0
);
}
100
%
{
opacity
:
1
;
transform
:
translateY
(
_30px
);
}
}
\ No newline at end of file
src/pages/group/components/sign-in.tsx
0 → 100644
View file @
fb7f17e8
import
{
View
,
Text
,
Button
}
from
'@tarojs/components'
import
{
useBoolean
}
from
'@/hooks/use-boolean'
import
styles
from
'./sign-in.module.scss'
export
default
()
=>
{
const
[
showMessage
,
{
setTrue
,
setFalse
}]
=
useBoolean
(
false
)
const
handleClick
=
()
=>
{
setTrue
()
setTimeout
(()
=>
{
setFalse
()
},
800
)
}
return
(
<
View
className=
{
styles
.
sign_in
}
>
<
View
className=
{
styles
.
sign_in_today
}
>
<
Button
onClick=
{
handleClick
}
>
今日部落津贴 +2
</
Button
>
{
showMessage
&&
<
Text
className=
{
styles
.
success_message
}
>
领取成功
</
Text
>
}
</
View
>
<
Text
className=
{
styles
.
sign_in_invite
}
>
成功邀请1人 +100
</
Text
>
</
View
>
)
}
src/pages/group/index.tsx
View file @
fb7f17e8
...
...
@@ -12,7 +12,7 @@ import Members from './components/members'
import
styles
from
'./index.module.scss'
const
Group
=
()
=>
{
const
page
=
useMemo
(()
=>
getCurrentInstance
().
page
,
[])
const
page
=
getCurrentInstance
().
page
const
[
nav
]
=
useState
(
getMenuButtonBoundingClientRect
())
const
[
isVisible
,
{
toggle
}]
=
useBoolean
(
false
)
const
[
value
,
setValue
]
=
useState
<
string
>
()
...
...
@@ -23,7 +23,7 @@ const Group = () => {
},
[
nav
])
useDidShow
(()
=>
{
const
tabbar
=
getTabBar
(
page
)
as
any
const
tabbar
=
getTabBar
(
page
)
as
{
setSelected
:
(
index
:
number
)
=>
void
}
tabbar
?.
setSelected
(
1
)
})
...
...
src/pages/prepare/components/rank-list/index.tsx
View file @
fb7f17e8
...
...
@@ -11,7 +11,7 @@ import { User } from '../../types'
import
styles
from
'./index.module.scss'
const
ScrollRankList
:
React
.
FC
<
{
users
:
User
[]
}
>
=
({
users
})
=>
{
const
ScrollRankList
=
({
users
}:
{
users
:
User
[]
})
=>
{
const
[
showAll
,
toggleShowAll
]
=
useToggle
()
const
{
currentUser
,
currentUserInTopThree
,
topThreeUsers
}
=
useStoreState
((
state
)
=>
state
.
prepareModel
)
...
...
src/pages/prepare/components/rank-list/timing.tsx
View file @
fb7f17e8
import
React
from
'react'
import
{
View
,
Text
}
from
'@tarojs/components'
import
{
TimingProps
}
from
'../../types'
// import { formatTime } from '../../utils'
import
styles
from
'./index.module.scss'
const
Timing
:
React
.
FC
<
TimingProps
>
=
({
time
=
0
}
)
=>
{
const
Timing
=
({
time
=
0
}:
TimingProps
)
=>
{
return
(
<
View
className=
{
styles
.
timing
}
>
<
Text
>
34.23秒
</
Text
>
...
...
src/pages/prepare/components/rank-list/user-info.tsx
View file @
fb7f17e8
import
React
from
'react'
import
{
View
,
Text
}
from
'@tarojs/components'
import
{
UserInfoProps
}
from
'../../types'
import
styles
from
'./index.module.scss'
const
UserInfo
:
React
.
FC
<
UserInfoProps
>
=
({
avatar
,
nickname
,
schoolName
}
)
=>
{
const
UserInfo
=
({
avatar
,
nickname
,
schoolName
}:
UserInfoProps
)
=>
{
return
(
<
View
className=
{
styles
.
userInfo
}
>
<
View
className=
{
styles
.
avatar
}
/>
...
...
src/pages/prepare/components/study-league-rank.tsx
View file @
fb7f17e8
...
...
@@ -4,7 +4,7 @@ import ScrollRankList from './rank-list/index'
import
{
User
}
from
'../types'
const
StudyLeagueRank
:
React
.
FC
<
{
users
:
User
[]
}
>
=
({
users
})
=>
{
const
StudyLeagueRank
=
({
users
}:
{
users
:
User
[]
})
=>
{
return
(
<
View
>
<
ScrollRankList
users=
{
users
}
/>
...
...
src/pages/study-market/components/card.tsx
View file @
fb7f17e8
import
{
PropsWithChildren
}
from
'react'
import
{
View
}
from
'@tarojs/components'
import
classNames
from
'classnames'
import
Skeleton
from
'@/components/Skeleton'
...
...
@@ -12,10 +13,9 @@ interface CardProps {
hoverable
?:
boolean
;
extra
?:
React
.
ReactNode
;
bodyStyle
?:
React
.
CSSProperties
;
children
?:
React
.
ReactNode
;
}
const
Card
:
React
.
FC
<
CardProps
>
=
({
const
Card
=
({
title
,
extra
,
loading
,
...
...
@@ -23,8 +23,8 @@ const Card: React.FC<CardProps> = ({
hoverable
,
headStyle
,
bodyStyle
,
children
,
})
=>
{
children
}
:
PropsWithChildren
<
CardProps
>
)
=>
{
const
cardClass
=
classNames
(
styles
.
card
,
{
[
styles
.
bordered
]:
bordered
,
})
...
...
src/pages/summary/components/challenge-failed.tsx
0 → 100644
View file @
fb7f17e8
import
{
View
,
Text
}
from
'@tarojs/components'
import
ScoreStats
from
'./score-stats'
const
ChallengeFailed
=
()
=>
{
return
(
<
View
>
<
Text
>
挑战失败
</
Text
>
<
ScoreStats
/>
</
View
>
)
}
export
default
ChallengeFailed
src/pages/summary/components/challenge-success.tsx
0 → 100644
View file @
fb7f17e8
import
{
View
,
Text
}
from
'@tarojs/components'
import
ScoreStats
from
'./score-stats'
const
ChallengeFailed
=
()
=>
{
return
(
<
View
>
<
Text
>
挑战成功
</
Text
>
<
ScoreStats
/>
</
View
>
)
}
export
default
ChallengeFailed
src/pages/summary/components/glorys.module.scss
0 → 100644
View file @
fb7f17e8
.glorys
{
display
:
flex
;
flex-direction
:
column
;
.glory
{
background-color
:
aqua
;
transform
:
scaleX
(
0
);
transform-origin
:
left
;
opacity
:
0
;
transition
:
transform
2s
,
opacity
4s
;
&
.expanded
{
transform
:
scaleX
(
1
);
opacity
:
1
;
&
:nth-child
(
1
)
{
transition-delay
:
0
.3s
;
}
&
:nth-child
(
2
)
{
transition-delay
:
0
.6s
;
}
&
:nth-child
(
3
)
{
transition-delay
:
0
.9s
;
}
&
:nth-child
(
4
)
{
transition-delay
:
1
.2s
;
}
&
:nth-child
(
5
)
{
transition-delay
:
1
.5s
;
}
}
}
}
src/pages/summary/components/glorys.tsx
0 → 100644
View file @
fb7f17e8
import
{
useState
,
useEffect
}
from
'react'
import
{
View
,
Text
}
from
'@tarojs/components'
import
classNames
from
'classnames'
import
styles
from
'./glorys.module.scss'
const
Glorys
=
()
=>
{
const
[
activated
,
setActivated
]
=
useState
(
false
)
useEffect
(()
=>
{
const
triggerAnimation
=
requestAnimationFrame
(()
=>
{
setActivated
(
true
)
})
return
()
=>
{
cancelAnimationFrame
(
triggerAnimation
)
}
},
[])
const
cls
=
classNames
(
styles
.
glory
,
activated
?
styles
.
expanded
:
''
)
const
result
=
{
score
:
1
,
ranking
:
1
,
isFirstTime
:
1
,
promoted
:
1
,
bonusPoints
:
1
,
selfRank
:
1
,
allRanks
:
1
,
}
return
(
<
View
className=
{
styles
.
glorys
}
>
<
Text
className=
{
cls
}
>
成绩首次达成:
{
result
.
score
}
</
Text
>
<
Text
className=
{
cls
}
>
排名首次达成:
{
result
.
ranking
}
</
Text
>
{
result
.
isFirstTime
?
(
<
Text
className=
{
cls
}
>
排名再次达成:
{
result
.
ranking
}
</
Text
>)
:
(
<
Text
className=
{
cls
}
>
排名再次达成:
{
result
.
ranking
}
</
Text
>
)
}
{
result
.
promoted
&&
<
Text
className=
{
cls
}
>
升档成功:
{
result
.
bonusPoints
}
积分
</
Text
>
}
{
result
.
selfRank
>
0
&&
(
<
Text
className=
{
cls
}
>
排名:
{
result
.
selfRank
}
/
{
result
.
allRanks
}
</
Text
>
)
}
</
View
>
)
}
export
default
Glorys
src/pages/summary/components/score-result.module.scss
0 → 100644
View file @
fb7f17e8
@import
'@/styles/mixins.scss'
;
.score_result
{
position
:
relative
;
}
.score
{
position
:
absolute
;
overflow
:
hidden
;
}
.shrink
{
animation
:
shrink
1s
forwards
;
}
.expand
{
width
:
0
;
animation
:
expand
1s
forwards
;
}
@keyframes
shrink
{
0
%
{
width
:
100%
;
}
100
%
{
width
:
0
;
}
}
@keyframes
expand
{
0
%
{
width
:
0
;
}
100
%
{
width
:
100%
;
}
}
src/pages/summary/components/score-result.tsx
0 → 100644
View file @
fb7f17e8
import
{
useState
,
useEffect
}
from
'react'
import
{
View
,
Text
}
from
'@tarojs/components'
import
classNames
from
'classnames'
import
styles
from
'./score-result.module.scss'
interface
ScoreResultProps
{
score
:
string
}
const
ScoreResult
=
({
score
}:
ScoreResultProps
)
=>
{
const
[
prevScore
,
setPrevScore
]
=
useState
(
score
)
const
[
isAnimating
,
setIsAnimating
]
=
useState
(
false
)
useEffect
(()
=>
{
if
(
prevScore
!==
score
)
{
setIsAnimating
(
true
)
setTimeout
(()
=>
{
setPrevScore
(
score
)
setIsAnimating
(
false
)
},
1000
)
}
},
[
score
])
return
(
<
View
className=
{
styles
.
score_result
}
>
<
Text
className=
{
classNames
(
styles
.
score
,
isAnimating
?
styles
.
shrink
:
''
)
}
>
{
prevScore
}
</
Text
>
<
Text
className=
{
classNames
(
styles
.
score
,
isAnimating
?
styles
.
expand
:
''
)
}
>
{
score
}
</
Text
>
</
View
>
)
}
export
default
ScoreResult
src/pages/summary/components/score-stats.tsx
0 → 100644
View file @
fb7f17e8
import
{
View
,
Text
,
Button
}
from
'@tarojs/components'
const
ScoreStats
=
({
correctRate
=
1
,
timeSpent
=
2
})
=>
{
return
(
<
View
className=
"score-stats"
>
<
Text
>
正确率:
{
correctRate
}
%
</
Text
>
<
Text
>
耗时:
{
timeSpent
}
秒
</
Text
>
</
View
>
)
}
export
default
ScoreStats
src/pages/summary/index.scss
→
src/pages/summary/index.
module.
scss
View file @
fb7f17e8
...
...
@@ -2,36 +2,33 @@
display
:
flex
;
flex-direction
:
column
;
justify-content
:
space-between
;
height
:
100%
;
.score
{
font-size
:
3rem
;
font-weight
:
bold
;
text-align
:
center
;
&
.zoom-in-animate
{
animation
:
fade-zoom-in
1s
ease-in-out
;
}
}
.stats
{
display
:
flex
;
justify-content
:
space-between
;
padding
:
0
1rem
;
}
.glorys
{
display
:
flex
;
flex-direction
:
column
;
gap
:
0
.5rem
;
padding
:
0
1rem
;
}
.continue-btn
{
// height: 100%;
// position: relative;
// .score {
// font-size: 3rem;
// font-weight: bold;
// text-align: center;
// &.zoom-in-animate {
// animation: fade-zoom-in 1s ease-in-out;
// }
// }
// .stats {
// display: flex;
// justify-content: space-between;
// padding: 0 1rem;
// }
.continue_btn
{
display
:
flex
;
justify-content
:
center
;
justify-content
:
center
;
padding-bottom
:
1rem
;
position
:
absolute
;
bottom
:
10%
;
left
:
0
;
width
:
100%
;
}
}
...
...
src/pages/summary/index.tsx
View file @
fb7f17e8
...
...
@@ -2,7 +2,13 @@ import React, { useState, useEffect } from 'react'
import
{
View
,
Text
,
Button
}
from
'@tarojs/components'
import
classNames
from
'classnames'
import
'./index.scss'
import
ChallengeFailed
from
'./components/challenge-failed'
import
ChallengeSuccess
from
'./components/challenge-success'
import
ScoreResult
from
'./components/score-result'
import
ScoreStats
from
'./components/score-stats'
import
Glorys
from
'./components/glorys'
import
styles
from
'./index.module.scss'
interface
ResultProps
{
score
:
'S'
|
'A'
|
'B'
;
...
...
@@ -14,7 +20,7 @@ interface ResultProps {
onContinue
:
()
=>
void
;
}
const
SummaryResult
:
React
.
FC
<
ResultProps
>
=
({
const
SummaryResult
=
({
score
=
'B'
,
correctRate
=
'全队'
,
timeSpent
=
30
,
...
...
@@ -22,52 +28,38 @@ const SummaryResult: React.FC<ResultProps> = ({
ranking
,
promoted
,
onContinue
,
})
=>
{
const
[
result
,
setResult
]
=
useState
({
score
,
isFirstTime
,
ranking
})
const
[
animateScore
,
setAnimateScore
]
=
useState
(
false
)
}:
ResultProps
)
=>
{
const
[
result
,
setResult
]
=
useState
<
any
>
({
score
,
isFirstTime
,
ranking
})
const
bonusPoints
=
100
const
selfRank
=
100
const
allRanks
=
1000
useEffect
(()
=>
{
setAnimateScore
(
true
)
setResult
({
score
,
isFirstTime
,
ranking
})
// setAnimateScore(true)
const
timer
=
setTimeout
(()
=>
{
setAnimateScore
(
false
)
},
500
)
// setResult({ score, isFirstTime, ranking })
return
()
=>
{
clearTimeout
(
timer
)
}
},
[
score
,
isFirstTime
,
ranking
])
setTimeout
(
()
=>
{
setResult
({
score
:
'A'
}
)
}
,
1000
)
},
[])
return
(
<
View
className=
"container"
>
<
View
className=
{
classNames
(
'score'
,
{
'zoom-in-animate'
:
animateScore
})
}
>
<
Text
>
{
result
.
score
}
</
Text
>
</
View
>
<
View
className=
"stats"
>
<
Text
>
正确率:
{
correctRate
}
%
</
Text
>
<
Text
>
耗时:
{
timeSpent
}
秒
</
Text
>
</
View
>
<
View
className=
"glorys"
>
<
Text
>
成绩首次达成:
{
result
.
score
}
</
Text
>
{
result
.
isFirstTime
?
(
<
Text
>
排名首次达成:
{
result
.
ranking
}
</
Text
>
)
:
(
<
Text
>
排名再次达成:
{
result
.
ranking
}
</
Text
>
)
}
{
promoted
&&
<
Text
>
升档成功:
{
bonusPoints
}
积分
</
Text
>
}
{
selfRank
>
0
&&
(
<
Text
>
排名:
{
selfRank
}
/
{
allRanks
}
</
Text
>
)
}
</
View
>
<
View
className=
"continue-btn"
>
<
View
className=
{
styles
.
container
}
>
{
/* <ChallengeFailed>
<ChallengeSuccess>
<ScoreStats />
</ChallengeSuccess> */
}
{
/* <View className="score">
<ScoreResult score={result.score} />
</View> */
}
{
/* <ScoreStats /> */
}
{
/* <Glorys /> */
}
<
Text
>
!
</
Text
>
<
View
className=
{
styles
.
continue_btn
}
>
<
Button
onClick=
{
onContinue
}
>
继续
</
Button
>
</
View
>
</
View
>
...
...
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