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
2968ad56
Commit
2968ad56
authored
Mar 31, 2023
by
hewenhao
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of dev.jiuaoedu.com:hewenhao/GeekLearnMathWeapp
parents
53db40e7
9c98f1b2
Show whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
397 additions
and
142 deletions
+397
-142
app.config.ts.tpl
scripts/app.config.ts.tpl
+2
-1
account.ts
src/api/account.ts
+0
-0
group.ts
src/api/group.ts
+0
-0
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 @
2968ad56
...
@@ -7,10 +7,11 @@
...
@@ -7,10 +7,11 @@
export default {
export default {
pages: [
pages: [
'pages/main/main',
'pages/main/main',
'pages/group/index',
'pages/prepare/index',
'pages/prepare/index',
'pages/study-market/index',
'pages/study-market/index',
'pages/group/index',
'pages/game/play/index',
'pages/game/play/index',
'pages/summary/index',
],
],
subPackages: {
{
packages
}
},
subPackages: {
{
packages
}
},
resizable: true,
resizable: true,
...
...
src/api/account.ts
0 → 100644
View file @
2968ad56
src/api/group.ts
0 → 100644
View file @
2968ad56
src/components/Modal/index.tsx
View file @
2968ad56
...
@@ -13,7 +13,7 @@ interface ModalProps {
...
@@ -13,7 +13,7 @@ interface ModalProps {
onClose
?:
()
=>
void
;
onClose
?:
()
=>
void
;
}
}
const
Modal
:
React
.
FC
<
ModalProps
>
=
({
const
Modal
=
({
isVisible
,
isVisible
,
onClose
,
onClose
,
children
,
children
,
...
@@ -21,7 +21,7 @@ const Modal: React.FC<ModalProps> = ({
...
@@ -21,7 +21,7 @@ const Modal: React.FC<ModalProps> = ({
bodyClassName
,
bodyClassName
,
coverNavigateBar
=
true
,
// z-index 层级高于原生的bar
coverNavigateBar
=
true
,
// z-index 层级高于原生的bar
maskClosable
=
true
maskClosable
=
true
})
=>
{
}
:
ModalProps
)
=>
{
const
wrapClass
=
classNames
(
styles
.
wrapper
,
wrapClassName
,
{
const
wrapClass
=
classNames
(
styles
.
wrapper
,
wrapClassName
,
{
[
styles
.
visible
]:
isVisible
[
styles
.
visible
]:
isVisible
})
})
...
...
src/components/Skeleton/components/avatar.tsx
View file @
2968ad56
...
@@ -7,11 +7,11 @@ export interface SkeletonAvatarProps {
...
@@ -7,11 +7,11 @@ export interface SkeletonAvatarProps {
size
?:
number
;
size
?:
number
;
}
}
const
SkeletonAvatar
:
React
.
FC
<
SkeletonAvatarProps
>
=
({
const
SkeletonAvatar
=
({
animate
=
true
,
animate
=
true
,
shape
=
'circle'
,
shape
=
'circle'
,
size
=
48
,
size
=
48
,
})
=>
{
}
:
SkeletonAvatarProps
)
=>
{
const
avatarClass
=
classNames
(
const
avatarClass
=
classNames
(
'skeleton-avatar'
,
'skeleton-avatar'
,
animate
?
'skeleton-loading'
:
null
,
animate
?
'skeleton-loading'
:
null
,
...
...
src/components/Skeleton/components/paragraph.tsx
View file @
2968ad56
...
@@ -9,13 +9,13 @@ export interface SkeletonParagraphProps {
...
@@ -9,13 +9,13 @@ export interface SkeletonParagraphProps {
width
?:
string
|
number
|
(
string
|
number
)[];
width
?:
string
|
number
|
(
string
|
number
)[];
}
}
const
SkeletonParagraph
:
React
.
FC
<
SkeletonParagraphProps
>
=
({
const
SkeletonParagraph
=
({
animate
=
true
,
animate
=
true
,
rows
=
3
,
rows
=
3
,
gap
=
8
,
gap
=
8
,
height
=
16
,
height
=
16
,
width
=
'100%'
,
width
=
'100%'
,
})
=>
{
}
:
SkeletonParagraphProps
)
=>
{
const
paragraphRows
=
Array
.
from
({
length
:
rows
},
(
_
,
i
)
=>
{
const
paragraphRows
=
Array
.
from
({
length
:
rows
},
(
_
,
i
)
=>
{
const
rowWidth
=
Array
.
isArray
(
width
)
const
rowWidth
=
Array
.
isArray
(
width
)
?
width
[
i
]
??
width
[
width
.
length
-
1
]
?
width
[
i
]
??
width
[
width
.
length
-
1
]
...
...
src/components/Skeleton/components/title.tsx
View file @
2968ad56
...
@@ -7,11 +7,11 @@ export interface SkeletonTitleProps {
...
@@ -7,11 +7,11 @@ export interface SkeletonTitleProps {
width
?:
string
|
number
;
width
?:
string
|
number
;
}
}
const
SkeletonTitle
:
React
.
FC
<
SkeletonTitleProps
>
=
({
const
SkeletonTitle
=
({
animate
=
true
,
animate
=
true
,
height
=
16
,
height
=
16
,
width
=
'30%'
,
width
=
'30%'
,
})
=>
{
}
:
SkeletonTitleProps
)
=>
{
return
(
return
(
<
View
<
View
className=
{
classNames
(
'skeleton-title'
,
animate
?
'skeleton-loading'
:
null
)
}
className=
{
classNames
(
'skeleton-title'
,
animate
?
'skeleton-loading'
:
null
)
}
...
...
src/components/Tabs/index.tsx
View file @
2968ad56
...
@@ -20,14 +20,14 @@ interface TabsProps {
...
@@ -20,14 +20,14 @@ interface TabsProps {
onChange
?:
(
index
:
number
)
=>
void
;
onChange
?:
(
index
:
number
)
=>
void
;
}
}
const
Tabs
:
React
.
FC
<
TabsProps
>
=
({
const
Tabs
=
({
items
,
items
,
initialIndex
=
0
,
initialIndex
=
0
,
tabBarGutter
=
16
,
tabBarGutter
=
16
,
tabBarStyle
,
tabBarStyle
,
tabPanesStyle
,
tabPanesStyle
,
onChange
,
onChange
,
})
=>
{
}
:
TabsProps
)
=>
{
const
[
activeIndex
,
setActiveIndex
]
=
useState
(
initialIndex
)
const
[
activeIndex
,
setActiveIndex
]
=
useState
(
initialIndex
)
useEffect
(()
=>
{
useEffect
(()
=>
{
...
...
src/pages/group/components/members.module.scss
View file @
2968ad56
...
@@ -2,35 +2,18 @@
...
@@ -2,35 +2,18 @@
.container
{
.container
{
@include
flexLayout
(
column
);
@include
flexLayout
(
column
);
.header
{
.header
{
padding
:
16px
;
padding
:
16px
;
.title
{
.title
{
font-size
:
64px
;
font-size
:
64px
;
font-weight
:
500
;
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
{
.invite_members
{
position
:
absolute
;
padding-bottom
:
56
PX
;
width
:
100%
;
left
:
0
;
bottom
:
150px
;
@include
flexLayout
(
column
,
center
,
center
);
@include
flexLayout
(
column
,
center
,
center
);
gap
:
16px
;
&
_btn
{
&
_btn
{
width
:
80%
;
width
:
80%
;
...
@@ -39,5 +22,11 @@
...
@@ -39,5 +22,11 @@
padding
:
8px
16px
;
padding
:
8px
16px
;
border-radius
:
4px
;
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 @
2968ad56
import
{
useMemo
,
useState
,
useEffect
}
from
'react'
import
{
getSystemInfoSync
,
createSelectorQuery
}
from
'@tarojs/taro'
import
{
View
,
Button
,
Text
,
ScrollView
}
from
'@tarojs/components'
import
{
View
,
Button
,
Text
,
ScrollView
}
from
'@tarojs/components'
import
classNames
from
'classnames'
import
{
useBoolean
}
from
'@/hooks/use-boolean'
import
{
useBoolean
}
from
'@/hooks/use-boolean'
import
SignIn
from
'./sign-in'
import
styles
from
'./members.module.scss'
import
styles
from
'./members.module.scss'
const
screenHeight
=
getSystemInfoSync
().
windowHeight
const
membersCls
=
'_members_const_'
const
Members
=
({
tabBarHeight
}:
{
tabBarHeight
:
number
})
=>
{
const
Members
=
({
tabBarHeight
}:
{
tabBarHeight
:
number
})
=>
{
const
[
isRefresh
,
{
setTrue
,
setFalse
}]
=
useBoolean
(
false
)
const
[
isRefresh
,
{
setTrue
,
setFalse
}]
=
useBoolean
(
false
)
cons
t
[
height
,
setHeight
]
=
useState
(
0
)
cons
ole
.
log
(
'-tabBarHeight'
,
tabBarHeight
)
const
onRefresh
=
()
=>
{
const
onRefresh
=
()
=>
{
setTrue
()
setTrue
()
...
@@ -21,29 +16,11 @@ const Members = ({ tabBarHeight }: { tabBarHeight: number }) => {
...
@@ -21,29 +16,11 @@ const Members = ({ tabBarHeight }: { tabBarHeight: number }) => {
},
1000
)
},
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
(
return
(
<
View
className=
{
styles
.
container
}
>
<
View
className=
{
styles
.
container
}
style=
{
{
height
:
`calc(100vh - ${tabBarHeight}px)`
}
}
>
<
View
className=
{
classNames
(
styles
.
header
,
membersCls
)
}
>
<
View
className=
{
styles
.
header
}
>
<
Text
className=
{
styles
.
title
}
>
阳光学习帮
</
Text
>
<
Text
className=
"title"
>
阳光学习帮
</
Text
>
<
View
className=
{
styles
.
sign_in
}
>
<
SignIn
/>
<
Text
className=
{
styles
.
sign_in_today
}
>
今日部落津贴 +2
</
Text
>
<
Text
className=
{
styles
.
sign_in_invite
}
>
成功邀请1人 +100
</
Text
>
</
View
>
</
View
>
</
View
>
<
ScrollView
<
ScrollView
...
@@ -52,7 +29,7 @@ const Members = ({ tabBarHeight }: { tabBarHeight: number }) => {
...
@@ -52,7 +29,7 @@ const Members = ({ tabBarHeight }: { tabBarHeight: number }) => {
refresherEnabled
refresherEnabled
refresherTriggered=
{
isRefresh
}
refresherTriggered=
{
isRefresh
}
onRefresherRefresh=
{
onRefresh
}
onRefresherRefresh=
{
onRefresh
}
style=
{
{
height
:
scrollHeight
}
}
style=
{
{
flexGrow
:
1
,
height
:
1
}
}
// 不知道为啥这里height: 1,就可以自适应高度了
>
>
<
View
>
<
View
>
<
View
>
123
</
View
>
<
View
>
123
</
View
>
...
@@ -78,15 +55,52 @@ const Members = ({ tabBarHeight }: { tabBarHeight: number }) => {
...
@@ -78,15 +55,52 @@ const Members = ({ tabBarHeight }: { tabBarHeight: number }) => {
<
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
>
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
>
</
View
>
</
ScrollView
>
</
ScrollView
>
<
View
className=
{
classNames
(
styles
.
invite_members
,
membersCls
)
}
>
<
View
className=
{
styles
.
invite_members
}
>
<
Button
className=
{
styles
.
invite_members_btn
}
>
邀请人加入部落 +5答题卡
</
Button
>
<
Button
className=
{
styles
.
invite_members_btn
}
>
邀请人加入部落 +5答题卡
</
Button
>
<
View
className=
{
styles
.
invite_members_info
}
>
<
Text
>
赠送朋友5张答题卡,一起来进击
</
Text
>
<
Text
>
赠送朋友5张答题卡,一起来进击
</
Text
>
<
Text
>
好友进入小程序通关1关+5
</
Text
>
<
Text
>
好友进入小程序通关1关+5
</
Text
>
</
View
>
</
View
>
</
View
>
</
View
>
</
View
>
)
)
}
}
...
...
src/pages/group/components/sign-in.module.scss
0 → 100644
View file @
2968ad56
@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 @
2968ad56
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 @
2968ad56
...
@@ -12,7 +12,7 @@ import Members from './components/members'
...
@@ -12,7 +12,7 @@ import Members from './components/members'
import
styles
from
'./index.module.scss'
import
styles
from
'./index.module.scss'
const
Group
=
()
=>
{
const
Group
=
()
=>
{
const
page
=
useMemo
(()
=>
getCurrentInstance
().
page
,
[])
const
page
=
getCurrentInstance
().
page
const
[
nav
]
=
useState
(
getMenuButtonBoundingClientRect
())
const
[
nav
]
=
useState
(
getMenuButtonBoundingClientRect
())
const
[
isVisible
,
{
toggle
}]
=
useBoolean
(
false
)
const
[
isVisible
,
{
toggle
}]
=
useBoolean
(
false
)
const
[
value
,
setValue
]
=
useState
<
string
>
()
const
[
value
,
setValue
]
=
useState
<
string
>
()
...
@@ -23,7 +23,7 @@ const Group = () => {
...
@@ -23,7 +23,7 @@ const Group = () => {
},
[
nav
])
},
[
nav
])
useDidShow
(()
=>
{
useDidShow
(()
=>
{
const
tabbar
=
getTabBar
(
page
)
as
any
const
tabbar
=
getTabBar
(
page
)
as
{
setSelected
:
(
index
:
number
)
=>
void
}
tabbar
?.
setSelected
(
1
)
tabbar
?.
setSelected
(
1
)
})
})
...
...
src/pages/prepare/components/rank-list/index.tsx
View file @
2968ad56
...
@@ -11,7 +11,7 @@ import { User } from '../../types'
...
@@ -11,7 +11,7 @@ import { User } from '../../types'
import
styles
from
'./index.module.scss'
import
styles
from
'./index.module.scss'
const
ScrollRankList
:
React
.
FC
<
{
users
:
User
[]
}
>
=
({
users
})
=>
{
const
ScrollRankList
=
({
users
}:
{
users
:
User
[]
})
=>
{
const
[
showAll
,
toggleShowAll
]
=
useToggle
()
const
[
showAll
,
toggleShowAll
]
=
useToggle
()
const
{
currentUser
,
currentUserInTopThree
,
topThreeUsers
}
=
useStoreState
((
state
)
=>
state
.
prepareModel
)
const
{
currentUser
,
currentUserInTopThree
,
topThreeUsers
}
=
useStoreState
((
state
)
=>
state
.
prepareModel
)
...
...
src/pages/prepare/components/rank-list/timing.tsx
View file @
2968ad56
import
React
from
'react'
import
{
View
,
Text
}
from
'@tarojs/components'
import
{
View
,
Text
}
from
'@tarojs/components'
import
{
TimingProps
}
from
'../../types'
import
{
TimingProps
}
from
'../../types'
// import { formatTime } from '../../utils'
// import { formatTime } from '../../utils'
import
styles
from
'./index.module.scss'
import
styles
from
'./index.module.scss'
const
Timing
:
React
.
FC
<
TimingProps
>
=
({
time
=
0
}
)
=>
{
const
Timing
=
({
time
=
0
}:
TimingProps
)
=>
{
return
(
return
(
<
View
className=
{
styles
.
timing
}
>
<
View
className=
{
styles
.
timing
}
>
<
Text
>
34.23秒
</
Text
>
<
Text
>
34.23秒
</
Text
>
...
...
src/pages/prepare/components/rank-list/user-info.tsx
View file @
2968ad56
import
React
from
'react'
import
{
View
,
Text
}
from
'@tarojs/components'
import
{
View
,
Text
}
from
'@tarojs/components'
import
{
UserInfoProps
}
from
'../../types'
import
{
UserInfoProps
}
from
'../../types'
import
styles
from
'./index.module.scss'
import
styles
from
'./index.module.scss'
const
UserInfo
:
React
.
FC
<
UserInfoProps
>
=
({
avatar
,
nickname
,
schoolName
}
)
=>
{
const
UserInfo
=
({
avatar
,
nickname
,
schoolName
}:
UserInfoProps
)
=>
{
return
(
return
(
<
View
className=
{
styles
.
userInfo
}
>
<
View
className=
{
styles
.
userInfo
}
>
<
View
className=
{
styles
.
avatar
}
/>
<
View
className=
{
styles
.
avatar
}
/>
...
...
src/pages/prepare/components/study-league-rank.tsx
View file @
2968ad56
...
@@ -4,7 +4,7 @@ import ScrollRankList from './rank-list/index'
...
@@ -4,7 +4,7 @@ import ScrollRankList from './rank-list/index'
import
{
User
}
from
'../types'
import
{
User
}
from
'../types'
const
StudyLeagueRank
:
React
.
FC
<
{
users
:
User
[]
}
>
=
({
users
})
=>
{
const
StudyLeagueRank
=
({
users
}:
{
users
:
User
[]
})
=>
{
return
(
return
(
<
View
>
<
View
>
<
ScrollRankList
users=
{
users
}
/>
<
ScrollRankList
users=
{
users
}
/>
...
...
src/pages/study-market/components/card.tsx
View file @
2968ad56
import
{
PropsWithChildren
}
from
'react'
import
{
View
}
from
'@tarojs/components'
import
{
View
}
from
'@tarojs/components'
import
classNames
from
'classnames'
import
classNames
from
'classnames'
import
Skeleton
from
'@/components/Skeleton'
import
Skeleton
from
'@/components/Skeleton'
...
@@ -12,10 +13,9 @@ interface CardProps {
...
@@ -12,10 +13,9 @@ interface CardProps {
hoverable
?:
boolean
;
hoverable
?:
boolean
;
extra
?:
React
.
ReactNode
;
extra
?:
React
.
ReactNode
;
bodyStyle
?:
React
.
CSSProperties
;
bodyStyle
?:
React
.
CSSProperties
;
children
?:
React
.
ReactNode
;
}
}
const
Card
:
React
.
FC
<
CardProps
>
=
({
const
Card
=
({
title
,
title
,
extra
,
extra
,
loading
,
loading
,
...
@@ -23,8 +23,8 @@ const Card: React.FC<CardProps> = ({
...
@@ -23,8 +23,8 @@ const Card: React.FC<CardProps> = ({
hoverable
,
hoverable
,
headStyle
,
headStyle
,
bodyStyle
,
bodyStyle
,
children
,
children
})
=>
{
}
:
PropsWithChildren
<
CardProps
>
)
=>
{
const
cardClass
=
classNames
(
styles
.
card
,
{
const
cardClass
=
classNames
(
styles
.
card
,
{
[
styles
.
bordered
]:
bordered
,
[
styles
.
bordered
]:
bordered
,
})
})
...
...
src/pages/summary/components/challenge-failed.tsx
0 → 100644
View file @
2968ad56
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 @
2968ad56
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 @
2968ad56
.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 @
2968ad56
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 @
2968ad56
@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 @
2968ad56
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 @
2968ad56
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 @
2968ad56
...
@@ -2,36 +2,33 @@
...
@@ -2,36 +2,33 @@
display
:
flex
;
display
:
flex
;
flex-direction
:
column
;
flex-direction
:
column
;
justify-content
:
space-between
;
justify-content
:
space-between
;
height
:
100%
;
// height: 100%;
// position: relative;
.score
{
font-size
:
3rem
;
// .score {
font-weight
:
bold
;
// font-size: 3rem;
text-align
:
center
;
// font-weight: bold;
// text-align: center;
&
.zoom-in-animate
{
animation
:
fade-zoom-in
1s
ease-in-out
;
// &.zoom-in-animate {
}
// animation: fade-zoom-in 1s ease-in-out;
}
// }
// }
.stats
{
display
:
flex
;
// .stats {
justify-content
:
space-between
;
// display: flex;
padding
:
0
1rem
;
// justify-content: space-between;
}
// padding: 0 1rem;
// }
.glorys
{
display
:
flex
;
.continue_btn
{
flex-direction
:
column
;
gap
:
0
.5rem
;
padding
:
0
1rem
;
}
.continue-btn
{
display
:
flex
;
display
:
flex
;
justify-content
:
justify-content
:
center
;
center
;
padding-bottom
:
1rem
;
padding-bottom
:
1rem
;
position
:
absolute
;
bottom
:
10%
;
left
:
0
;
width
:
100%
;
}
}
}
}
...
...
src/pages/summary/index.tsx
View file @
2968ad56
...
@@ -2,7 +2,13 @@ import React, { useState, useEffect } from 'react'
...
@@ -2,7 +2,13 @@ import React, { useState, useEffect } from 'react'
import
{
View
,
Text
,
Button
}
from
'@tarojs/components'
import
{
View
,
Text
,
Button
}
from
'@tarojs/components'
import
classNames
from
'classnames'
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
{
interface
ResultProps
{
score
:
'S'
|
'A'
|
'B'
;
score
:
'S'
|
'A'
|
'B'
;
...
@@ -14,7 +20,7 @@ interface ResultProps {
...
@@ -14,7 +20,7 @@ interface ResultProps {
onContinue
:
()
=>
void
;
onContinue
:
()
=>
void
;
}
}
const
SummaryResult
:
React
.
FC
<
ResultProps
>
=
({
const
SummaryResult
=
({
score
=
'B'
,
score
=
'B'
,
correctRate
=
'全队'
,
correctRate
=
'全队'
,
timeSpent
=
30
,
timeSpent
=
30
,
...
@@ -22,52 +28,38 @@ const SummaryResult: React.FC<ResultProps> = ({
...
@@ -22,52 +28,38 @@ const SummaryResult: React.FC<ResultProps> = ({
ranking
,
ranking
,
promoted
,
promoted
,
onContinue
,
onContinue
,
})
=>
{
}:
ResultProps
)
=>
{
const
[
result
,
setResult
]
=
useState
({
score
,
isFirstTime
,
ranking
})
const
[
result
,
setResult
]
=
useState
<
any
>
({
score
,
isFirstTime
,
ranking
})
const
[
animateScore
,
setAnimateScore
]
=
useState
(
false
)
const
bonusPoints
=
100
const
bonusPoints
=
100
const
selfRank
=
100
const
selfRank
=
100
const
allRanks
=
1000
const
allRanks
=
1000
useEffect
(()
=>
{
useEffect
(()
=>
{
setAnimateScore
(
true
)
// setAnimateScore(true)
setResult
({
score
,
isFirstTime
,
ranking
})
const
timer
=
setTimeout
(()
=>
{
// setResult({ score, isFirstTime, ranking })
setAnimateScore
(
false
)
},
500
)
return
()
=>
{
setTimeout
(
()
=>
{
clearTimeout
(
timer
)
setResult
({
score
:
'A'
}
)
}
}
,
1000
)
},
[
score
,
isFirstTime
,
ranking
])
},
[])
return
(
return
(
<
View
className=
"container"
>
<
View
className=
{
styles
.
container
}
>
<
View
className=
{
classNames
(
'score'
,
{
'zoom-in-animate'
:
animateScore
})
}
>
{
/* <ChallengeFailed>
<
Text
>
{
result
.
score
}
</
Text
>
</
View
>
<ChallengeSuccess>
<
View
className=
"stats"
>
<ScoreStats />
<
Text
>
正确率:
{
correctRate
}
%
</
Text
>
</ChallengeSuccess> */
}
<
Text
>
耗时:
{
timeSpent
}
秒
</
Text
>
</
View
>
{
/* <View className="score">
<
View
className=
"glorys"
>
<ScoreResult score={result.score} />
<
Text
>
成绩首次达成:
{
result
.
score
}
</
Text
>
</View> */
}
{
result
.
isFirstTime
?
(
{
/* <ScoreStats /> */
}
<
Text
>
排名首次达成:
{
result
.
ranking
}
</
Text
>
)
{
/* <Glorys /> */
}
:
(
<
Text
>
!
</
Text
>
<
Text
>
排名再次达成:
{
result
.
ranking
}
</
Text
>
<
View
className=
{
styles
.
continue_btn
}
>
)
}
{
promoted
&&
<
Text
>
升档成功:
{
bonusPoints
}
积分
</
Text
>
}
{
selfRank
>
0
&&
(
<
Text
>
排名:
{
selfRank
}
/
{
allRanks
}
</
Text
>
)
}
</
View
>
<
View
className=
"continue-btn"
>
<
Button
onClick=
{
onContinue
}
>
继续
</
Button
>
<
Button
onClick=
{
onContinue
}
>
继续
</
Button
>
</
View
>
</
View
>
</
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