Commit 0022e130 authored by m's avatar m

feat: update

parent a69d0710
import React from 'react' import React from 'react'
import { View, Text, Button } from '@tarojs/components' import { View, Text, Button } from '@tarojs/components'
// import Taro from '@tarojs/taro'
import Modal from '@/components/Modal' import Modal from '@/components/Modal'
import useToggle from '@/hooks/use-toggle' import useToggle from '@/hooks/use-toggle'
...@@ -7,10 +8,16 @@ import styles from './index.module.scss' ...@@ -7,10 +8,16 @@ import styles from './index.module.scss'
const LaunchQuest: React.FC = () => { const LaunchQuest: React.FC = () => {
const [isVisible, toggleModal] = useToggle() const [isVisible, toggleModal] = useToggle()
const navigateTo = () => {
toggleModal(false)
// Taro.navigateTo('/')
}
return ( return (
<> <>
<View className={styles.launchQuest}> <View className={styles.launchQuest}>
<Button onClick={() => toggleModal(true)}>开始闯关</Button> <Button onClick={navigateTo}>开始闯关</Button>
<Text className={styles.tip}> <Text className={styles.tip}>
首次免答题卡 首次免答题卡
{/* {hasFreePass ? '首次免答题卡' : '-1答题卡'} */} {/* {hasFreePass ? '首次免答题卡' : '-1答题卡'} */}
......
@import '@/styles/mixins.scss';
.breakthrough {
@include flexLayout(_, center, space-around);
}
\ No newline at end of file
import { Button, View } from '@tarojs/components'
import { useEffect } from 'react' import { useEffect } from 'react'
import Tabs, { type TabItem } from '@/components/Tabs' import Tabs, { type TabItem } from '@/components/Tabs'
import { useStoreState, useStoreActions } from '@/store/hooks' import { useStoreState, useStoreActions } from '@/store/hooks'
...@@ -6,6 +7,8 @@ import Overview from './components/overview/index' ...@@ -6,6 +7,8 @@ import Overview from './components/overview/index'
import ScrollRankList from './components/rank-list/index' import ScrollRankList from './components/rank-list/index'
import StudyLeagueRank from './components/study-league-rank' import StudyLeagueRank from './components/study-league-rank'
import styles from './index.module.scss'
const Prepare: React.FC = () => { const Prepare: React.FC = () => {
const { list: users } = useStoreState((state) => state.prepareModel) const { list: users } = useStoreState((state) => state.prepareModel)
const refresh = useStoreActions((actions) => actions.prepareModel.refresh) const refresh = useStoreActions((actions) => actions.prepareModel.refresh)
...@@ -20,10 +23,14 @@ const Prepare: React.FC = () => { ...@@ -20,10 +23,14 @@ const Prepare: React.FC = () => {
] ]
return ( return (
<> <View>
<Overview /> <Overview />
<Tabs items={tabs} /> <Tabs items={tabs} />
</> <View className={styles.breakthrough}>
<Button>继续闯关</Button>
<Button>再次努力,变得更棒</Button>
</View>
</View>
) )
} }
......
import { View, Text, Button } from '@tarojs/components' import { View, Text, Button, Input } from '@tarojs/components'
import Modal from '@/components/Modal' import Modal from '@/components/Modal'
import useToggle from '@/hooks/use-toggle' import useToggle from '@/hooks/use-toggle'
...@@ -21,6 +21,7 @@ const MysteryBox = () => { ...@@ -21,6 +21,7 @@ const MysteryBox = () => {
/> />
<Modal isVisible={isVisible} onClose={() => toggleModal(false)}> <Modal isVisible={isVisible} onClose={() => toggleModal(false)}>
<View> <View>
<Input type="number" />
<Text>兑换礼物</Text> <Text>兑换礼物</Text>
<Button size="mini" onClick={onClick}>兑换</Button> <Button size="mini" onClick={onClick}>兑换</Button>
</View> </View>
......
.container {
display: flex;
flex-direction: column;
justify-content: space-between;
height: 100%;
.score {
font-size: 3rem;
font-weight: bold;
text-align: center;
&.zoom-in-animate {
animation: fade-zoom-in 1s ease-in-out;
}
}
.stats {
display: flex;
justify-content: space-between;
padding: 0 1rem;
}
.glorys {
display: flex;
flex-direction: column;
gap: 0.5rem;
padding: 0 1rem;
}
.continue-btn {
display: flex;
justify-content:
center;
padding-bottom: 1rem;
}
}
@keyframes fade-zoom-in {
0% {
transform: scale(1);
opacity: 1;
}
50% {
transform: scale(1.5);
opacity: 0.5;
}
100% {
transform: scale(1);
opacity: 1;
}
}
\ No newline at end of file
import React, { useState, useEffect } from 'react'
import { View, Text, Button } from '@tarojs/components'
import classNames from 'classnames'
import './index.scss'
interface ResultProps {
score: 'S' | 'A' | 'B';
correctRate: string;
timeSpent: number;
isFirstTime: boolean;
ranking: number;
promoted: boolean;
onContinue: () => void;
}
const SummaryResult: React.FC<ResultProps> = ({
score = 'B',
correctRate = '全队',
timeSpent = 30,
isFirstTime,
ranking,
promoted,
onContinue,
}) => {
const [result, setResult] = useState({ score, isFirstTime, ranking })
const [animateScore, setAnimateScore] = useState(false)
const bonusPoints = 100
const selfRank = 100
const allRanks = 1000
useEffect(() => {
setAnimateScore(true)
setResult({ score, isFirstTime, ranking })
const timer = setTimeout(() => {
setAnimateScore(false)
}, 500)
return () => {
clearTimeout(timer)
}
}, [score, isFirstTime, ranking])
return (
<View className="container">
<View className={classNames('score', { 'zoom-in-animate': animateScore })}>
<Text>{result.score}</Text>
</View>
<View className="stats">
<Text>正确率:{correctRate}%</Text>
<Text>耗时:{timeSpent}秒</Text>
</View>
<View className="glorys">
<Text>成绩首次达成:{result.score}</Text>
{result.isFirstTime
? (
<Text>排名首次达成:{result.ranking}</Text>
)
: (
<Text>排名再次达成:{result.ranking}</Text>
)}
{promoted && <Text>升档成功:{bonusPoints}积分</Text>}
{selfRank > 0 && (
<Text>
排名:{selfRank}/{allRanks}
</Text>
)}
</View>
<View className="continue-btn">
<Button onClick={onContinue}>继续</Button>
</View>
</View>
)
}
export default SummaryResult
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