Commit 26cf7ebb authored by m's avatar m
parents 6320a841 df5f52d7
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
font-weight: 500; font-weight: 500;
color: #465164; color: #465164;
min-height: 100%; min-height: 100%;
font-size: 32px; font-size: 40px;
font-weight: 500; font-weight: 500;
color: #465164; color: #465164;
line-height: 56px; line-height: 60px;
padding: 32px 32px 0 32px; padding: 32px 32px 0 32px;
box-sizing: border-box; box-sizing: border-box;
......
.content { .content {
font-size: 32px; font-size: 40px;
font-weight: 500; font-weight: 500;
color: #465164; color: #465164;
line-height: 58px; line-height: 60px;
flex: 1; flex: 1;
&.is_sample { &.is_sample {
......
...@@ -31,7 +31,6 @@ const StageTag = (props: StageTagProps) => { ...@@ -31,7 +31,6 @@ const StageTag = (props: StageTagProps) => {
useEffect(() => { useEffect(() => {
let observer: IntersectionObserver | null = null let observer: IntersectionObserver | null = null
console.log(ready, 111111111, isFocus)
const fn = () => { const fn = () => {
if (ready && isFocus) { if (ready && isFocus) {
const navVal = nav.current const navVal = nav.current
......
...@@ -7,12 +7,13 @@ import styles from './count-up.module.scss' ...@@ -7,12 +7,13 @@ import styles from './count-up.module.scss'
type CountUpProps = { type CountUpProps = {
isSubmit: boolean; isSubmit: boolean;
currentIndex: number; currentIndex: number;
id: string;
} }
const questionLength = 3 const questionLength = 3
const CountUp = (props: CountUpProps) => { const CountUp = (props: CountUpProps) => {
const { isSubmit, currentIndex } = props const { isSubmit, currentIndex, id } = props
const processInnerStyle = useMemo(() => { const processInnerStyle = useMemo(() => {
if (isSubmit) { if (isSubmit) {
...@@ -34,6 +35,7 @@ const CountUp = (props: CountUpProps) => { ...@@ -34,6 +35,7 @@ const CountUp = (props: CountUpProps) => {
<Image src={require('@/pages/game/play/assets/count-time.png')} className={styles.icon}></Image> <Image src={require('@/pages/game/play/assets/count-time.png')} className={styles.icon}></Image>
<count-up-time <count-up-time
exceedTime={20} exceedTime={20}
id={id}
startValue={0} startValue={0}
isDown={false} isDown={false}
/> />
......
...@@ -15,6 +15,7 @@ const Guide = (props: GuideProps) => { ...@@ -15,6 +15,7 @@ const Guide = (props: GuideProps) => {
const { onDone } = props const { onDone } = props
const [step, setStep] = useState(0) const [step, setStep] = useState(0)
const nav = useMemo(getMenuButtonBoundingClientRect, []) const nav = useMemo(getMenuButtonBoundingClientRect, [])
const [time, setTime] = useState(0)
const spriteTop = useMemo(() => { const spriteTop = useMemo(() => {
if (step > 0) { if (step > 0) {
...@@ -32,10 +33,10 @@ const Guide = (props: GuideProps) => { ...@@ -32,10 +33,10 @@ const Guide = (props: GuideProps) => {
<Scene2 spriteTop={spriteTop} onNext={() => setStep(2)} /> <Scene2 spriteTop={spriteTop} onNext={() => setStep(2)} />
)} )}
{step === 2 && ( {step === 2 && (
<Scene3 spriteTop={spriteTop} onNext={() => setStep(3)} /> <Scene3 spriteTop={spriteTop} onNext={(val: number) => { setStep(3); setTime(val) }} />
)} )}
{step === 3 && ( {step === 3 && (
<Scene4 spriteTop={spriteTop} onNext={() => setStep(4)} /> <Scene4 spriteTop={spriteTop} onNext={() => setStep(4)} time={time} />
)} )}
{step === 4 && ( {step === 4 && (
<Scene5 spriteTop={spriteTop} onNext={() => setStep(5)} /> <Scene5 spriteTop={spriteTop} onNext={() => setStep(5)} />
......
...@@ -2,8 +2,7 @@ import { View, Text, Image, ScrollView } from '@tarojs/components' ...@@ -2,8 +2,7 @@ import { View, Text, 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 { useBoolean } from '@/hooks'
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'
import PageFooter from '@/pages/game/play/components/page-footer' import PageFooter from '@/pages/game/play/components/page-footer'
...@@ -14,7 +13,7 @@ import CountUp from './components/count-up' ...@@ -14,7 +13,7 @@ import CountUp from './components/count-up'
type Scene3Props = { type Scene3Props = {
spriteTop: number; spriteTop: number;
onNext: () => void; onNext: (val: number) => void;
} }
type QuestionModel = { type QuestionModel = {
...@@ -24,12 +23,17 @@ type QuestionModel = { ...@@ -24,12 +23,17 @@ type QuestionModel = {
isSubmit: boolean; isSubmit: boolean;
updateState: Action<QuestionModel, Partial<State<QuestionModel>>>; updateState: Action<QuestionModel, Partial<State<QuestionModel>>>;
updateAnswer: Action<QuestionModel, string>; updateAnswer: Action<QuestionModel, string>;
goNext: Thunk<QuestionModel, (() => void) | void>; goNext: Thunk<QuestionModel, ((val: number) => void) | void>;
clearUserAnswers: Action<QuestionModel>; clearUserAnswers: Action<QuestionModel>;
updateWrong: Action<QuestionModel, boolean>; updateWrong: Action<QuestionModel, boolean>;
} }
const rightAnswers = ['15', '5', '18'] const rightAnswers = ['15', '5', '18']
const countupId = '__count_up_'
const getCounter = () => {
return getCurrentInstance()?.page?.selectComponent?.(`#${countupId}`) as any
}
const Scene3 = (props: Scene3Props) => { const Scene3 = (props: Scene3Props) => {
const { spriteTop, onNext } = props const { spriteTop, onNext } = props
...@@ -59,7 +63,8 @@ const Scene3 = (props: Scene3Props) => { ...@@ -59,7 +63,8 @@ const Scene3 = (props: Scene3Props) => {
_act.updateState({ wrong: false }) _act.updateState({ wrong: false })
}, 1000) }, 1000)
} else if (current === 2) { } else if (current === 2) {
cb?.() const counter = getCounter()?.getCount() ?? 0
cb?.(counter)
} else { } else {
_act.updateState({ current: current + 1 }) _act.updateState({ current: current + 1 })
} }
...@@ -117,7 +122,7 @@ const Scene3 = (props: Scene3Props) => { ...@@ -117,7 +122,7 @@ const Scene3 = (props: Scene3Props) => {
</View> </View>
<View className={styles.question}> <View className={styles.question}>
<CountUp currentIndex={state.current} isSubmit={state.isSubmit}></CountUp> <CountUp currentIndex={state.current} isSubmit={state.isSubmit} id={countupId}></CountUp>
<View className={styles.item}> <View className={styles.item}>
{questionList[state.current].content} {questionList[state.current].content}
</View> </View>
......
import { View, Text, Image, ScrollView } from '@tarojs/components' import { View, Text, Image, ScrollView } from '@tarojs/components'
import classNames from 'classnames' import classNames from 'classnames'
import { useFormatTick } from '@/hooks'
import assets from '@/assets/oss/assets-guide' import assets from '@/assets/oss/assets-guide'
import { useBoolean } from '@/hooks'
import cs from './index.module.scss' import cs from './index.module.scss'
import styles from './scene-4.module.scss' import styles from './scene-4.module.scss'
type Scene4Props = { type Scene4Props = {
spriteTop: number; spriteTop: number;
time: number;
onNext: () => void; onNext: () => void;
} }
const Scene4 = (props: Scene4Props) => { const Scene4 = (props: Scene4Props) => {
const { spriteTop, onNext } = props const { spriteTop, onNext, time } = props
const isActive = true const isActive = true
const timeFmt = useFormatTick(time * 1000)
return ( return (
<View className={cs.viewport}> <View className={cs.viewport}>
<View className={cs.viewport_body}> <View className={cs.viewport_body}>
...@@ -32,7 +36,7 @@ const Scene4 = (props: Scene4Props) => { ...@@ -32,7 +36,7 @@ const Scene4 = (props: Scene4Props) => {
</View> </View>
<View className={styles.tag_item}> <View className={styles.tag_item}>
<Image src={assets['time-count.png'].u} className={styles.tag_icon}></Image> <Image src={assets['time-count.png'].u} className={styles.tag_icon}></Image>
<View className={styles.tag_text}>全对</View> <View className={styles.tag_text}>{timeFmt.minutes}:{timeFmt.seconds}</View>
</View> </View>
</View> </View>
<View> <View>
......
...@@ -2,6 +2,7 @@ import { useEffect, useState, useCallback } from 'react' ...@@ -2,6 +2,7 @@ import { useEffect, useState, useCallback } from 'react'
import { View } from '@tarojs/components' import { View } from '@tarojs/components'
import { getStorage, StorageKeys } from '@/utils/storage' import { getStorage, StorageKeys } from '@/utils/storage'
import { silentLoginDeferred } from '@/utils/silent-login' import { silentLoginDeferred } from '@/utils/silent-login'
import { setNavigationBarColor } from '@tarojs/taro'
import Loading from '@/components/Loading' import Loading from '@/components/Loading'
import styles from './main.module.scss' import styles from './main.module.scss'
import MainComponent from './components/main-component' import MainComponent from './components/main-component'
...@@ -25,6 +26,14 @@ const MainPage = () => { ...@@ -25,6 +26,14 @@ const MainPage = () => {
}) })
}, []) }, [])
useEffect(() => {
if (isDone) {
setNavigationBarColor({ frontColor: '#ffffff', backgroundColor: '#000000' })
} else {
setNavigationBarColor({ frontColor: '#000000', backgroundColor: '#000000' })
}
}, [isDone])
if (!isReady) { if (!isReady) {
return ( return (
<View className={styles.loading}> <View className={styles.loading}>
......
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