Commit 82cf6ed1 authored by hewenhao's avatar hewenhao

feat: update

parent 3d3edd8b
......@@ -306,6 +306,9 @@
"心善的",
"谦虚的",
"低调的",
"疯狂的",
"狂野的",
"奔放的",
"好客的",
"热心的",
"敬业的",
......
import { useState, useCallback, useEffect } from 'react'
import { useState, useCallback, useEffect, useRef } from 'react'
import { getAreaAndGrades, type AreaAndGrades, StageStatus } from '@/api'
import { useStoreState, useStoreActions } from '@/store/hooks'
import { useFocus } from '@/hooks'
......@@ -28,6 +28,7 @@ const Tutorial = () => {
const [step, setStep] = useState(0)
const [selected, setSelected] = useState({ area: '', grade: '' })
const [enable, setEnable] = useState(false)
const isLoadRef = useRef(false)
const isFocus = useFocus()
useEffect(() => {
......@@ -48,10 +49,11 @@ const Tutorial = () => {
const handleConfirm = useCallback(() => {
setStep(0)
if (!isMainGuideComplete) {
const index = stageList.findIndex(c => c.status === StageStatus.CURRENT)
if (!isMainGuideComplete && index === 0) {
updateGuideActive(true)
}
}, [updateGuideActive, isMainGuideComplete])
}, [updateGuideActive, isMainGuideComplete, stageList])
const loadData = useCallback(() => {
return getAreaAndGrades()
......@@ -87,6 +89,10 @@ const Tutorial = () => {
if (!data.areas.length) {
loadData()
}
if (isLoadRef.current) {
return
}
isLoadRef.current = true
// 没选择城市
if (!userInfo.city) {
setStep(1)
......@@ -112,7 +118,7 @@ const Tutorial = () => {
{step === 1 && <ModalArea options={data.areas} onConfirm={handleConfirmArea} loading={updating} />}
{step === 2 && !userInfo.grade && <ModalGrade options={data.grades} onConfirm={handleConfirmGrade} loading={updating} />}
{step === 3 && <ModalResult grade={selected.grade} onConfirm={handleConfirm} />}
{groupGuideActive && !isGroupGuideComplete && groupGuideStep === 0 && <ModalGroupGuide onConfirm={nextGroupGuide} />}
{step === 0 && groupGuideActive && !isGroupGuideComplete && groupGuideStep === 0 && <ModalGroupGuide onConfirm={nextGroupGuide} />}
</>
)
}
......
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