Commit 37a83ece authored by hewenhao's avatar hewenhao

feat: update

parent 0becbf0b
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
import { requestAfterSilentLogin } from '@/utils/request' import { requestAfterSilentLogin } from '@/utils/request'
import { QuestionItem, type QuestionType } from '@/pages/game/play/types' import { QuestionItem, type QuestionType } from '@/pages/game/play/types'
export const getQuestionList = (stageId: number) => { export const getQuestionList = (stageId: number, normal: boolean = true) => {
return requestAfterSilentLogin<QuestionType[], { stageId: number, userId?: number }>(userInfo => ({ return requestAfterSilentLogin<QuestionType[], { stageId: number, userId?: number }>(userInfo => ({
url: '/service-idea/stage/startStage', url: '/service-idea/stage/startStage',
method: 'GET', method: 'GET',
data: { stageId, userId: userInfo?.userId } data: { stageId, userId: userInfo?.userId, normal }
})) }))
} }
......
...@@ -286,7 +286,11 @@ const gameModel: GameModel = { ...@@ -286,7 +286,11 @@ const gameModel: GameModel = {
getQuestionList: thunk(async (actions, round, helpers) => { getQuestionList: thunk(async (actions, round, helpers) => {
try { try {
// showLoading() // showLoading()
const { data: questionList } = await getQuestionList(round) const stageList = helpers.getStoreState().mainModel.stageList
const isFirstStage = stageList.findIndex(c => String(c.id) === String(round)) === 0
const stageDetail = helpers.getState().stageDetail
const isNormal = !isFirstStage || !!stageDetail?.level
const { data: questionList } = await getQuestionList(round, isNormal)
actions.updateState({ actions.updateState({
questionList: questionList.map(convertQuestion), questionList: questionList.map(convertQuestion),
currentInputIndex: 0, currentInputIndex: 0,
......
...@@ -67,11 +67,12 @@ ...@@ -67,11 +67,12 @@
.guide_content { .guide_content {
position: absolute; position: absolute;
top: 0; top: 16px;
left: 0; left: 0;
right: 0; right: 0;
transform: translateY(-100%); transform: translateY(-100%);
display: flex; display: flex;
z-index: 1;
} }
.card-body { .card-body {
...@@ -94,7 +95,7 @@ ...@@ -94,7 +95,7 @@
right: -8px; right: -8px;
bottom: -8px; bottom: -8px;
border-radius: 32px; border-radius: 32px;
border: 4px dashed #FFFFFF; border: 8px dashed #FFFFFF;
} }
} }
} }
......
...@@ -106,6 +106,12 @@ const Prepare = () => { ...@@ -106,6 +106,12 @@ const Prepare = () => {
const completeGuide = useStoreActions(actions => actions.prepareModel.completeGuide) const completeGuide = useStoreActions(actions => actions.prepareModel.completeGuide)
const completeFailGuide = useStoreActions(actions => actions.prepareModel.completeFailGuide) const completeFailGuide = useStoreActions(actions => actions.prepareModel.completeFailGuide)
const isNormal = useMemo(() => {
const isFirstStage = stageList.findIndex(stage => stage.id === +router.params.id) === 0
const isPassed = !!stageDetail?.level
return !isFirstStage || isPassed
}, [stageDetail, stageList, router])
const handleClick = async () => { const handleClick = async () => {
/** 首次闯关引导完成 */ /** 首次闯关引导完成 */
!guideComplete && await completeGuide() !guideComplete && await completeGuide()
...@@ -113,7 +119,7 @@ const Prepare = () => { ...@@ -113,7 +119,7 @@ const Prepare = () => {
/** 首次闯关失败引导完成 */ /** 首次闯关失败引导完成 */
isSubmit && !failGuideComplete && await completeFailGuide() isSubmit && !failGuideComplete && await completeFailGuide()
if (cardNum < 1 && !stageDetail?.firstTime) { if (cardNum < 1 && !stageDetail?.firstTime && isNormal) {
setTrue() setTrue()
} else { } else {
if (isClickRef.current) return if (isClickRef.current) return
...@@ -150,7 +156,7 @@ const Prepare = () => { ...@@ -150,7 +156,7 @@ const Prepare = () => {
<Text className={styles.challenge_text}>开始闯关</Text> <Text className={styles.challenge_text}>开始闯关</Text>
<View className={styles.card} style={{ position: 'absolute', right: 60 }}> <View className={styles.card} style={{ position: 'absolute', right: 60 }}>
<Image className={styles.card_icon} src={require('@/pages/main/assets/ph.png')} /> <Image className={styles.card_icon} src={require('@/pages/main/assets/ph.png')} />
{!stageDetail?.firstTime && <Text className={styles.card_text}>-1</Text>} {!stageDetail?.firstTime && isNormal && <Text className={styles.card_text}>-1</Text>}
</View> </View>
{stageDetail?.firstTime && <View className={styles.tip}> {stageDetail?.firstTime && <View className={styles.tip}>
<Text className={styles.tip_text}>首次免答题卡</Text> <Text className={styles.tip_text}>首次免答题卡</Text>
...@@ -219,10 +225,12 @@ const Prepare = () => { ...@@ -219,10 +225,12 @@ const Prepare = () => {
image={classNames(!hasNextBtn ? styles.image : styles.long_image)} image={classNames(!hasNextBtn ? styles.image : styles.long_image)}
hoverImage={classNames(!hasNextBtn ? styles.hover_image : styles.long_hover_image)} hoverImage={classNames(!hasNextBtn ? styles.hover_image : styles.long_hover_image)}
> >
{isNormal && (
<View className={styles.card} style={{ marginRight: 12 }}> <View className={styles.card} style={{ marginRight: 12 }}>
<Image className={styles.card_icon} src={require('@/pages/main/assets/ph.png')} /> <Image className={styles.card_icon} src={require('@/pages/main/assets/ph.png')} />
<Text className={styles.card_text}>-1</Text> <Text className={styles.card_text}>-1</Text>
</View> </View>
)}
<Text className={styles.challenge_text}>再次提升</Text> <Text className={styles.challenge_text}>再次提升</Text>
</Button> </Button>
</View> </View>
......
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