Commit 87931d7e authored by hewenhao's avatar hewenhao

feat: update

parent fbe2f31a
......@@ -76,5 +76,23 @@
"w": 686,
"h": 112,
"ossName": "/pk-math/2CsZUPRwpdDQj41Co2dkdGNywHiM/686x112"
},
"fail-ip.png": {
"u": "https://cdn.jkwljy.com/pk-math/22BKe6dhFtEia7R5QPUb7J7JMoNL/660x320",
"w": 660,
"h": 320,
"ossName": "/pk-math/22BKe6dhFtEia7R5QPUb7J7JMoNL/660x320"
},
"right-ip-1.png": {
"u": "https://cdn.jkwljy.com/pk-math/4StKThAaPAandG6hHyvz8HYfgaw1/440x400",
"w": 440,
"h": 400,
"ossName": "/pk-math/4StKThAaPAandG6hHyvz8HYfgaw1/440x400"
},
"right-ip-2.png": {
"u": "https://cdn.jkwljy.com/pk-math/2nnqRto1cBuiZVjgSgA3ZVFgBgRP/440x400",
"w": 440,
"h": 400,
"ossName": "/pk-math/2nnqRto1cBuiZVjgSgA3ZVFgBgRP/440x400"
}
}
{
"cat.png": {
"u": "https://cdn.jkwljy.com/pk-math/2G8dDyjuzbMbZ94UhwCpn7zUpw7V/300x300",
"u": "https://cdn.jkwljy.com/pk-math/4Bzk3ySpYgXbHLZLhbn4Xdwu3cpE/300x300",
"w": 300,
"h": 300,
"ossName": "/pk-math/2G8dDyjuzbMbZ94UhwCpn7zUpw7V/300x300"
"ossName": "/pk-math/4Bzk3ySpYgXbHLZLhbn4Xdwu3cpE/300x300"
},
"modal-1.png": {
"u": "https://cdn.jkwljy.com/pk-math/eFWwoxVC4mzX1hZZojv23VEh9hz/500x180",
......
assets/guide/cat.png

33.1 KB | W: | H:

assets/guide/cat.png

35.9 KB | W: | H:

assets/guide/cat.png
assets/guide/cat.png
assets/guide/cat.png
assets/guide/cat.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -65,5 +65,20 @@ export default {
"u": "https://cdn.jkwljy.com/pk-math/2CsZUPRwpdDQj41Co2dkdGNywHiM/686x112",
"w": 686,
"h": 112
},
"fail-ip.png": {
"u": "https://cdn.jkwljy.com/pk-math/22BKe6dhFtEia7R5QPUb7J7JMoNL/660x320",
"w": 660,
"h": 320
},
"right-ip-1.png": {
"u": "https://cdn.jkwljy.com/pk-math/4StKThAaPAandG6hHyvz8HYfgaw1/440x400",
"w": 440,
"h": 400
},
"right-ip-2.png": {
"u": "https://cdn.jkwljy.com/pk-math/2nnqRto1cBuiZVjgSgA3ZVFgBgRP/440x400",
"w": 440,
"h": 400
}
} as const
......@@ -2,7 +2,7 @@
/* eslint-disable quote-props */
export default {
"cat.png": {
"u": "https://cdn.jkwljy.com/pk-math/2G8dDyjuzbMbZ94UhwCpn7zUpw7V/300x300",
"u": "https://cdn.jkwljy.com/pk-math/4Bzk3ySpYgXbHLZLhbn4Xdwu3cpE/300x300",
"w": 300,
"h": 300
},
......
......@@ -38,6 +38,15 @@
}
}
.fail_icon {
position: absolute;
left: 0;
width: 660px;
height: 320px;
top: -400px;
pointer-events: none;
}
.tips {
font-size: 36px;
font-weight: 400;
......
......@@ -2,6 +2,7 @@ import { View, RootPortal, Image, Text } from '@tarojs/components'
import { useCallback, useEffect, useRef } from 'react'
import classNames from 'classnames'
import { useStoreState, useStoreActions } from '@/store/hooks'
import assets from '@/assets/oss/assets-complete'
import styles from './modal-continue.module.scss'
......@@ -38,6 +39,9 @@ const ModalContinue = () => {
<View className={classNames(styles.mask, modalContinueVisible && styles.is_show)}>
</View>
<View className={classNames(styles.modal, modalContinueVisible && styles.is_show)}>
{modalContinueVisible && (
<Image src={assets['fail-ip.png'].u} className={styles.fail_icon} />
)}
<View className={styles.title}>是否继续闯关?</View>
<View className={styles.tips}>消耗<Text className={styles.em}>1</Text>张答题卡,复活继续闯关</View>
<View className={styles.tips}>还剩<Text className={styles.em}>{bornTimes}</Text>次复活机会</View>
......
......@@ -17,3 +17,27 @@
bottom: 0;
right: 0;
}
.right_icon {
position: fixed;
right: 0;
width: 440px;
height: 400px;
bottom: 400px;
pointer-events: none;
animation-name: fadeIn;
animation-duration: .3s;
animation-timing-function: ease-in;
animation-fill-mode: backwards;
animation-iteration-count: 1;
}
@keyframes fadeIn {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
import { View, ScrollView } from '@tarojs/components'
import { View, ScrollView, Image } from '@tarojs/components'
import { useStoreState, useStoreActions } from '@/store/hooks'
import { preloadImage } from '@/utils/preload-image'
import { useEffect, useMemo } from 'react'
......@@ -28,6 +28,7 @@ const preloadCompleteImages = () => {
const GamePlay = () => {
const currentQuestion = useStoreState(states => states.gameModel.currentQuestion)
const stageDetail = useStoreState(state => state.gameModel.stageDetail)
const rightIcon = useStoreState(state => state.gameModel.rightIcon)
const updateState = useStoreActions(actions => actions.gameModel.updateState)
const updateUserAnswer = useStoreActions(actions => actions.gameModel.updateUserAnswer)
......@@ -67,6 +68,9 @@ const GamePlay = () => {
{currentQuestion?.questionType !== '选择题' && (
<NumberKeyboard onClick={updateUserAnswer} />
)}
{rightIcon && (
<Image src={rightIcon} className={styles.right_icon}></Image>
)}
<PageFooter
clearUserAnswer={clearUserAnswer}
handleGoNext={handleGoNext}
......
import { action, Action, computed, Computed, Thunk, thunk } from 'easy-peasy'
import { AppStoreModel } from '@/store/store-model'
import { getQuestionList, type StageDetail, getStageDetail, completeStage, StageType, type CompleteStageOut, resumeGame, StageLevel } from '@/api'
import { getQuestionList, type StageDetail, getStageDetail, completeStage, StageType, type CompleteStageOut, resumeGame } from '@/api'
import { showLoading, hideLoading, showModal, redirectTo, vibrateShort, getCurrentInstance } from '@tarojs/taro'
import assets from '@/assets/oss/assets-complete'
import { palyAudio } from '@/utils/play-audio'
import audio from '@/assets/oss/assets-audio'
import {
......@@ -20,6 +21,12 @@ interface CompleteStageDetail extends CompleteStageOut {
const COUNTER_ID = 'z__countdown__'
const randomPick = (arr: string[]) => {
const len = arr.length
const randomIndex = Math.floor(Math.random() * len)
return arr[randomIndex]
}
const getCounter = () => {
return getCurrentInstance()?.page?.selectComponent?.(`#${COUNTER_ID}`) as any
}
......@@ -45,6 +52,8 @@ interface GameModelState {
/** 计时器id */
counterId: string;
rightIcon: string | null;
}
export interface GameModel extends GameModelState {
......@@ -85,6 +94,7 @@ const gameModel: GameModel = {
modalContinueVisible: false,
gameStartTime: 0,
isSubmit: false,
rightIcon: null,
stageDetail: null,
......@@ -191,6 +201,11 @@ const gameModel: GameModel = {
}
if (currentQuestionIndex > 0 && (currentQuestionIndex + 1) % 3 === 0) {
palyAudio(audio['回答正确--一战到底.wav'].u)
actions.updateState({ rightIcon: randomPick([assets['right-ip-1.png'].u, assets['right-ip-2.png'].u]) })
setTimeout(() => {
actions.updateState({ rightIcon: null })
}, 1300)
}
}
......
......@@ -55,7 +55,7 @@ const Scene1 = ({ onNext }: Scene1Props) => {
<View className={cs.viewport_body}>
<ScrollView className={cs.viewport_body_inner} scrollY>
<View className={cs.sprite}>
<Image src="https://cdn.jkwljy.com/pk-math/2G8dDyjuzbMbZ94UhwCpn7zUpw7V/300x300" className={cs.cat} />
<Image src="https://cdn.jkwljy.com/pk-math/4Bzk3ySpYgXbHLZLhbn4Xdwu3cpE/300x300" className={cs.cat} />
<View className={styles.dialog}>
{current === 0 && (
<View className={styles.modal_1}>
......
......@@ -50,7 +50,7 @@ const Scene2 = (props: Scene2Props) => {
<View className={cs.viewport_body}>
<ScrollView className={cs.viewport_body_inner} scrollY>
<View className={classNames(cs.sprite, cs.step_static)} style={{ paddingTop: `${spriteTop}px` }}>
<Image src="https://cdn.jkwljy.com/pk-math/2G8dDyjuzbMbZ94UhwCpn7zUpw7V/300x300" className={cs.cat} />
<Image src="https://cdn.jkwljy.com/pk-math/4Bzk3ySpYgXbHLZLhbn4Xdwu3cpE/300x300" className={cs.cat} />
<View className={styles.modal_4} style={{ marginTop: `${spriteTop}px` }}>
<Text>请问同学有哪些<Text className={styles.em}>计算问题</Text>需要提高呢?<Text className={styles.select}>多选</Text></Text>
</View>
......
......@@ -115,7 +115,7 @@ const Scene3 = (props: Scene3Props) => {
<View className={cs.viewport_body}>
<ScrollView className={cs.viewport_body_inner} scrollY>
<View className={classNames(cs.sprite, cs.step_static)} style={{ paddingTop: `${spriteTop}px` }}>
<Image src="https://cdn.jkwljy.com/pk-math/2G8dDyjuzbMbZ94UhwCpn7zUpw7V/300x300" className={cs.cat} />
<Image src="https://cdn.jkwljy.com/pk-math/4Bzk3ySpYgXbHLZLhbn4Xdwu3cpE/300x300" className={cs.cat} />
<View className={styles.modal_4} style={{ marginTop: `${spriteTop}px` }}>
<View>我们来试试吧! </View>
<View>请在输入框填写答案</View>
......
......@@ -61,7 +61,7 @@ const Scene4 = (props: Scene4Props) => {
<View className={cs.viewport_body}>
<ScrollView className={cs.viewport_body_inner} scrollY>
<View className={classNames(cs.sprite, cs.step_static)} style={{ paddingTop: `${spriteTop}px` }}>
<Image src="https://cdn.jkwljy.com/pk-math/2G8dDyjuzbMbZ94UhwCpn7zUpw7V/300x300" className={cs.cat} />
<Image src="https://cdn.jkwljy.com/pk-math/4Bzk3ySpYgXbHLZLhbn4Xdwu3cpE/300x300" className={cs.cat} />
<View className={styles.modal_4} style={{ marginTop: `${spriteTop}px` }}>
<Text>恭喜你,表内乘除法,你掌握得不错哦</Text>
</View>
......
......@@ -33,7 +33,7 @@ const Scene5 = (props: Scene5Props) => {
<View className={cs.viewport_body}>
<ScrollView className={cs.viewport_body_inner} scrollY>
<View className={classNames(cs.sprite, cs.step_static)} style={{ paddingTop: `${spriteTop}px` }}>
<Image src="https://cdn.jkwljy.com/pk-math/2G8dDyjuzbMbZ94UhwCpn7zUpw7V/300x300" className={cs.cat} />
<Image src="https://cdn.jkwljy.com/pk-math/4Bzk3ySpYgXbHLZLhbn4Xdwu3cpE/300x300" className={cs.cat} />
<View className={styles.modal_4} style={{ marginTop: `${spriteTop}px` }}>
{isSubmit
? (
......
......@@ -73,7 +73,7 @@ const Scene6 = (props: Scene6Props) => {
<ScrollView className={cs.viewport_body_inner} scrollY>
<View className={styles.full}>
<View className={classNames(cs.sprite, cs.step_static)} style={{ paddingTop: `${spriteTop}px` }}>
<Image src="https://cdn.jkwljy.com/pk-math/2G8dDyjuzbMbZ94UhwCpn7zUpw7V/300x300" className={cs.cat} />
<Image src="https://cdn.jkwljy.com/pk-math/4Bzk3ySpYgXbHLZLhbn4Xdwu3cpE/300x300" className={cs.cat} />
<View className={styles.modal_4} style={{ marginTop: `${spriteTop}px` }}>
<View>请选择你的昵称</View>
<View className={styles.tips}>*仅用于排行榜展示哦</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