Commit 37a83ece authored by hewenhao's avatar hewenhao

feat: update

parent 0becbf0b
......@@ -2,11 +2,11 @@
import { requestAfterSilentLogin } from '@/utils/request'
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 => ({
url: '/service-idea/stage/startStage',
method: 'GET',
data: { stageId, userId: userInfo?.userId }
data: { stageId, userId: userInfo?.userId, normal }
}))
}
......
......@@ -286,7 +286,11 @@ const gameModel: GameModel = {
getQuestionList: thunk(async (actions, round, helpers) => {
try {
// 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({
questionList: questionList.map(convertQuestion),
currentInputIndex: 0,
......
......@@ -67,11 +67,12 @@
.guide_content {
position: absolute;
top: 0;
top: 16px;
left: 0;
right: 0;
transform: translateY(-100%);
display: flex;
z-index: 1;
}
.card-body {
......@@ -94,7 +95,7 @@
right: -8px;
bottom: -8px;
border-radius: 32px;
border: 4px dashed #FFFFFF;
border: 8px dashed #FFFFFF;
}
}
}
......
......@@ -106,6 +106,12 @@ const Prepare = () => {
const completeGuide = useStoreActions(actions => actions.prepareModel.completeGuide)
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 () => {
/** 首次闯关引导完成 */
!guideComplete && await completeGuide()
......@@ -113,7 +119,7 @@ const Prepare = () => {
/** 首次闯关失败引导完成 */
isSubmit && !failGuideComplete && await completeFailGuide()
if (cardNum < 1 && !stageDetail?.firstTime) {
if (cardNum < 1 && !stageDetail?.firstTime && isNormal) {
setTrue()
} else {
if (isClickRef.current) return
......@@ -150,7 +156,7 @@ const Prepare = () => {
<Text className={styles.challenge_text}>开始闯关</Text>
<View className={styles.card} style={{ position: 'absolute', right: 60 }}>
<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>
{stageDetail?.firstTime && <View className={styles.tip}>
<Text className={styles.tip_text}>首次免答题卡</Text>
......@@ -219,10 +225,12 @@ const Prepare = () => {
image={classNames(!hasNextBtn ? styles.image : styles.long_image)}
hoverImage={classNames(!hasNextBtn ? styles.hover_image : styles.long_hover_image)}
>
{isNormal && (
<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>
)}
<Text className={styles.challenge_text}>再次提升</Text>
</Button>
</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