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
acc860b3
Commit
acc860b3
authored
Apr 04, 2023
by
hewenhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: update
parent
a90fc4d7
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
31 deletions
+37
-31
complete-achieve.tsx
src/pages/game/complete/components/complete-achieve.tsx
+8
-2
constants.ts
src/pages/main/components/scene/constants.ts
+21
-0
index.tsx
src/pages/main/components/scene/index.tsx
+2
-20
main.tsx
src/pages/main/main.tsx
+6
-9
No files found.
src/pages/game/complete/components/complete-achieve.tsx
View file @
acc860b3
import
{
View
,
Image
,
Text
}
from
'@tarojs/components'
import
assets
from
'@/assets/oss/assets-complete'
import
{
useMemo
}
from
'react'
import
{
useMemo
,
useCallback
}
from
'react'
import
{
navigateBack
}
from
'@tarojs/taro'
import
classNames
from
'classnames'
import
{
useStoreState
}
from
'@/store/hooks'
import
{
StageLevel
}
from
'@/api'
...
...
@@ -68,11 +69,16 @@ const GameCompleteAchieve = () => {
return
Math
.
ceil
(
rankNo
/
500
)
*
500
},
[
rankNo
])
const
handleContinue
=
useCallback
(()
=>
{
navigateBack
()
},
[])
const
renderBtn
=
()
=>
(
<
View
className=
{
styles
.
footer
}
>
<
View
className=
{
styles
.
btn_continue
}
hoverClass=
{
styles
.
is_active
}
onClick=
{
handleContinue
}
>
继续
</
View
>
...
...
@@ -83,7 +89,7 @@ const GameCompleteAchieve = () => {
return
null
}
if
(
gameResult
.
errNum
>
0
)
{
if
(
gameResult
.
errNum
>
0
||
!
gameResult
.
level
)
{
return
(
<>
<
View
>
没关系,差一点就成功了! 加油!加油!
</
View
>
...
...
src/pages/main/components/scene/constants.ts
View file @
acc860b3
...
...
@@ -47,6 +47,27 @@ let evenIndex = 0
let
oddIndex
=
0
let
specialIndex
=
0
export
function
stageToParts
(
stageList
:
Stage
[]):
Part
[]
{
evenIndex
=
0
oddIndex
=
0
specialIndex
=
0
const
ret
:
Part
[]
=
[]
stageList
.
forEach
(
item
=>
{
const
last
=
ret
.
find
(
c
=>
c
.
number
===
(
item
.
part
||
0
))
if
(
last
)
{
last
.
stages
.
push
(
item
)
}
else
{
ret
.
push
({
number
:
item
.
part
??
0
,
stages
:
[
item
]
})
}
})
return
ret
}
export
function
groupRoundToSmallPart
(
list
:
Stage
[]):
SmallPart
[]
{
const
ret
:
SmallPart
[]
=
[]
let
flag
:
'even'
|
'odd'
=
'even'
...
...
src/pages/main/components/scene/index.tsx
View file @
acc860b3
...
...
@@ -2,34 +2,16 @@ import { View } from '@tarojs/components'
import
assets
from
'@/assets/oss/assets-main'
import
{
useMemo
}
from
'react'
import
LazeImage
from
'../lazy-image'
import
{
Part
,
Stage
}
from
'./constants'
import
{
stageToParts
,
type
Stage
}
from
'./constants'
import
ScenePart
from
'./part'
type
SceneProps
=
{
stageList
:
Stage
[];
}
function
toPart
(
stageList
:
Stage
[]):
Part
[]
{
const
ret
:
Part
[]
=
[]
stageList
.
forEach
(
item
=>
{
const
last
=
ret
.
find
(
c
=>
c
.
number
===
(
item
.
part
||
0
))
if
(
last
)
{
last
.
stages
.
push
(
item
)
}
else
{
ret
.
push
({
number
:
item
.
part
??
0
,
stages
:
[
item
]
})
}
})
return
ret
}
const
Scene
=
(
props
:
SceneProps
)
=>
{
const
partList
=
useMemo
(()
=>
{
return
toPart
(
props
.
stageList
)
return
stageToParts
(
props
.
stageList
)
},
[
props
.
stageList
])
return
(
...
...
src/pages/main/main.tsx
View file @
acc860b3
...
...
@@ -18,14 +18,8 @@ const MainPage = () => {
const
fetchStage
=
useStoreActions
(
actions
=>
actions
.
mainModel
.
fetchStage
)
const
stageList
=
useStoreState
(
state
=>
state
.
mainModel
.
stageList
)
const
fetchAccount
=
useStoreActions
(
actions
=>
actions
.
userModel
.
fetchAccount
)
useDidShow
(()
=>
{
fetchAccount
()
const
tabbar
=
getTabBar
<
TabbarRef
>
(
page
)
tabbar
?.
setSelected
(
0
)
})
const
[
nav
]
=
useState
(
getMenuButtonBoundingClientRect
())
const
scrollToCurrent
=
useCallback
((
callback
?:
()
=>
void
)
=>
{
const
height
=
getSystemInfoSync
().
windowHeight
pageScrollTo
({
...
...
@@ -35,7 +29,10 @@ const MainPage = () => {
})
},
[])
useEffect
(()
=>
{
useDidShow
(()
=>
{
fetchAccount
()
const
tabbar
=
getTabBar
<
TabbarRef
>
(
page
)
tabbar
?.
setSelected
(
0
)
fetchStage
().
then
(()
=>
{
setTimeout
(()
=>
{
scrollToCurrent
(()
=>
{
...
...
@@ -43,7 +40,7 @@ const MainPage = () => {
})
},
1000
)
})
}
,
[
scrollToCurrent
,
fetchStage
]
)
})
return
(
<>
...
...
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