Commit d02e1063 authored by hewenhao's avatar hewenhao

feat: 城市选择后才获取关卡

parent bfac4025
......@@ -36,6 +36,7 @@ const MainPage = () => {
const fetchAccount = useStoreActions(actions => actions.userModel.fetchAccount)
const updateGroupGuideActive = useStoreActions(actions => actions.guideModel.updateGroupGuideActive)
const fetchTribeInfo = useStoreActions(actions => actions.groupModel.fetchTribeInfo)
const userInfo = useStoreState(state => state.userModel.userInfo)
const nav = useMemo(getMenuButtonBoundingClientRect, [])
......@@ -85,7 +86,7 @@ const MainPage = () => {
}, [player, isFocus])
useEffect(() => {
if (isFocus) {
if (isFocus && userInfo.city) {
fetchAccount()
const tabbar = getTabBar<TabbarRef>(page)
......@@ -112,7 +113,7 @@ const MainPage = () => {
}, 200)
})
}
}, [isFocus, fetchAccount, fetchStage, page, scrollToCurrent, updateReady])
}, [isFocus, fetchAccount, fetchStage, page, scrollToCurrent, updateReady, userInfo.city])
return (
<>
......
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 { useFocus } from '@/hooks'
import ModalArea from './modal-area'
......@@ -22,6 +22,7 @@ const Tutorial = () => {
const groupGuideActive = useStoreState(state => state.guideModel.groupGuideActive)
const groupGuideStep = useStoreState(state => state.guideModel.groupGuideStep)
const isGroupGuideComplete = useStoreState(state => state.guideModel.isGroupGuideComplete)
const stageList = useStoreState(state => state.mainModel.stageList)
const nextGroupGuide = useStoreActions(actions => actions.guideModel.nextGroupGuide)
const [step, setStep] = useState(0)
......@@ -93,12 +94,14 @@ const Tutorial = () => {
setStep(2)
} else {
setStep(0)
if (!isMainGuideComplete) {
// 只有第一关才有
const index = stageList.findIndex(c => c.status === StageStatus.CURRENT)
if (!isMainGuideComplete && index === 0) {
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) {
return null
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment