Commit d8bb0190 authored by hewenhao's avatar hewenhao

feat: 优化引导

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