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
43a647e3
Commit
43a647e3
authored
Mar 26, 2023
by
hewenhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 首页
parent
24d90c96
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
123 additions
and
22 deletions
+123
-22
.env.testing
.env.testing
+2
-4
.oss
assets/round/.oss
+12
-0
up-bonus-arrow.png
assets/round/up-bonus-arrow.png
+0
-0
up-bonus.png
assets/round/up-bonus.png
+0
-0
assets-round.ts
src/assets/oss/assets-round.ts
+10
-0
chapter.module.scss
src/pages/main/components/chapter.module.scss
+0
-1
header.module.scss
src/pages/main/components/header.module.scss
+1
-0
constants.ts
src/pages/main/components/scene/constants.ts
+1
-0
index.tsx
src/pages/main/components/scene/index.tsx
+42
-8
round.module.scss
src/pages/main/components/scene/round.module.scss
+35
-0
round.tsx
src/pages/main/components/scene/round.tsx
+6
-0
short-cut.tsx
src/pages/main/components/short-cut.tsx
+3
-4
main.tsx
src/pages/main/main.tsx
+11
-5
No files found.
.env.testing
View file @
43a647e3
...
@@ -3,11 +3,9 @@
...
@@ -3,11 +3,9 @@
#构建模式
#构建模式
BUILD_MODE=production
BUILD_MODE=production
# 微信小程序appid wxa90a0810c0c52555 wxb1383b0817e6206b
WEAPP_ID=wx8f25def587982a19
WEAPP_ID=wxb1383b0817e6206b
# 服务器接口地址
# 服务器接口地址
SERVER_ENDPOINT=http://172.10.6
2.
70
SERVER_ENDPOINT=http://172.10.6
1.1
70
# 天御验证码App id
# 天御验证码App id
TARO_T_CAPTCHA_APP_ID=2034167834
TARO_T_CAPTCHA_APP_ID=2034167834
...
...
assets/round/.oss
View file @
43a647e3
...
@@ -94,5 +94,17 @@
...
@@ -94,5 +94,17 @@
"w": 192,
"w": 192,
"h": 80,
"h": 80,
"ossName": "/pk-math/4EfUGL88udGyL8osFRS6K8unorkb/192x80"
"ossName": "/pk-math/4EfUGL88udGyL8osFRS6K8unorkb/192x80"
},
"up-bonus-arrow.png": {
"u": "https://cdn.jkwljy.com/pk-math/Dt6tavQFh4eoHhg4uBW2dsmVacm/38x44",
"w": 38,
"h": 44,
"ossName": "/pk-math/Dt6tavQFh4eoHhg4uBW2dsmVacm/38x44"
},
"up-bonus.png": {
"u": "https://cdn.jkwljy.com/pk-math/3GCGt4XjNrPVSmCXYAqivEd9uNRa/70x28",
"w": 70,
"h": 28,
"ossName": "/pk-math/3GCGt4XjNrPVSmCXYAqivEd9uNRa/70x28"
}
}
}
}
assets/round/up-bonus-arrow.png
0 → 100644
View file @
43a647e3
1.24 KB
assets/round/up-bonus.png
0 → 100644
View file @
43a647e3
2.28 KB
src/assets/oss/assets-round.ts
View file @
43a647e3
...
@@ -80,5 +80,15 @@ export default {
...
@@ -80,5 +80,15 @@ export default {
"u"
:
"https://cdn.jkwljy.com/pk-math/4EfUGL88udGyL8osFRS6K8unorkb/192x80"
,
"u"
:
"https://cdn.jkwljy.com/pk-math/4EfUGL88udGyL8osFRS6K8unorkb/192x80"
,
"w"
:
192
,
"w"
:
192
,
"h"
:
80
"h"
:
80
},
"up-bonus-arrow.png"
:
{
"u"
:
"https://cdn.jkwljy.com/pk-math/Dt6tavQFh4eoHhg4uBW2dsmVacm/38x44"
,
"w"
:
38
,
"h"
:
44
},
"up-bonus.png"
:
{
"u"
:
"https://cdn.jkwljy.com/pk-math/3GCGt4XjNrPVSmCXYAqivEd9uNRa/70x28"
,
"w"
:
70
,
"h"
:
28
}
}
}
as
const
}
as
const
src/pages/main/components/chapter.module.scss
View file @
43a647e3
.chapter
{
.chapter
{
padding
:
28px
32px
30px
32px
;
padding
:
28px
32px
30px
32px
;
border-top
:
2px
solid
#03459C
;
background-color
:
#1786f7
;
background-color
:
#1786f7
;
background-image
:
url(../assets/chapter-bg.png)
;
background-image
:
url(../assets/chapter-bg.png)
;
background-size
:
100%
100%
;
background-size
:
100%
100%
;
...
...
src/pages/main/components/header.module.scss
View file @
43a647e3
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
.headerContent
{
.headerContent
{
position
:
relative
;
position
:
relative
;
z-index
:
2
;
z-index
:
2
;
border-bottom
:
2px
solid
#03459C
;
}
}
.bg
{
.bg
{
...
...
src/pages/main/components/scene/constants.ts
View file @
43a647e3
...
@@ -118,6 +118,7 @@ export type Round = {
...
@@ -118,6 +118,7 @@ export type Round = {
id
:
number
;
id
:
number
;
name
?:
string
;
name
?:
string
;
tag
?:
string
;
tag
?:
string
;
upBonus
?:
boolean
;
}
}
export
type
SmallPart
=
{
export
type
SmallPart
=
{
...
...
src/pages/main/components/scene/index.tsx
View file @
43a647e3
...
@@ -20,7 +20,8 @@ const dataList: Part[] = [
...
@@ -20,7 +20,8 @@ const dataList: Part[] = [
{
{
state
:
RoundState
.
Clear
,
state
:
RoundState
.
Clear
,
type
:
RoundType
.
Enhance
,
type
:
RoundType
.
Enhance
,
score
:
RoundScore
.
S
,
score
:
RoundScore
.
A
,
upBonus
:
true
,
tag
:
'top20'
,
tag
:
'top20'
,
name
:
'应用过关1'
,
name
:
'应用过关1'
,
id
:
2
,
id
:
2
,
...
@@ -37,6 +38,7 @@ const dataList: Part[] = [
...
@@ -37,6 +38,7 @@ const dataList: Part[] = [
state
:
RoundState
.
Clear
,
state
:
RoundState
.
Clear
,
type
:
RoundType
.
Strong
,
type
:
RoundType
.
Strong
,
score
:
RoundScore
.
A
,
score
:
RoundScore
.
A
,
upBonus
:
true
,
tag
:
'topn'
,
tag
:
'topn'
,
name
:
'计算达标3'
,
name
:
'计算达标3'
,
id
:
4
,
id
:
4
,
...
@@ -55,25 +57,57 @@ const dataList: Part[] = [
...
@@ -55,25 +57,57 @@ const dataList: Part[] = [
rounds
:
[
rounds
:
[
{
{
id
:
6
,
id
:
6
,
state
:
RoundState
.
UnLocked
,
state
:
RoundState
.
Clear
,
type
:
RoundType
.
Enhance
,
name
:
'计算达标1'
,
score
:
RoundScore
.
A
,
},
{
id
:
7
,
state
:
RoundState
.
Clear
,
type
:
RoundType
.
Strong
,
score
:
RoundScore
.
S
,
tag
:
'top20'
,
name
:
'计算达标1'
,
},
{
id
:
8
,
state
:
RoundState
.
Clear
,
type
:
RoundType
.
OneStop
,
score
:
RoundScore
.
S
,
tag
:
'top10'
,
name
:
'计算达标1'
,
name
:
'计算达标1'
,
},
},
{
id
:
7
},
{
{
id
:
8
},
id
:
9
,
{
id
:
9
}
state
:
RoundState
.
Clear
,
type
:
RoundType
.
Enhance
,
score
:
RoundScore
.
A
,
name
:
'计算达标1'
,
}
],
],
number
:
1
number
:
1
},
},
{
{
rounds
:
[{
id
:
10
},
{
id
:
11
},
{
id
:
12
},
{
id
:
13
},
{
id
:
14
},
{
id
:
15
}],
rounds
:
[
{
id
:
10
,
type
:
RoundType
.
Enhance
,
state
:
RoundState
.
UnLocked
,
name
:
'计算达标1'
},
{
id
:
11
},
{
id
:
12
,
type
:
RoundType
.
OneStop
,
},
{
id
:
13
,
type
:
RoundType
.
Enhance
,
},
{
id
:
14
},
{
id
:
15
,
type
:
RoundType
.
Enhance
,
}
],
number
:
2
number
:
2
},
},
{
{
rounds
:
[{
id
:
16
},
{
id
:
17
},
{
id
:
18
}],
rounds
:
[{
id
:
16
,
type
:
RoundType
.
Enhance
,
},
{
id
:
17
},
{
id
:
18
,
type
:
RoundType
.
OneStop
}],
number
:
3
number
:
3
},
},
{
{
rounds
:
[{
id
:
19
},
{
id
:
20
},
{
id
:
21
},
{
id
:
22
},
{
id
:
23
},
{
id
:
24
},
{
id
:
25
}],
rounds
:
[{
id
:
19
},
{
id
:
20
,
type
:
RoundType
.
OneStop
},
{
id
:
21
},
{
id
:
22
,
type
:
RoundType
.
Enhance
},
{
id
:
23
,
type
:
RoundType
.
OneStop
},
{
id
:
24
},
{
id
:
25
}],
number
:
4
number
:
4
},
},
]
]
...
...
src/pages/main/components/scene/round.module.scss
View file @
43a647e3
...
@@ -41,6 +41,41 @@
...
@@ -41,6 +41,41 @@
margin-left
:
-48px
;
margin-left
:
-48px
;
}
}
.upname
{
position
:
absolute
;
z-index
:
3
;
right
:
30px
;
bottom
:
0
;
width
:
70px
;
height
:
28px
;
}
.uparrow
{
position
:
absolute
;
z-index
:
3
;
right
:
2px
;
bottom
:
2px
;
width
:
38px
;
animation-name
:
updown
;
animation-timing-function
:
ease-out
;
animation-duration
:
1s
;
animation-iteration-count
:
infinite
;
animation-delay
:
0s
;
height
:
44px
;
}
@keyframes
updown
{
0
%
{
transform
:
translateY
(
-10px
);
}
50
%
{
transform
:
translateY
(
0px
);
}
100
%
{
transform
:
translateY
(
-10px
);
}
}
.tag
{
.tag
{
position
:
absolute
;
position
:
absolute
;
z-index
:
3
;
z-index
:
3
;
...
...
src/pages/main/components/scene/round.tsx
View file @
43a647e3
...
@@ -122,6 +122,12 @@ const RoundComp = (props: RoundProps) => {
...
@@ -122,6 +122,12 @@ const RoundComp = (props: RoundProps) => {
)
}
)
}
<
Image
src=
{
getScoreIcon
(
round
.
score
).
u
}
className=
{
styles
.
score
}
/>
<
Image
src=
{
getScoreIcon
(
round
.
score
).
u
}
className=
{
styles
.
score
}
/>
<
Image
src=
{
getClearIcon
(
round
.
type
).
u
}
className=
{
getIconClassNames
(
round
.
type
,
[
styles
.
clearIcon
])
}
/>
<
Image
src=
{
getClearIcon
(
round
.
type
).
u
}
className=
{
getIconClassNames
(
round
.
type
,
[
styles
.
clearIcon
])
}
/>
{
!!
round
.
upBonus
&&
(
<>
<
Image
src=
{
assets
[
'up-bonus.png'
].
u
}
className=
{
styles
.
upname
}
></
Image
>
<
Image
src=
{
assets
[
'up-bonus-arrow.png'
].
u
}
className=
{
styles
.
uparrow
}
></
Image
>
</>
)
}
</
View
>
</
View
>
)
)
}
}
...
...
src/pages/main/components/short-cut.tsx
View file @
43a647e3
...
@@ -12,7 +12,7 @@ type ShortCutProps = {
...
@@ -12,7 +12,7 @@ type ShortCutProps = {
}
}
const
ShortCut
=
(
props
:
ShortCutProps
)
=>
{
const
ShortCut
=
(
props
:
ShortCutProps
)
=>
{
const
[
isShow
,
setIsShow
]
=
useState
(
fals
e
)
const
[
isShow
,
setIsShow
]
=
useState
(
tru
e
)
const
[
isDown
,
setIsDown
]
=
useState
(
false
)
const
[
isDown
,
setIsDown
]
=
useState
(
false
)
const
scrollRef
=
useRef
(
0
)
const
scrollRef
=
useRef
(
0
)
const
lastEffectedScroll
=
useRef
(
0
)
const
lastEffectedScroll
=
useRef
(
0
)
...
@@ -27,12 +27,11 @@ const ShortCut = (props: ShortCutProps) => {
...
@@ -27,12 +27,11 @@ const ShortCut = (props: ShortCutProps) => {
const
show
=
intersectionRatio
>
0
const
show
=
intersectionRatio
>
0
setIsShow
(
show
)
setIsShow
(
show
)
if
(
show
)
{
setIsDown
(
lastEffectedScroll
.
current
<
scrollRef
.
current
)
setIsDown
(
lastEffectedScroll
.
current
<
scrollRef
.
current
)
}
lastEffectedScroll
.
current
=
scrollRef
.
current
lastEffectedScroll
.
current
=
scrollRef
.
current
})
})
return
()
=>
{
return
()
=>
{
if
(
observer
)
{
if
(
observer
)
{
observer
.
disconnect
()
observer
.
disconnect
()
...
@@ -45,7 +44,7 @@ const ShortCut = (props: ShortCutProps) => {
...
@@ -45,7 +44,7 @@ const ShortCut = (props: ShortCutProps) => {
<
View
className=
{
styles
.
shortcut
}
>
<
View
className=
{
styles
.
shortcut
}
>
<
View
className=
{
classNames
(
styles
.
shortcutInner
,
isShow
&&
styles
.
isShow
)
}
onClick=
{
props
.
onClick
}
>
<
View
className=
{
classNames
(
styles
.
shortcutInner
,
isShow
&&
styles
.
isShow
)
}
onClick=
{
props
.
onClick
}
>
<
Image
src=
{
assets
[
'short-cut-bg.png'
].
u
}
className=
{
styles
.
bg
}
></
Image
>
<
Image
src=
{
assets
[
'short-cut-bg.png'
].
u
}
className=
{
styles
.
bg
}
></
Image
>
<
Image
src=
{
assets
[
'short-cut-arrow.png'
].
u
}
className=
{
classNames
(
styles
.
arrow
,
isDown
&&
styles
.
isDown
)
}
></
Image
>
<
Image
src=
{
assets
[
'short-cut-arrow.png'
].
u
}
className=
{
classNames
(
styles
.
arrow
,
((
!
isShow
&&
isDown
)
||
(
isShow
&&
!
isDown
))
&&
styles
.
isDown
)
}
></
Image
>
</
View
>
</
View
>
</
View
>
</
View
>
)
)
...
...
src/pages/main/main.tsx
View file @
43a647e3
...
@@ -11,6 +11,7 @@ import styles from './main.module.scss'
...
@@ -11,6 +11,7 @@ import styles from './main.module.scss'
const
MainPage
=
()
=>
{
const
MainPage
=
()
=>
{
const
page
=
useMemo
(()
=>
getCurrentInstance
().
page
,
[])
const
page
=
useMemo
(()
=>
getCurrentInstance
().
page
,
[])
const
[
isReady
,
setIsReady
]
=
useState
(
false
)
useDidShow
(()
=>
{
useDidShow
(()
=>
{
const
tabbar
=
getTabBar
(
page
)
as
any
const
tabbar
=
getTabBar
(
page
)
as
any
...
@@ -18,19 +19,22 @@ const MainPage = () => {
...
@@ -18,19 +19,22 @@ const MainPage = () => {
})
})
const
[
nav
]
=
useState
(
getMenuButtonBoundingClientRect
())
const
[
nav
]
=
useState
(
getMenuButtonBoundingClientRect
())
const
scrollToCurrent
=
useCallback
(()
=>
{
const
scrollToCurrent
=
useCallback
((
callback
?:
()
=>
void
)
=>
{
const
height
=
getSystemInfoSync
().
windowHeight
const
height
=
getSystemInfoSync
().
windowHeight
pageScrollTo
({
pageScrollTo
({
selector
:
`#
${
CurrentRoundId
}
`
,
selector
:
`#
${
CurrentRoundId
}
`
,
offsetTop
:
-
height
/
2
offsetTop
:
-
height
/
2
,
complete
:
callback
})
})
},
[])
},
[])
useEffect
(()
=>
{
useEffect
(()
=>
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
scrollToCurrent
()
scrollToCurrent
(()
=>
{
setIsReady
(
true
)
})
},
1000
)
},
1000
)
},
[])
},
[
scrollToCurrent
])
return
(
return
(
<
View
className=
{
styles
.
viewport
}
>
<
View
className=
{
styles
.
viewport
}
>
...
@@ -40,7 +44,9 @@ const MainPage = () => {
...
@@ -40,7 +44,9 @@ const MainPage = () => {
<
MainScene
/>
<
MainScene
/>
<
View
className=
{
styles
.
gap
}
></
View
>
<
View
className=
{
styles
.
gap
}
></
View
>
</
View
>
</
View
>
<
MainShortCut
onClick=
{
scrollToCurrent
}
/>
{
isReady
&&
(
<
MainShortCut
onClick=
{
()
=>
scrollToCurrent
()
}
/>
)
}
</
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