Commit cfb790aa authored by m's avatar m

feat: update

parent 14f990d9
......@@ -80,7 +80,7 @@ const GameCompleteAchieve = () => {
hoverClass={styles.is_active}
onClick={handleContinue}
>
继续22
继续
</View>
</View>
)
......
......@@ -140,11 +140,12 @@
@include flexLayout(row, center, center);
gap: 13PX;
&.image {
.image {
flex: 1;
background-image: url('https://cdn.jkwljy.com/pk-math/gMAFXFRRH3frGsM2wCpyLUCdiNT/343x56');
}
&.hover_image {
.hover_image {
background-image: url('https://cdn.jkwljy.com/pk-math/3UiwFgrVHVQEcaPdxdf1XinBb64o/343x56');
}
......@@ -159,9 +160,6 @@
.long_image {
flex: 1;
padding-left: 60px;
gap: 24px;
@include flexLayout(row);
background-image: url('https://cdn.jkwljy.com/pk-math/3dPDWGQGwQFH3jksyqJZdzF3g9kF/400x112');
}
......
import { View, Text, Image } from '@tarojs/components'
import { useMemo, useState, useEffect } from 'react'
import { useMemo, useState, useEffect, useCallback } from 'react'
import { useRouter, redirectTo, useDidShow, getMenuButtonBoundingClientRect, useShareAppMessage, navigateTo } from '@tarojs/taro'
import classNames from 'classnames'
......@@ -33,7 +33,6 @@ const Prepare = () => {
const userInfo = useStoreState(state => state.userModel.userInfo)
const isSubmit = useStoreState(state => state.gameModel.isSubmit)
const tribeInfo = useStoreState(state => state.groupModel.tribeInfo)
const questionList = useStoreState(state => state.gameModel.questionList)
const stageList = useStoreState(state => state.mainModel.stageList)
const getStageDetail = useStoreActions(actions => actions.gameModel.getStageDetail)
const getQuestionList = useStoreActions(actions => actions.gameModel.getQuestionList)
......@@ -98,7 +97,6 @@ const Prepare = () => {
setTrue()
} else {
getQuestionList(+router.params.id || 1).then(() => {
console.log('questionList', questionList)
navigateTo({
url: `/pages/game/play/index?id=${router.params.id}`
})
......@@ -106,35 +104,42 @@ const Prepare = () => {
}
}
const onNext = () => {
const onNext = useCallback(() => {
const index = stageList.findIndex(item => item.id === stageDetail?.id)
const nextId = stageList[index + 1].id
if (nextId) {
navigateTo({ url: `/pages/prepare/index?id=${nextId}` })
const id = stageList[index + 1].id
if (id) {
navigateTo({ url: `/pages/prepare/index?id=${id}` })
updateState({ isSubmit: false })
}
}
}, [stageList, stageDetail?.id])
const renderFisrtActions = () => (
<Button size="large" onClick={handleClick} className={styles.challenge} image={styles.image} hoverImage={styles.hover_image}>
<Text className={styles.challenge_text}>开始闯关</Text>
<View className={styles.card} style={{ position: 'absolute', right: 50 }}>
<Image className={styles.card_icon} src={require('@/pages/main/assets/ph.png')} />
<Text className={styles.card_text}>-1</Text>
</View>
{stageDetail?.firstTime && <View className={styles.tip}>
<Text className={styles.tip_text}>首次免答题卡</Text>
</View>}
</Button>
<View className={styles.challenge}>
<Button size="large" onClick={handleClick} image={styles.image} hoverImage={styles.hover_image}>
<Text className={styles.challenge_text}>开始闯关</Text>
<View className={styles.card} style={{ position: 'absolute', right: 50 }}>
<Image className={styles.card_icon} src={require('@/pages/main/assets/ph.png')} />
<Text className={styles.card_text}>-1</Text>
</View>
{stageDetail?.firstTime && <View className={styles.tip}>
<Text className={styles.tip_text}>首次免答题卡</Text>
</View>}
</Button>
</View>
)
const renderAgainActions = () => (
<View className={styles.challenge}>
<Button onClick={onNext} size="large" image={styles.short_image} hoverImage={styles.short_hover_image}>
{stageDetail?.level && <Button onClick={onNext} size="large" image={styles.short_image} hoverImage={styles.short_hover_image}>
下一关
</Button>
<Button size="large" onClick={handleClick} image={styles.long_image} hoverImage={styles.long_hover_image}>
<View className={styles.card}>
</Button>}
<Button
size="large"
onClick={handleClick}
image={classNames(!stageDetail?.level ? styles.image : styles.long_image)}
hoverImage={classNames(!stageDetail?.level ? styles.hover_image : styles.long_hover_image)}
>
<View className={styles.card} style={{ marginRight: 12 }}>
<Image className={styles.card_icon} src={require('@/pages/main/assets/ph.png')} />
<Text className={styles.card_text}>-1</Text>
</View>
......@@ -159,7 +164,7 @@ const Prepare = () => {
</View>
</ShareView>}
{!isSubmit ? renderFisrtActions() : renderAgainActions()}
{isSubmit ? renderFisrtActions() : renderAgainActions()}
</View>
<AnswerCardModal isVisible={isVisible} onClose={setFalse}>
......
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