Commit 0daa1323 authored by hewenhao's avatar hewenhao

Merge branch 'feature/2023-06-12-v1.1' of…

Merge branch 'feature/2023-06-12-v1.1' of dev.jiuaoedu.com:hewenhao/GeekLearnMathWeapp into feature/2023-06-12-v1.1
parents e381c295 f28a156b
......@@ -16,3 +16,4 @@ _testing
/qr_output
/gen-mini-qr.js
.prettierrc
{
"prettier.singleQuote": true,
"prettier.semi": false
}
\ No newline at end of file
......@@ -7,7 +7,7 @@
export default {
pages: [
'pages/main/main',
'pages/pk/index',
'pages/battles/index',
'pages/prepare/index',
'pages/group/index',
'pages/market/index',
......
.wrapper {
position: fixed;
text-align: center;
top: 0;
left: 0;
width: 100%;
......@@ -29,7 +30,6 @@
.header {
border-radius: 32px 32px 0px 0px;
background-color: #465164;
text-align: center;
height: 88px;
line-height: 88px;
position: relative;
......
......@@ -5,7 +5,7 @@ import EyeProtectionView from '../EyeProtectionView'
import styles from './index.module.scss'
interface ModalProps {
tilte?: string;
tilte?: string | React.ReactNode;
isVisible: boolean;
wrapClassName?: string;
bodyClassName?: string;
......
.modalWrap {
text-align: left;
}
.modalBody {
background-color: #465164;
margin-top: -32px;
border-bottom-left-radius: 32px;
border-bottom-right-radius: 32px;
}
.inner {
background: #FFFFFF;
border-radius: 24px;
padding: 24px 20px;
}
.badgeIcon {
width: 240px;
height: 240px;
}
.badgeText {
font-weight: 600;
}
.badgeBar {
display: flex;
gap: 3PX;
.badgeBarItem {
width: 80px;
height: 20px;
background-color: #F0F2F9;
border-radius: 16px;
}
.active {
background-color: #FFC056;
}
}
.details {
display: flex;
gap: 32px;
padding: 0 24px;
align-items: center;
}
.detailsRight {
display: flex;
flex-direction: column;
gap: 16px;
justify-content: center;
}
.header {
display: flex;
justify-content: center;
align-items: center;
gap: 8px;
}
.line {
display: flex;
gap: 4PX;
flex-direction: column;
.lineLong, .lineShort {
height: 3PX;
background: #D9E3F3;
border-radius: 2PX;
}
.lineLong {
width: 132px;
}
.lineShort {
width: 32px;
}
}
.gameResult {
display: flex;
flex-direction: column;
gap: 16px;
max-height: 500px;
overflow: auto;
padding-right: 24px;
}
.gameBody {
background-color: #fff;
}
.playerSection {
display: flex;
align-items: center;
position: relative;
.userInfo:first-child {
border-bottom-left-radius: 20px;
}
.userInfo:last-child {
border-bottom-right-radius: 20px;
}
}
.userInfo {
flex: 1;
padding: 24px 30px;
}
.win {
background-color: #E5F4FE;
}
.lose {
background-color: #FEEDED;
}
\ No newline at end of file
import { View, Text, Image } from '@tarojs/components'
import classNames from 'classnames'
import Modal from '@/components/Modal'
import { useStoreState, useStoreActions } from '@/store/hooks'
import assets from '@/assets/oss/assets-pk'
import { badgeImages } from '../const'
import { UserInfo, GameResultProps } from './game-result'
import styles from './battles-modal.module.scss'
import gameResultStyles from './game-result.module.scss'
const BattlesModal = () => {
const isVisible = useStoreState(state => state.battlesModel.modalIsVisible)
const setModalIsVisible = useStoreActions(actions => actions.battlesModel.setModalIsVisible)
const levelInfo = {
name: '关卡',
result: true,
date: '9月22日 12:22',
}
const levelInfo2 = {
name: '关卡名称关卡名称',
result: false,
date: '9月22日 12:22',
}
const players = [
{
name: '用户名称用',
icon: 'string',
level: '青铜Ⅰ',
},
{
name: '用户2',
icon: 'string',
level: '青铜Ⅰ',
},
]
return (
<Modal
isVisible={isVisible}
wrapClassName={styles.modalWrap}
bodyClassName={styles.modalBody}
onClose={() => setModalIsVisible(false)}
tilte={<Text style={{ marginLeft: 10 }}>· PK 战报</Text>}
>
<View className={styles.inner}>
<View className={styles.header}>
<View className={styles.line} style={{ alignItems: 'flex-end' }}>
<Text className={styles.lineLong}></Text>
<Text className={styles.lineShort}></Text>
</View>
<Text>当前段位</Text>
<View className={styles.line}>
<Text className={styles.lineLong}></Text>
<Text className={styles.lineShort}></Text>
</View>
</View>
<View className={styles.details}>
<Image
src={assets[badgeImages.bronze.default].u}
className={styles.badgeIcon}
/>
<View className={styles.detailsRight}>
<Text className={styles.badgeText}>青铜 1</Text>
<View className={styles.badgeBar}>
<Text
className={classNames(styles.badgeBarItem, styles.active)}
></Text>
<Text className={classNames(styles.badgeBarItem)}></Text>
<Text className={classNames(styles.badgeBarItem)}></Text>
</View>
</View>
</View>
<View className={styles.gameResult}>
<GameResult levelInfo={levelInfo} players={players} />
<GameResult levelInfo={levelInfo2} players={players} />
<GameResult levelInfo={levelInfo} players={players} />
<GameResult levelInfo={levelInfo2} players={players} />
<GameResult levelInfo={levelInfo} players={players} />
</View>
</View>
</Modal>
)
}
const GameResult = ({ players, levelInfo }: GameResultProps) => {
return (
<View className={gameResultStyles.gameResult}>
<View
className={classNames(
gameResultStyles.levelInfo,
levelInfo.result ? gameResultStyles.win : gameResultStyles.lose
)}
>
<Text className={gameResultStyles.levelName}>{levelInfo.name}</Text>
<Image
mode="widthFix"
src={levelInfo.result ? assets['win.png'].u : assets['lose.png'].u}
className={gameResultStyles.levelResult}
/>
<Text className={gameResultStyles.levelDate}>{levelInfo.date}</Text>
</View>
<View className={styles.gameBody}>
<View className={styles.playerSection}>
<View className={classNames(styles.userInfo, levelInfo.result ? styles.win : styles.lose)}>
<UserInfo {...players[0]} />
</View>
<Image className={gameResultStyles.vs} src={assets['vs.png'].u} />
<View className={classNames(styles.userInfo, !levelInfo.result ? styles.win : styles.lose)}>
<UserInfo style={{ alignItems: 'flex-end' }} {...players[1]} />
</View>
</View>
</View>
</View>
)
}
export default BattlesModal
......@@ -84,56 +84,57 @@
.gameStats {
display: flex;
gap: 12px;
margin-top: 20px;
flex-direction: column;
}
.statsRow {
display: flex;
.stats {
position: relative;
justify-content: space-between;
display: flex;
flex-direction: column;
flex: 1;
gap: 16px;
.value {
height: 46px;
line-height: 46px;
}
.score {
color: #FE4E52;
font-weight: 500;
flex: 1;
font-size: 14PX;
font-weight: 500;
text-align: center;
background-color: #FEEDED;
}
font-size: 28px;
display: flex;
align-items: center;
justify-content: center;
gap: 6px;
}
.label {
&:nth-child(2) {
z-index: 2;
position: absolute;
left: 50%;
font-size: 24px;
transform: translateX(-50%);
text-align: center;
width: 112px;
.value {
font-size: 24px;
color: #fff;
background: #93A0B7;
border-radius: 24px;
width: 112px;
text-align: center;
}
}
}
.value {
flex: 1;
font-weight: 500;
text-align: center;
font-size: 28px;
.statsWin .value {
color: #009AFB;
background-color: #E5F4FE;
}
.statsLose .value {
color: #FE4E52;
background-color: #FEEDED;
}
.diamond {
width: 30px;
height: 30px;
}
\ No newline at end of file
.flex {
display: flex;
align-items: center;
justify-content: center;
gap: 6px;
}
\ No newline at end of file
......@@ -7,7 +7,7 @@ import assets2 from '@/assets/oss/assets-prepare'
import { badgeImages } from '../const'
import styles from './game-result.module.scss'
interface LevelInfo {
export interface LevelInfo {
name: string;
result: boolean;
date: string;
......@@ -25,7 +25,7 @@ interface Stat {
value: string;
}
interface GameResultProps {
export interface GameResultProps {
levelInfo: LevelInfo;
players: Player[];
gameStats?: Stat[];
......@@ -36,7 +36,7 @@ const GameResult = ({ players, levelInfo }: GameResultProps) => {
<View className={styles.gameResult}>
<View className={classNames(styles.levelInfo, levelInfo.result ? styles.win : styles.lose)}>
<Text className={styles.levelName}>{levelInfo.name}</Text>
<Image mode="widthFix" src={levelInfo.result ? assets['win.png'].u : assets['lose.png'].u} className={styles.levelResult} />
<Image mode="widthFix" src={assets[levelInfo.result ? 'win.png' : 'lose.png'].u} className={styles.levelResult} />
<Text className={styles.levelDate}>{levelInfo.date}</Text>
</View>
......@@ -46,13 +46,13 @@ const GameResult = ({ players, levelInfo }: GameResultProps) => {
<Image className={styles.vs} src={assets['vs.png'].u} />
<UserInfo style={{ alignItems: 'flex-end' }} {...players[1]} />
</View>
<GameStats />
<GameStats result={levelInfo.result} />
</View>
</View>
)
}
const UserInfo = (player: Player & { style?: CSSProperties }) => (
export const UserInfo = (player: Player & { style?: CSSProperties }) => (
<View style={player.style} className={styles.userInfo}>
<Text className={styles.userName}>{player.name}</Text>
<View className={styles.userBadge}>
......@@ -62,30 +62,32 @@ const UserInfo = (player: Player & { style?: CSSProperties }) => (
</View>
)
const GameStats = () => (
const GameStats = ({ result }: { result: boolean }) => {
return (
<View className={styles.gameStats}>
<View className={styles.statsRow}>
<Text className={styles.score}>错2题</Text>
<Text className={styles.label}>答题对错</Text>
<View className={classNames(styles.stats, result ? styles.statsWin : styles.statsLose)}>
<Text className={styles.value}>全队</Text>
</View>
<View className={styles.statsRow}>
<Text className={styles.score}>13.2s</Text>
<Text className={styles.label}>答题用时</Text>
<Text className={styles.value}>21.3s</Text>
</View>
<View className={styles.statsRow}>
<View className={classNames(styles.score, styles.flex)}>
<Text className={styles.value}>13.2s</Text>
<View className={classNames(styles.value)}>
<Image className={styles.diamond} src={assets2['diamond.png'].u} />
<Text>+10</Text>
</View>
<Text className={styles.label}>PK奖励</Text>
<View className={classNames(styles.value, styles.flex)}>
</View>
<View className={classNames(styles.stats)}>
<Text className={styles.value}>答题对错</Text>
<Text className={styles.value}>答题用时</Text>
<Text className={styles.value}>PK奖励</Text>
</View>
<View className={classNames(styles.stats, !result ? styles.statsWin : styles.statsLose)}>
<Text className={styles.value}>错2题</Text>
<Text className={styles.value}>23.2s</Text>
<View className={styles.value}>
<Image className={styles.diamond} src={assets2['diamond.png'].u} />
<Text>+5</Text>
<Text>+15</Text>
</View>
</View>
</View>
)
)
}
export default GameResult
......@@ -5,20 +5,20 @@
align-items: center;
gap: 16px;
.pkLine {
.line {
display: flex;
gap: 4PX;
flex-direction: column;
.pkLineLong, .pkLineShort {
.lineLong, .lineShort {
height: 3PX;
background: #D9E3F3;
border-radius: 2PX;
}
.pkLineLong {
.lineLong {
width: 132px;
}
.pkLineShort {
.lineShort {
width: 32px;
}
}
......@@ -39,6 +39,7 @@
.bottom {
position: fixed;
z-index: 999;
bottom: 0;
display: flex;
align-items: center;
......
......@@ -34,7 +34,7 @@ const players = [
}
]
const Pk = () => {
const Battles = () => {
const nav = useMemo(getMenuButtonBoundingClientRect, [])
return (
<View style={{ backgroundColor: '#F0F2F9' }}>
......@@ -43,14 +43,14 @@ const Pk = () => {
<PlayerDetails />
<View className={styles.pk}>
<View className={styles.pkLine} style={{ alignItems: 'flex-end' }}>
<Text className={styles.pkLineLong}></Text>
<Text className={styles.pkLineShort}></Text>
<View className={styles.line} style={{ alignItems: 'flex-end' }}>
<Text className={styles.lineLong}></Text>
<Text className={styles.lineShort}></Text>
</View>
<Text className={styles.pkTitle}>PK记录</Text>
<View className={styles.pkLine}>
<Text className={styles.pkLineLong}></Text>
<Text className={styles.pkLineShort}></Text>
<View className={styles.line}>
<Text className={styles.lineLong}></Text>
<Text className={styles.lineShort}></Text>
</View>
</View>
......@@ -68,4 +68,4 @@ const Pk = () => {
)
}
export default Pk
export default Battles
import { Action, action } from 'easy-peasy'
interface BattlesModel {
modalIsVisible: boolean;
setModalIsVisible: Action<BattlesModel, boolean>;
}
const battlesModel: BattlesModel = {
modalIsVisible: true,
setModalIsVisible: action((state, payload) => {
state.modalIsVisible = payload
})
}
export default battlesModel
......@@ -9,6 +9,7 @@ import { useMemo, useCallback, useEffect } from 'react'
import { useStoreActions, useStoreState } from '@/store/hooks'
import { useFocus } from '@/hooks/use-focus'
import { EyeProtectionView } from '@/components'
import BattlesModal from '@/pages/battles/components/battles-modal'
import Tutorial from '../components/tutorial'
import type { TabbarRef } from '../../../custom-tab-bar/index'
......@@ -130,6 +131,7 @@ const MainPage = () => {
)}
<ShareModal />
<Tutorial />
<BattlesModal />
<CreatePk visible={isCreatePkShow} />
</>
)
......
......@@ -2,6 +2,7 @@ import gameModel from '@/pages/game/play/model'
import mainModel from '@/pages/main/model'
import groupModel from '@/pages/group/model'
import prepareModel from '@/pages/prepare/model'
import battlesModel from '@/pages/battles/model'
import userModel from './modules/user'
import guideModel from './modules/guide'
......@@ -11,7 +12,8 @@ const appStoreModel = {
mainModel,
userModel,
groupModel,
guideModel
guideModel,
battlesModel
}
export default appStoreModel
......
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