Commit a7ad0691 authored by hewenhao's avatar hewenhao

feat: update

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