Commit cb4c5302 authored by hewenhao's avatar hewenhao

feat: update

parent 87931d7e
...@@ -94,5 +94,11 @@ ...@@ -94,5 +94,11 @@
"w": 440, "w": 440,
"h": 400, "h": 400,
"ossName": "/pk-math/2nnqRto1cBuiZVjgSgA3ZVFgBgRP/440x400" "ossName": "/pk-math/2nnqRto1cBuiZVjgSgA3ZVFgBgRP/440x400"
},
"fail-ip-1.png": {
"u": "https://cdn.jkwljy.com/pk-math/36jdXR2vuZH8FpKTZAji36dtpFfr/686x320",
"w": 686,
"h": 320,
"ossName": "/pk-math/36jdXR2vuZH8FpKTZAji36dtpFfr/686x320"
} }
} }
...@@ -160,5 +160,29 @@ ...@@ -160,5 +160,29 @@
"w": 64, "w": 64,
"h": 64, "h": 64,
"ossName": "/pk-math/3vsWjE3z8sWZh1xg9pa5cFh48ANZ/64x64" "ossName": "/pk-math/3vsWjE3z8sWZh1xg9pa5cFh48ANZ/64x64"
},
"cat-2.png": {
"u": "https://cdn.jkwljy.com/pk-math/2vuUKhVcvXW95JWog9yd9g7JeNhw/300x300",
"w": 300,
"h": 300,
"ossName": "/pk-math/2vuUKhVcvXW95JWog9yd9g7JeNhw/300x300"
},
"cat-3.png": {
"u": "https://cdn.jkwljy.com/pk-math/2c9Po46b3UTCjKNNVskjt8Vr3Qns/300x300",
"w": 300,
"h": 300,
"ossName": "/pk-math/2c9Po46b3UTCjKNNVskjt8Vr3Qns/300x300"
},
"cat-4.png": {
"u": "https://cdn.jkwljy.com/pk-math/4J8xBHWsx9jQZC8Y4x9A2ysVxJ2e/300x300",
"w": 300,
"h": 300,
"ossName": "/pk-math/4J8xBHWsx9jQZC8Y4x9A2ysVxJ2e/300x300"
},
"cat-5.png": {
"u": "https://cdn.jkwljy.com/pk-math/3YWpuPxzmfnebWaxqu36TTT4biLx/300x300",
"w": 300,
"h": 300,
"ossName": "/pk-math/3YWpuPxzmfnebWaxqu36TTT4biLx/300x300"
} }
} }
...@@ -80,5 +80,10 @@ export default { ...@@ -80,5 +80,10 @@ export default {
"u": "https://cdn.jkwljy.com/pk-math/2nnqRto1cBuiZVjgSgA3ZVFgBgRP/440x400", "u": "https://cdn.jkwljy.com/pk-math/2nnqRto1cBuiZVjgSgA3ZVFgBgRP/440x400",
"w": 440, "w": 440,
"h": 400 "h": 400
},
"fail-ip-1.png": {
"u": "https://cdn.jkwljy.com/pk-math/36jdXR2vuZH8FpKTZAji36dtpFfr/686x320",
"w": 686,
"h": 320
} }
} as const } as const
...@@ -135,5 +135,25 @@ export default { ...@@ -135,5 +135,25 @@ export default {
"u": "https://cdn.jkwljy.com/pk-math/3vsWjE3z8sWZh1xg9pa5cFh48ANZ/64x64", "u": "https://cdn.jkwljy.com/pk-math/3vsWjE3z8sWZh1xg9pa5cFh48ANZ/64x64",
"w": 64, "w": 64,
"h": 64 "h": 64
},
"cat-2.png": {
"u": "https://cdn.jkwljy.com/pk-math/2vuUKhVcvXW95JWog9yd9g7JeNhw/300x300",
"w": 300,
"h": 300
},
"cat-3.png": {
"u": "https://cdn.jkwljy.com/pk-math/2c9Po46b3UTCjKNNVskjt8Vr3Qns/300x300",
"w": 300,
"h": 300
},
"cat-4.png": {
"u": "https://cdn.jkwljy.com/pk-math/4J8xBHWsx9jQZC8Y4x9A2ysVxJ2e/300x300",
"w": 300,
"h": 300
},
"cat-5.png": {
"u": "https://cdn.jkwljy.com/pk-math/3YWpuPxzmfnebWaxqu36TTT4biLx/300x300",
"w": 300,
"h": 300
} }
} as const } as const
...@@ -164,16 +164,31 @@ ...@@ -164,16 +164,31 @@
} }
} }
.fail { .fail_icon {
display: flex; width: 686px;
align-items: center; height: 320px;
justify-content: center; position: absolute;
padding-top: 10vh; top: -304px;
left: 0;
animation-name: fadeInUp;
animation-duration: .5s;
animation-timing-function: ease-out;
animation-fill-mode: backwards;
animation-delay: .5s;
animation-iteration-count: 1;
z-index: 1;
} }
.fail_icon { @keyframes fadeInUp {
width: 498px; 0% {
height: 96px; opacity: 0;
transform: translateY(112px) scale(0.5, 0.5);
}
100% {
opacity: 1;
transform: translateY(0) scale(1, 1);
}
} }
.gap { .gap {
...@@ -193,5 +208,7 @@ ...@@ -193,5 +208,7 @@
font-weight: 600; font-weight: 600;
color: #FFFFFF; color: #FFFFFF;
line-height: 56px; line-height: 56px;
position: relative;
z-index: 2;
} }
...@@ -73,8 +73,13 @@ const GameCompleteAchieve = () => { ...@@ -73,8 +73,13 @@ const GameCompleteAchieve = () => {
navigateBack() navigateBack()
}, []) }, [])
const renderBtn = () => ( if (!gameResult) {
return null
}
const renderBtn = (ar?) => (
<View className={styles.footer}> <View className={styles.footer}>
{ar}
<View <View
className={styles.btn_continue} className={styles.btn_continue}
hoverClass={styles.is_active} hoverClass={styles.is_active}
...@@ -85,17 +90,12 @@ const GameCompleteAchieve = () => { ...@@ -85,17 +90,12 @@ const GameCompleteAchieve = () => {
</View> </View>
) )
if (!gameResult) {
return null
}
if (gameResult.errNum > 0 || !gameResult.level) { if (gameResult.errNum > 0 || !gameResult.level) {
return ( return (
<> <>
<View className={classNames(styles.wrap, styles.fail)}> {renderBtn((
<Image src={require('../assets/fail.png')} className={styles.fail_icon}></Image> <Image src={assets['fail-ip-1.png'].u} className={styles.fail_icon}></Image>
</View> ))}
{renderBtn()}
</> </>
) )
} }
......
...@@ -62,6 +62,33 @@ ...@@ -62,6 +62,33 @@
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
animation-name: fadeInUp;
animation-duration: .5s;
animation-timing-function: ease-out;
animation-fill-mode: backwards;
animation-iteration-count: 1;
&:nth-child(1) {
animation-delay: 0;
}
&:nth-child(2) {
animation-delay: .3s;
}
&:nth-child(3) {
animation-delay: .6s;
}
}
@keyframes fadeInUp {
0% {
opacity: 0;
transform: translateY(82px) scale(0.5, 0.5);
}
100% {
opacity: 1;
transform: translateY(0) scale(1, 1);
}
} }
.icon { .icon {
......
import { useState, useMemo } from 'react' import { useState, useMemo, useEffect } from 'react'
import { getMenuButtonBoundingClientRect } from '@tarojs/taro' import { getMenuButtonBoundingClientRect } from '@tarojs/taro'
import { preloadImage } from '@/utils/preload-image'
import assets from '@/assets/oss/assets-guide'
import Scene1 from './scene-1' import Scene1 from './scene-1'
import Scene2 from './scene-2' import Scene2 from './scene-2'
import Scene3 from './scene-3' import Scene3 from './scene-3'
...@@ -7,6 +9,18 @@ import Scene4 from './scene-4' ...@@ -7,6 +9,18 @@ import Scene4 from './scene-4'
import Scene5 from './scene-5' import Scene5 from './scene-5'
import Scene6 from './scene-6' import Scene6 from './scene-6'
let isLoad = false
const preloadGuideImages = () => {
if (isLoad) return
isLoad = true
const items: string[] = []
for (const key in assets) {
items.push(assets[key].u)
}
preloadImage(items)
}
type GuideProps = { type GuideProps = {
onDone: () => void; onDone: () => void;
} }
...@@ -17,6 +31,10 @@ const Guide = (props: GuideProps) => { ...@@ -17,6 +31,10 @@ const Guide = (props: GuideProps) => {
const nav = useMemo(getMenuButtonBoundingClientRect, []) const nav = useMemo(getMenuButtonBoundingClientRect, [])
const [time, setTime] = useState(0) const [time, setTime] = useState(0)
useEffect(() => {
preloadGuideImages()
}, [])
const spriteTop = useMemo(() => { const spriteTop = useMemo(() => {
if (step > 0) { if (step > 0) {
return nav.top + 5 + 24 return nav.top + 5 + 24
......
import { ScrollView, View, Image } from '@tarojs/components' import { ScrollView, View, Image } from '@tarojs/components'
import { useState, useCallback } from 'react' import { useState, useCallback } from 'react'
import classNames from 'classnames' import classNames from 'classnames'
import assets from '@/assets/oss/assets-guide'
import TextPrinter from './text-printer' import TextPrinter from './text-printer'
import cs from './index.module.scss' import cs from './index.module.scss'
...@@ -55,7 +56,15 @@ const Scene1 = ({ onNext }: Scene1Props) => { ...@@ -55,7 +56,15 @@ const Scene1 = ({ onNext }: Scene1Props) => {
<View className={cs.viewport_body}> <View className={cs.viewport_body}>
<ScrollView className={cs.viewport_body_inner} scrollY> <ScrollView className={cs.viewport_body_inner} scrollY>
<View className={cs.sprite}> <View className={cs.sprite}>
<Image src="https://cdn.jkwljy.com/pk-math/4Bzk3ySpYgXbHLZLhbn4Xdwu3cpE/300x300" className={cs.cat} /> {current === 0 && (
<Image src={assets['cat.png'].u} className={cs.cat} />
)}
{current === 1 && (
<Image src={assets['cat-2.png'].u} className={cs.cat} />
)}
{(current === 2 || current === 3) && (
<Image src={assets['cat-3.png'].u} className={cs.cat} />
)}
<View className={styles.dialog}> <View className={styles.dialog}>
{current === 0 && ( {current === 0 && (
<View className={styles.modal_1}> <View className={styles.modal_1}>
......
...@@ -50,7 +50,7 @@ const Scene2 = (props: Scene2Props) => { ...@@ -50,7 +50,7 @@ const Scene2 = (props: Scene2Props) => {
<View className={cs.viewport_body}> <View className={cs.viewport_body}>
<ScrollView className={cs.viewport_body_inner} scrollY> <ScrollView className={cs.viewport_body_inner} scrollY>
<View className={classNames(cs.sprite, cs.step_static)} style={{ paddingTop: `${spriteTop}px` }}> <View className={classNames(cs.sprite, cs.step_static)} style={{ paddingTop: `${spriteTop}px` }}>
<Image src="https://cdn.jkwljy.com/pk-math/4Bzk3ySpYgXbHLZLhbn4Xdwu3cpE/300x300" className={cs.cat} /> <Image src={assets['cat-3.png'].u} className={cs.cat} />
<View className={styles.modal_4} style={{ marginTop: `${spriteTop}px` }}> <View className={styles.modal_4} style={{ marginTop: `${spriteTop}px` }}>
<Text>请问同学有哪些<Text className={styles.em}>计算问题</Text>需要提高呢?<Text className={styles.select}>多选</Text></Text> <Text>请问同学有哪些<Text className={styles.em}>计算问题</Text>需要提高呢?<Text className={styles.select}>多选</Text></Text>
</View> </View>
......
import { View, Text, Image, ScrollView } from '@tarojs/components' import { View, Image, ScrollView } from '@tarojs/components'
import { useLocalStore, action, Action, Thunk, thunk, State } from 'easy-peasy' import { useLocalStore, action, Action, Thunk, thunk, State } from 'easy-peasy'
import classNames from 'classnames' import classNames from 'classnames'
import { useMemo } from 'react' import { useMemo } from 'react'
import assets from '@/assets/oss/assets-guide'
import { getCurrentInstance } from '@tarojs/taro' import { getCurrentInstance } from '@tarojs/taro'
import NumberKeyboard from '@/pages/game/play/components/number-keyboard' import NumberKeyboard from '@/pages/game/play/components/number-keyboard'
import MathSymbol from '@/pages/game/play/components/math-symbol' import MathSymbol from '@/pages/game/play/components/math-symbol'
...@@ -115,7 +116,7 @@ const Scene3 = (props: Scene3Props) => { ...@@ -115,7 +116,7 @@ const Scene3 = (props: Scene3Props) => {
<View className={cs.viewport_body}> <View className={cs.viewport_body}>
<ScrollView className={cs.viewport_body_inner} scrollY> <ScrollView className={cs.viewport_body_inner} scrollY>
<View className={classNames(cs.sprite, cs.step_static)} style={{ paddingTop: `${spriteTop}px` }}> <View className={classNames(cs.sprite, cs.step_static)} style={{ paddingTop: `${spriteTop}px` }}>
<Image src="https://cdn.jkwljy.com/pk-math/4Bzk3ySpYgXbHLZLhbn4Xdwu3cpE/300x300" className={cs.cat} /> <Image src={assets['cat-2.png'].u} className={cs.cat} />
<View className={styles.modal_4} style={{ marginTop: `${spriteTop}px` }}> <View className={styles.modal_4} style={{ marginTop: `${spriteTop}px` }}>
<View>我们来试试吧! </View> <View>我们来试试吧! </View>
<View>请在输入框填写答案</View> <View>请在输入框填写答案</View>
......
...@@ -61,7 +61,7 @@ const Scene4 = (props: Scene4Props) => { ...@@ -61,7 +61,7 @@ const Scene4 = (props: Scene4Props) => {
<View className={cs.viewport_body}> <View className={cs.viewport_body}>
<ScrollView className={cs.viewport_body_inner} scrollY> <ScrollView className={cs.viewport_body_inner} scrollY>
<View className={classNames(cs.sprite, cs.step_static)} style={{ paddingTop: `${spriteTop}px` }}> <View className={classNames(cs.sprite, cs.step_static)} style={{ paddingTop: `${spriteTop}px` }}>
<Image src="https://cdn.jkwljy.com/pk-math/4Bzk3ySpYgXbHLZLhbn4Xdwu3cpE/300x300" className={cs.cat} /> <Image src={assets['cat-4.png'].u} className={cs.cat} />
<View className={styles.modal_4} style={{ marginTop: `${spriteTop}px` }}> <View className={styles.modal_4} style={{ marginTop: `${spriteTop}px` }}>
<Text>恭喜你,表内乘除法,你掌握得不错哦</Text> <Text>恭喜你,表内乘除法,你掌握得不错哦</Text>
</View> </View>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
position: absolute; position: absolute;
top: 64px; top: 64px;
width: 468px; width: 468px;
height: 168px; height: 224px;
left: 250px; left: 250px;
background-image: url(https://cdn.jkwljy.com/pk-math/2LAQN5FBeoW6UrQEaRVQVP6HTU25/468x224); background-image: url(https://cdn.jkwljy.com/pk-math/2LAQN5FBeoW6UrQEaRVQVP6HTU25/468x224);
background-size: 100% 100%; background-size: 100% 100%;
......
...@@ -33,11 +33,11 @@ const Scene5 = (props: Scene5Props) => { ...@@ -33,11 +33,11 @@ const Scene5 = (props: Scene5Props) => {
<View className={cs.viewport_body}> <View className={cs.viewport_body}>
<ScrollView className={cs.viewport_body_inner} scrollY> <ScrollView className={cs.viewport_body_inner} scrollY>
<View className={classNames(cs.sprite, cs.step_static)} style={{ paddingTop: `${spriteTop}px` }}> <View className={classNames(cs.sprite, cs.step_static)} style={{ paddingTop: `${spriteTop}px` }}>
<Image src="https://cdn.jkwljy.com/pk-math/4Bzk3ySpYgXbHLZLhbn4Xdwu3cpE/300x300" className={cs.cat} /> <Image src={assets['cat-3.png'].u} className={cs.cat} />
<View className={styles.modal_4} style={{ marginTop: `${spriteTop}px` }}> <View className={styles.modal_4} style={{ marginTop: `${spriteTop}px` }}>
{isSubmit {isSubmit
? ( ? (
<Text>各类题型,已经为你准备好啦。我这个数学大</Text> <Text>各类题型,已经为你准备好啦。我这个数学大师不错吧!</Text>
) )
: ( : (
<Text>请问同学有哪些<Text className={styles.em}>计算问题</Text>需要提高呢?<Text className={styles.select}>多选</Text></Text> <Text>请问同学有哪些<Text className={styles.em}>计算问题</Text>需要提高呢?<Text className={styles.select}>多选</Text></Text>
......
...@@ -73,7 +73,7 @@ const Scene6 = (props: Scene6Props) => { ...@@ -73,7 +73,7 @@ const Scene6 = (props: Scene6Props) => {
<ScrollView className={cs.viewport_body_inner} scrollY> <ScrollView className={cs.viewport_body_inner} scrollY>
<View className={styles.full}> <View className={styles.full}>
<View className={classNames(cs.sprite, cs.step_static)} style={{ paddingTop: `${spriteTop}px` }}> <View className={classNames(cs.sprite, cs.step_static)} style={{ paddingTop: `${spriteTop}px` }}>
<Image src="https://cdn.jkwljy.com/pk-math/4Bzk3ySpYgXbHLZLhbn4Xdwu3cpE/300x300" className={cs.cat} /> <Image src={assets['cat-5.png'].u} className={cs.cat} />
<View className={styles.modal_4} style={{ marginTop: `${spriteTop}px` }}> <View className={styles.modal_4} style={{ marginTop: `${spriteTop}px` }}>
<View>请选择你的昵称</View> <View>请选择你的昵称</View>
<View className={styles.tips}>*仅用于排行榜展示哦</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