Commit a7ad0691 authored by hewenhao's avatar hewenhao

feat: update

parent 414216a4
......@@ -104,6 +104,12 @@ const Prepare = () => {
}
}
const isLast = useMemo(() => {
const len = stageList.length
const index = stageList.findIndex(c => c.id === stageDetail?.id)
return len - 1 === index
}, [stageList, stageDetail])
const onNext = useCallback(() => {
const index = stageList.findIndex(item => item.id === stageDetail?.id)
const id = stageList[index + 1].id
......@@ -111,7 +117,7 @@ const Prepare = () => {
navigateTo({ url: `/pages/prepare/index?id=${id}` })
updateState({ isSubmit: false })
}
}, [stageList, stageDetail?.id])
}, [stageList, stageDetail?.id, updateState])
const renderFisrtActions = () => (
<View className={styles.challenge}>
......@@ -130,9 +136,11 @@ const Prepare = () => {
const renderAgainActions = () => (
<View className={styles.challenge}>
{stageDetail?.level && <Button onClick={onNext} size="large" image={styles.short_image} hoverImage={styles.short_hover_image}>
{stageDetail?.level && isSubmit && !isLast && (
<Button onClick={onNext} size="large" image={styles.short_image} hoverImage={styles.short_hover_image}>
下一关
</Button>}
</Button>
)}
<Button
size="large"
onClick={handleClick}
......
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