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