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
d02e1063
Commit
d02e1063
authored
Apr 23, 2023
by
hewenhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 城市选择后才获取关卡
parent
bfac4025
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
main-component.tsx
src/pages/main/components/main-component.tsx
+3
-2
index.tsx
src/pages/main/components/tutorial/index.tsx
+6
-3
No files found.
src/pages/main/components/main-component.tsx
View file @
d02e1063
...
@@ -36,6 +36,7 @@ const MainPage = () => {
...
@@ -36,6 +36,7 @@ const MainPage = () => {
const
fetchAccount
=
useStoreActions
(
actions
=>
actions
.
userModel
.
fetchAccount
)
const
fetchAccount
=
useStoreActions
(
actions
=>
actions
.
userModel
.
fetchAccount
)
const
updateGroupGuideActive
=
useStoreActions
(
actions
=>
actions
.
guideModel
.
updateGroupGuideActive
)
const
updateGroupGuideActive
=
useStoreActions
(
actions
=>
actions
.
guideModel
.
updateGroupGuideActive
)
const
fetchTribeInfo
=
useStoreActions
(
actions
=>
actions
.
groupModel
.
fetchTribeInfo
)
const
fetchTribeInfo
=
useStoreActions
(
actions
=>
actions
.
groupModel
.
fetchTribeInfo
)
const
userInfo
=
useStoreState
(
state
=>
state
.
userModel
.
userInfo
)
const
nav
=
useMemo
(
getMenuButtonBoundingClientRect
,
[])
const
nav
=
useMemo
(
getMenuButtonBoundingClientRect
,
[])
...
@@ -85,7 +86,7 @@ const MainPage = () => {
...
@@ -85,7 +86,7 @@ const MainPage = () => {
},
[
player
,
isFocus
])
},
[
player
,
isFocus
])
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
isFocus
)
{
if
(
isFocus
&&
userInfo
.
city
)
{
fetchAccount
()
fetchAccount
()
const
tabbar
=
getTabBar
<
TabbarRef
>
(
page
)
const
tabbar
=
getTabBar
<
TabbarRef
>
(
page
)
...
@@ -112,7 +113,7 @@ const MainPage = () => {
...
@@ -112,7 +113,7 @@ const MainPage = () => {
},
200
)
},
200
)
})
})
}
}
},
[
isFocus
,
fetchAccount
,
fetchStage
,
page
,
scrollToCurrent
,
updateReady
])
},
[
isFocus
,
fetchAccount
,
fetchStage
,
page
,
scrollToCurrent
,
updateReady
,
userInfo
.
city
])
return
(
return
(
<>
<>
...
...
src/pages/main/components/tutorial/index.tsx
View file @
d02e1063
import
{
useState
,
useCallback
,
useEffect
}
from
'react'
import
{
useState
,
useCallback
,
useEffect
}
from
'react'
import
{
getAreaAndGrades
,
type
AreaAndGrades
}
from
'@/api'
import
{
getAreaAndGrades
,
type
AreaAndGrades
,
StageStatus
}
from
'@/api'
import
{
useStoreState
,
useStoreActions
}
from
'@/store/hooks'
import
{
useStoreState
,
useStoreActions
}
from
'@/store/hooks'
import
{
useFocus
}
from
'@/hooks'
import
{
useFocus
}
from
'@/hooks'
import
ModalArea
from
'./modal-area'
import
ModalArea
from
'./modal-area'
...
@@ -22,6 +22,7 @@ const Tutorial = () => {
...
@@ -22,6 +22,7 @@ const Tutorial = () => {
const
groupGuideActive
=
useStoreState
(
state
=>
state
.
guideModel
.
groupGuideActive
)
const
groupGuideActive
=
useStoreState
(
state
=>
state
.
guideModel
.
groupGuideActive
)
const
groupGuideStep
=
useStoreState
(
state
=>
state
.
guideModel
.
groupGuideStep
)
const
groupGuideStep
=
useStoreState
(
state
=>
state
.
guideModel
.
groupGuideStep
)
const
isGroupGuideComplete
=
useStoreState
(
state
=>
state
.
guideModel
.
isGroupGuideComplete
)
const
isGroupGuideComplete
=
useStoreState
(
state
=>
state
.
guideModel
.
isGroupGuideComplete
)
const
stageList
=
useStoreState
(
state
=>
state
.
mainModel
.
stageList
)
const
nextGroupGuide
=
useStoreActions
(
actions
=>
actions
.
guideModel
.
nextGroupGuide
)
const
nextGroupGuide
=
useStoreActions
(
actions
=>
actions
.
guideModel
.
nextGroupGuide
)
const
[
step
,
setStep
]
=
useState
(
0
)
const
[
step
,
setStep
]
=
useState
(
0
)
...
@@ -93,12 +94,14 @@ const Tutorial = () => {
...
@@ -93,12 +94,14 @@ const Tutorial = () => {
setStep
(
2
)
setStep
(
2
)
}
else
{
}
else
{
setStep
(
0
)
setStep
(
0
)
if
(
!
isMainGuideComplete
)
{
// 只有第一关才有
const
index
=
stageList
.
findIndex
(
c
=>
c
.
status
===
StageStatus
.
CURRENT
)
if
(
!
isMainGuideComplete
&&
index
===
0
)
{
updateGuideActive
(
true
)
updateGuideActive
(
true
)
}
}
}
}
}
}
},
[
isFocus
,
data
.
areas
,
isMainGuideComplete
,
updateGuideActive
,
loadData
,
userInfo
.
city
,
userInfo
.
grade
])
},
[
isFocus
,
data
.
areas
,
isMainGuideComplete
,
updateGuideActive
,
loadData
,
userInfo
.
city
,
userInfo
.
grade
,
stageList
])
if
(
!
enable
)
{
if
(
!
enable
)
{
return
null
return
null
...
...
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