Commit d8bb0190 authored by hewenhao's avatar hewenhao

feat: 优化引导

parent 479ce5c8
......@@ -26,7 +26,7 @@ export type TutorialRef = {
}
const Tutorial = () => {
const joinDefered = useStoreState(state => state.userModel.joinDefered)
const joinDeferred = useStoreState(state => state.userModel.joinDefered)
const updateUserInfo = useStoreActions(actions => actions.userModel.updateUserInfo)
const updateGuideActive = useStoreActions(actions => actions.guideModel.updateGuideActive)
const isMainGuideComplete = useStoreState(state => state.guideModel.isMainGuideComplete)
......@@ -46,10 +46,10 @@ const Tutorial = () => {
const isFocus = useFocus()
useEffect(() => {
if (!joinDefered) {
if (!joinDeferred) {
setEnable(false)
} else {
joinDefered.getPromise().then(() => {
joinDeferred.getPromise().then(() => {
setEnable(true)
})
}
......@@ -57,7 +57,7 @@ const Tutorial = () => {
return () => {
setEnable(false)
}
}, [joinDefered])
}, [joinDeferred])
const [data, setData] = useState<AreaAndGrades>({ areas: [], grades: [] })
......@@ -107,7 +107,9 @@ const Tutorial = () => {
if (isLoadRef.current) {
return
}
if (!userInfo.city || !userInfo.grade) {
isLoadRef.current = true
}
// 没选择城市
if (!userInfo.city) {
setStep(1)
......@@ -119,13 +121,14 @@ const Tutorial = () => {
if (stageList.length < 1) {
return
}
isLoadRef.current = true
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, stageList])
}, [isFocus, data.areas, isMainGuideComplete, updateGuideActive, loadData, userInfo.city, userInfo, 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