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
e55d14af
Commit
e55d14af
authored
Mar 29, 2023
by
666
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: update
parent
95b665cd
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
293 additions
and
12 deletions
+293
-12
app.config.ts.tpl
scripts/app.config.ts.tpl
+2
-1
avatar.tsx
src/components/Skeleton/components/avatar.tsx
+30
-0
paragraph.tsx
src/components/Skeleton/components/paragraph.tsx
+40
-0
title.tsx
src/components/Skeleton/components/title.tsx
+23
-0
index.scss
src/components/Skeleton/index.scss
+73
-0
index.tsx
src/components/Skeleton/index.tsx
+52
-0
main.tsx
src/pages/main/main.tsx
+1
-1
index.tsx
src/pages/prepare/components/rank-list/index.tsx
+36
-6
study-league-rank.tsx
src/pages/prepare/components/study-league-rank.tsx
+2
-2
index.tsx
src/pages/prepare/index.tsx
+3
-2
index.config.ts
src/pages/study-market/index.config.ts
+4
-0
index.tsx
src/pages/study-market/index.tsx
+27
-0
No files found.
scripts/app.config.ts.tpl
View file @
e55d14af
...
...
@@ -7,9 +7,10 @@
export default {
pages: [
'pages/main/main',
'pages/prepare/index',
'pages/study-market/index',
'pages/group/index',
'pages/game/play/index',
'pages/prepare/index',
],
subPackages: {
{
packages
}
},
resizable: true,
...
...
src/components/Skeleton/components/avatar.tsx
0 → 100644
View file @
e55d14af
import
{
Image
}
from
'@tarojs/components'
import
classNames
from
'classnames'
export
interface
SkeletonAvatarProps
{
animate
?:
boolean
;
shape
?:
'circle'
|
'square'
;
size
?:
number
;
}
const
SkeletonAvatar
:
React
.
FC
<
SkeletonAvatarProps
>
=
({
animate
=
true
,
shape
=
'circle'
,
size
=
48
,
})
=>
{
const
avatarClass
=
classNames
(
'skeleton-avatar'
,
animate
?
'skeleton-loading'
:
null
,
shape
===
'circle'
?
'circle'
:
'square'
)
return
(
<
Image
src=
""
defaultSource=
"https://cdn.jkwljy.com/pbb/6gkGHSsPmxc_coeGYahBkelo_2w_/96x96"
className=
{
avatarClass
}
style=
{
{
width
:
size
,
height
:
size
}
}
/>
)
}
export
default
SkeletonAvatar
src/components/Skeleton/components/paragraph.tsx
0 → 100644
View file @
e55d14af
import
{
View
}
from
'@tarojs/components'
import
classNames
from
'classnames'
export
interface
SkeletonParagraphProps
{
animate
?:
boolean
;
rows
?:
number
;
gap
?:
number
;
height
?:
number
;
width
?:
string
|
number
|
(
string
|
number
)[];
}
const
SkeletonParagraph
:
React
.
FC
<
SkeletonParagraphProps
>
=
({
animate
=
true
,
rows
=
3
,
gap
=
8
,
height
=
16
,
width
=
'100%'
,
})
=>
{
const
paragraphRows
=
Array
.
from
({
length
:
rows
},
(
_
,
i
)
=>
{
const
rowWidth
=
Array
.
isArray
(
width
)
?
width
[
i
]
??
width
[
width
.
length
-
1
]
:
width
return
(
<
View
key=
{
i
}
className=
{
classNames
(
'skeleton-paragraph-row'
,
animate
?
'skeleton-loading'
:
null
,)
}
style=
{
{
width
:
rowWidth
,
height
}
}
/>
)
})
return
(
<
View
className=
"skeleton-paragraph"
style=
{
{
gap
:
`${gap}px`
}
}
>
{
paragraphRows
}
</
View
>
)
}
export
default
SkeletonParagraph
src/components/Skeleton/components/title.tsx
0 → 100644
View file @
e55d14af
import
{
View
}
from
'@tarojs/components'
import
classNames
from
'classnames'
export
interface
SkeletonTitleProps
{
animate
?:
boolean
;
height
?:
number
;
width
?:
string
|
number
;
}
const
SkeletonTitle
:
React
.
FC
<
SkeletonTitleProps
>
=
({
animate
=
true
,
height
=
16
,
width
=
'30%'
,
})
=>
{
return
(
<
View
className=
{
classNames
(
'skeleton-title'
,
animate
?
'skeleton-loading'
:
null
)
}
style=
{
{
width
,
height
}
}
/>
)
}
export
default
SkeletonTitle
src/components/Skeleton/index.scss
0 → 100644
View file @
e55d14af
.skeleton
{
display
:
flex
;
flex-direction
:
row
;
margin
:
8px
16px
;
gap
:
16px
;
&
-avatar
{
width
:
48px
;
height
:
48px
;
border-radius
:
50%
;
background-color
:
#f0f0f0
;
&
.circle
{
border-radius
:
50%
;
}
&
.square
{
border-radius
:
4px
;
}
}
&
-content
{
flex
:
1
;
}
&
-title
{
margin
:
12px
0
;
background-color
:
#f0f0f0
;
}
&
-paragraph
{
display
:
flex
;
flex-direction
:
column
;
width
:
100%
;
margin
:
12px
0
;
&
-row
{
height
:
32px
;
background-color
:
#f0f0f0
;
}
}
}
@keyframes
loading
{
0
%
{
background-position
:
100%
50%
;
}
100
%
{
background-position
:
0
50%
;
}
}
.skeleton-loading
{
background-image
:
linear-gradient
(
90deg
,
rgba
(
255
,
255
,
255
,
0
)
25%
,
rgba
(
255
,
255
,
255
,
0
.5
)
50%
,
rgba
(
255
,
255
,
255
,
0
)
75%
);
background-size
:
200%
100%
;
animation
:
loading
1
.5s
infinite
;
}
.skeleton-avatar.skeleton-loading
{
background-color
:
#f0f0f0
;
}
.skeleton-title.skeleton-loading
{
background-color
:
#f0f0f0
;
}
.skeleton-paragraph.skeleton-loading
{
background-color
:
#f0f0f0
;
}
src/components/Skeleton/index.tsx
0 → 100644
View file @
e55d14af
import
React
from
'react'
import
{
View
}
from
'@tarojs/components'
import
SkeletonAvatar
,
{
type
SkeletonAvatarProps
}
from
'./components/avatar'
import
SkeletonTitle
,
{
type
SkeletonTitleProps
}
from
'./components/title'
import
SkeletonParagraph
,
{
type
SkeletonParagraphProps
}
from
'./components/paragraph'
import
'./index.scss'
interface
SkeletonProps
{
loading
:
boolean
;
animate
?:
boolean
;
avatar
?:
SkeletonAvatarProps
|
boolean
;
title
?:
SkeletonTitleProps
|
boolean
;
paragraph
?:
SkeletonParagraphProps
|
boolean
;
children
?:
React
.
ReactNode
;
}
export
default
class
Skeleton
extends
React
.
Component
<
SkeletonProps
>
{
static
Avatar
:
typeof
SkeletonAvatar
static
Title
:
typeof
SkeletonTitle
static
Paragraph
:
typeof
SkeletonParagraph
render
()
{
const
{
loading
,
avatar
,
children
,
animate
=
true
,
title
=
true
,
paragraph
=
true
,
}
=
this
.
props
if
(
!
loading
)
{
return
children
}
return
(
<
View
className=
"skeleton"
>
{
avatar
&&
<
SkeletonAvatar
animate=
{
(
avatar
as
SkeletonAvatarProps
).
animate
||
animate
}
{
...
avatar
as
SkeletonAvatarProps
}
/>
}
<
View
className=
"skeleton-content"
>
{
title
&&
<
SkeletonTitle
animate=
{
(
title
as
SkeletonTitleProps
).
animate
||
animate
}
{
...
title
as
SkeletonTitleProps
}
/>
}
{
paragraph
&&
<
SkeletonParagraph
animate=
{
(
paragraph
as
SkeletonTitleProps
).
animate
||
animate
}
{
...
paragraph
as
SkeletonParagraphProps
}
/>
}
</
View
>
</
View
>
)
}
}
Skeleton
.
Avatar
=
SkeletonAvatar
Skeleton
.
Title
=
SkeletonTitle
Skeleton
.
Paragraph
=
SkeletonParagraph
src/pages/main/main.tsx
View file @
e55d14af
...
...
@@ -44,7 +44,7 @@ const MainPage = () => {
<
SceneContext
.
Provider
value=
{
{
ready
:
isReady
}
}
>
<
MainScene
/>
</
SceneContext
.
Provider
>
<
View
className=
{
styles
.
gap
}
></
View
>
{
/* <View className={styles.gap}></View> */
}
</
View
>
{
isReady
&&
(
<
MainShortCut
onClick=
{
()
=>
scrollToCurrent
()
}
/>
...
...
src/pages/prepare/components/rank-list/index.tsx
View file @
e55d14af
import
{
View
,
Button
,
Text
,
}
from
'@tarojs/components'
import
{
memo
}
from
'react'
import
{
View
,
Button
,
Text
,
ScrollView
}
from
'@tarojs/components'
import
{
memo
,
useMemo
}
from
'react'
import
classNames
from
'classnames'
import
{
useStoreState
}
from
'@/store/hooks'
import
useToggle
from
'@/hooks/useToggle'
...
...
@@ -11,7 +11,7 @@ import { User } from '../../types'
import
styles
from
'./index.module.scss'
const
RankList
:
React
.
FC
<
{
users
:
User
[]
}
>
=
({
users
})
=>
{
const
Scroll
RankList
:
React
.
FC
<
{
users
:
User
[]
}
>
=
({
users
})
=>
{
const
[
showAll
,
toggleShowAll
]
=
useToggle
()
const
{
currentUser
,
currentUserInTopThree
,
topThreeUsers
}
=
useStoreState
((
state
)
=>
state
.
prepareModel
)
...
...
@@ -25,7 +25,24 @@ const RankList: React.FC<{ users: User[] }> = ({ users }) => {
)
}
const
computeUsers
=
showAll
?
users
:
topThreeUsers
const
hasNextPage
=
true
const
loading
=
false
const
computedUsers
=
useMemo
(()
=>
{
if
(
showAll
)
{
return
users
}
return
topThreeUsers
},
[
showAll
,
users
,
topThreeUsers
])
const
scrollStyle
=
{
height
:
'400px'
,
background
:
'red'
}
const
loadMore
=
()
=>
{
console
.
log
(
'loadMore'
)
}
return
(
<
View
className=
{
styles
.
wrapper
}
>
...
...
@@ -40,8 +57,21 @@ const RankList: React.FC<{ users: User[] }> = ({ users }) => {
</
View
>
)
}
<
ScrollView
scrollY
enableFlex
scrollWithAnimation
style=
{
scrollStyle
}
onScrollToLower=
{
loadMore
}
>
<
View
style=
{
{
height
:
'300px'
}
}
>
A
</
View
>
<
View
style=
{
{
height
:
'300px'
}
}
>
B
</
View
>
<
View
style=
{
{
height
:
'300px'
}
}
>
C
</
View
>
{
hasNextPage
&&
!
loading
&&
<
Text
>
加载更多
</
Text
>
}
</
ScrollView
>
<
View
className=
{
styles
.
list
}
>
{
computeUsers
.
map
(
renderItem
)
}
{
compute
d
Users
.
map
(
renderItem
)
}
</
View
>
{
!
showAll
&&
(
...
...
@@ -53,4 +83,4 @@ const RankList: React.FC<{ users: User[] }> = ({ users }) => {
)
}
export
default
memo
(
RankList
)
export
default
memo
(
Scroll
RankList
)
src/pages/prepare/components/study-league-rank.tsx
View file @
e55d14af
import
{
View
,
Text
}
from
'@tarojs/components'
import
RankList
from
'./rank-list/index'
import
Scroll
RankList
from
'./rank-list/index'
import
{
User
}
from
'../types'
const
StudyLeagueRank
:
React
.
FC
<
{
users
:
User
[]
}
>
=
({
users
})
=>
{
return
(
<
View
>
<
RankList
users=
{
users
}
/>
<
Scroll
RankList
users=
{
users
}
/>
<
Text
>
立即创建
</
Text
>
</
View
>
)
...
...
src/pages/prepare/index.tsx
View file @
e55d14af
import
{
useEffect
}
from
'react'
import
Tabs
,
{
type
TabItem
}
from
'@/components/Tabs'
import
Skeleton
from
'@/components/Skeleton'
import
{
useStoreState
,
useStoreActions
}
from
'@/store/hooks'
import
Overview
from
'./components/overview/index'
import
RankList
from
'./components/rank-list/index'
import
Scroll
RankList
from
'./components/rank-list/index'
import
StudyLeagueRank
from
'./components/study-league-rank'
const
Prepare
:
React
.
FC
=
()
=>
{
...
...
@@ -16,7 +17,7 @@ const Prepare: React.FC = () => {
},
[
refresh
])
const
tabs
:
TabItem
[]
=
[
{
label
:
'成都排行榜'
,
children
:
<
RankList
users=
{
users
}
/>
},
{
label
:
'成都排行榜'
,
children
:
<
Scroll
RankList
users=
{
users
}
/>
},
{
label
:
'学习部落排行榜'
,
children
:
<
StudyLeagueRank
users=
{
users
}
/>
}
]
...
...
src/pages/study-market/index.config.ts
0 → 100644
View file @
e55d14af
export
default
definePageConfig
({
navigationBarTitleText
:
'pk-math'
,
navigationStyle
:
'custom'
})
src/pages/study-market/index.tsx
0 → 100644
View file @
e55d14af
import
{
useState
,
useEffect
}
from
'react'
import
Taro
,
{
getMenuButtonBoundingClientRect
}
from
'@tarojs/taro'
import
{
View
}
from
'@tarojs/components'
import
Skeleton
from
'@/components/Skeleton'
import
MainHeader
from
'../main/components/header'
const
StudyMarket
:
React
.
FC
=
()
=>
{
const
[
nav
]
=
useState
(
getMenuButtonBoundingClientRect
())
Taro
.
showLoading
({
title
:
'加载中'
,
mask
:
true
})
return
(
<
View
>
<
MainHeader
/>
<
View
style=
{
{
paddingTop
:
`${nav.height + nav.top + 5}px`
}
}
>
<
Skeleton
loading
/>
</
View
>
</
View
>
)
}
export
default
StudyMarket
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