Commit 763c3cd1 authored by hewenhao's avatar hewenhao

Merge branch 'master' of dev.jiuaoedu.com:hewenhao/GeekLearnMathWeapp

parents 974597e5 981cc69e
{
"book.png": {
"u": "https://cdn.jkwljy.com/pk-math/3MGrLxB2s1SgCxFGdiwwuxWsoEbM/16x16",
"w": 16,
"h": 16,
"ossName": "/pk-math/3MGrLxB2s1SgCxFGdiwwuxWsoEbM/16x16"
},
"btn-bg.png": {
"u": "https://cdn.jkwljy.com/pk-math/wqn3LroohJgyzje32kf5rTzZEsk/343x56",
"w": 343,
"h": 56,
"ossName": "/pk-math/wqn3LroohJgyzje32kf5rTzZEsk/343x56"
},
"btn-disable-bg.png": {
"u": "https://cdn.jkwljy.com/pk-math/6cdTSagribNYm9FgpZxQWU3kqPx/343x56",
"w": 343,
"h": 56,
"ossName": "/pk-math/6cdTSagribNYm9FgpZxQWU3kqPx/343x56"
},
"clock-up.png": {
"u": "https://cdn.jkwljy.com/pk-math/XsJNS5H8rk9GCxzyGv2FdNTyzKE/26x26",
"w": 26,
"h": 26,
"ossName": "/pk-math/XsJNS5H8rk9GCxzyGv2FdNTyzKE/26x26"
},
"clock.png": {
"u": "https://cdn.jkwljy.com/pk-math/4F5p6aXmCT6zxQvCbGujYMVC6WUQ/22x22",
"w": 22,
"h": 22,
"ossName": "/pk-math/4F5p6aXmCT6zxQvCbGujYMVC6WUQ/22x22"
},
"diamond-un.png": {
"u": "https://cdn.jkwljy.com/pk-math/YgTVgodcdLLzDCWKws7vCouxcw9/32x32",
"w": 32,
"h": 32,
"ossName": "/pk-math/YgTVgodcdLLzDCWKws7vCouxcw9/32x32"
},
"diamond.png": {
"u": "https://cdn.jkwljy.com/pk-math/3Qt2wcpEeqbofSfcNPZSYauYeHyq/22x22",
"w": 22,
"h": 22,
"ossName": "/pk-math/3Qt2wcpEeqbofSfcNPZSYauYeHyq/22x22"
},
"fight.png": {
"u": "https://cdn.jkwljy.com/pk-math/jQZMsqNkwA8xtcRwBm9bYpjfawj/16x16",
"w": 16,
"h": 16,
"ossName": "/pk-math/jQZMsqNkwA8xtcRwBm9bYpjfawj/16x16"
},
"hook.png": {
"u": "https://cdn.jkwljy.com/pk-math/3gT6ezhpFrFcttGLwMH8fYkzHxkA/22x22",
"w": 22,
"h": 22,
"ossName": "/pk-math/3gT6ezhpFrFcttGLwMH8fYkzHxkA/22x22"
},
"level-a.png": {
"u": "https://cdn.jkwljy.com/pk-math/xnFXqF8qCYZCq42ajqDw7p9gmG6/32x32",
"w": 32,
"h": 32,
"ossName": "/pk-math/xnFXqF8qCYZCq42ajqDw7p9gmG6/32x32"
},
"level-b-un.png": {
"u": "https://cdn.jkwljy.com/pk-math/3pz5a4jAWvu2o5uMcNjR3VvJ1zDs/32x32",
"w": 32,
"h": 32,
"ossName": "/pk-math/3pz5a4jAWvu2o5uMcNjR3VvJ1zDs/32x32"
},
"level-b.png": {
"u": "https://cdn.jkwljy.com/pk-math/3wCPHwt2GaaDPyixo8aXWZwnr4m8/32x32",
"w": 32,
"h": 32,
"ossName": "/pk-math/3wCPHwt2GaaDPyixo8aXWZwnr4m8/32x32"
},
"level-big-a.png": {
"u": "https://cdn.jkwljy.com/pk-math/Q8bJDXouz8NrtjdCaaVpXwtv1fC/42x42",
"w": 42,
"h": 42,
"ossName": "/pk-math/Q8bJDXouz8NrtjdCaaVpXwtv1fC/42x42"
},
"level-big-b.png": {
"u": "https://cdn.jkwljy.com/pk-math/xjwQkKah5cRtPkuRaZBTrZmvWM5/42x42",
"w": 42,
"h": 42,
"ossName": "/pk-math/xjwQkKah5cRtPkuRaZBTrZmvWM5/42x42"
},
"level-big-s.png": {
"u": "https://cdn.jkwljy.com/pk-math/TZU5QTya4NNaP5PyvrUsv775krU/42x42",
"w": 42,
"h": 42,
"ossName": "/pk-math/TZU5QTya4NNaP5PyvrUsv775krU/42x42"
},
"level-s.png": {
"u": "https://cdn.jkwljy.com/pk-math/2u2TSypzoMo1GEgzLZxKYmAUPLfn/32x32",
"w": 32,
"h": 32,
"ossName": "/pk-math/2u2TSypzoMo1GEgzLZxKYmAUPLfn/32x32"
},
"strong.png": {
"u": "https://cdn.jkwljy.com/pk-math/UZ1GKC1sh8VYrg5HNnYWhu3dtNn/16x16",
"w": 16,
"h": 16,
"ossName": "/pk-math/UZ1GKC1sh8VYrg5HNnYWhu3dtNn/16x16"
},
"tip-bg.png": {
"u": "https://cdn.jkwljy.com/pk-math/4WgogFzhSYUSrvpmEE7JwoVg7SH5/122x42",
"w": 122,
"h": 42,
"ossName": "/pk-math/4WgogFzhSYUSrvpmEE7JwoVg7SH5/122x42"
},
"top-10.png": {
"u": "https://cdn.jkwljy.com/pk-math/3AWodWz1KHby825f99okdWqsHZmX/32x32",
"w": 32,
"h": 32,
"ossName": "/pk-math/3AWodWz1KHby825f99okdWqsHZmX/32x32"
},
"top-20.png": {
"u": "https://cdn.jkwljy.com/pk-math/wRyTdhoyDDvSRNiTB2MBsvukYhf/32x32",
"w": 32,
"h": 32,
"ossName": "/pk-math/wRyTdhoyDDvSRNiTB2MBsvukYhf/32x32"
},
"top-30.png": {
"u": "https://cdn.jkwljy.com/pk-math/2sqERu7oRY57P55RjCgJeFNKraYD/32x32",
"w": 32,
"h": 32,
"ossName": "/pk-math/2sqERu7oRY57P55RjCgJeFNKraYD/32x32"
},
"top-big-10.png": {
"u": "https://cdn.jkwljy.com/pk-math/3M3Cn7fMhKJUstYaAGZrhPDBWCz6/42x42",
"w": 42,
"h": 42,
"ossName": "/pk-math/3M3Cn7fMhKJUstYaAGZrhPDBWCz6/42x42"
},
"top-big-20.png": {
"u": "https://cdn.jkwljy.com/pk-math/xMfDgm13WUkoBWZcvxvaMfdoY2C/42x42",
"w": 42,
"h": 42,
"ossName": "/pk-math/xMfDgm13WUkoBWZcvxvaMfdoY2C/42x42"
},
"top-big-30.png": {
"u": "https://cdn.jkwljy.com/pk-math/N5GJ4RpzD6w42DefTfuUAENjN6G/42x42",
"w": 42,
"h": 42,
"ossName": "/pk-math/N5GJ4RpzD6w42DefTfuUAENjN6G/42x42"
},
"top-un.png": {
"u": "https://cdn.jkwljy.com/pk-math/B2JgEwC5aJLexwDDC6HXpvFGfLc/32x32",
"w": 32,
"h": 32,
"ossName": "/pk-math/B2JgEwC5aJLexwDDC6HXpvFGfLc/32x32"
},
"tribe.png": {
"u": "https://cdn.jkwljy.com/pk-math/49eWzrDDoiwa5xVsPqrVnhLJ3XWB/110x110",
"w": 110,
"h": 110,
"ossName": "/pk-math/49eWzrDDoiwa5xVsPqrVnhLJ3XWB/110x110"
},
"upgear-un.png": {
"u": "https://cdn.jkwljy.com/pk-math/au9CgV4Z4fN1Bh1kQoGKVfkfxbt/32x32",
"w": 32,
"h": 32,
"ossName": "/pk-math/au9CgV4Z4fN1Bh1kQoGKVfkfxbt/32x32"
},
"upgear.png": {
"u": "https://cdn.jkwljy.com/pk-math/MUku7NiTEjSurhw4TPRsepZKtx2/32x32",
"w": 32,
"h": 32,
"ossName": "/pk-math/MUku7NiTEjSurhw4TPRsepZKtx2/32x32"
}
}
......@@ -7,8 +7,8 @@
export default {
pages: [
'pages/main/main',
'pages/group/index',
'pages/prepare/index',
'pages/group/index',
'pages/study-market/index',
'pages/game/play/index',
'pages/game/complete/index',
......
......@@ -25,7 +25,7 @@ export const enum StageType {
export const enum StageLevel {
S = 'S',
A = 'A',
B = 'B'
B = 'B',
}
export interface Stage {
......
......@@ -56,11 +56,12 @@ export const queryTribePoint = () => {
}
export type MemberItem = {
groupId: number;
memberId: number;
memberName: number,
schoolName: number,
stageNum: number;
groupId?: number;
memberId?: number;
memberName?: number,
schoolName?: number,
stageNum?: number;
identity?: string;
}
export interface TribeInfo {
id?: number;
......
/* eslint-disable quotes */
/* eslint-disable quote-props */
export default {
"book.png": {
"u": "https://cdn.jkwljy.com/pk-math/3MGrLxB2s1SgCxFGdiwwuxWsoEbM/16x16",
"w": 16,
"h": 16
},
"btn-bg.png": {
"u": "https://cdn.jkwljy.com/pk-math/wqn3LroohJgyzje32kf5rTzZEsk/343x56",
"w": 343,
"h": 56
},
"btn-disable-bg.png": {
"u": "https://cdn.jkwljy.com/pk-math/6cdTSagribNYm9FgpZxQWU3kqPx/343x56",
"w": 343,
"h": 56
},
"clock-up.png": {
"u": "https://cdn.jkwljy.com/pk-math/XsJNS5H8rk9GCxzyGv2FdNTyzKE/26x26",
"w": 26,
"h": 26
},
"clock.png": {
"u": "https://cdn.jkwljy.com/pk-math/4F5p6aXmCT6zxQvCbGujYMVC6WUQ/22x22",
"w": 22,
"h": 22
},
"diamond-un.png": {
"u": "https://cdn.jkwljy.com/pk-math/YgTVgodcdLLzDCWKws7vCouxcw9/32x32",
"w": 32,
"h": 32
},
"diamond.png": {
"u": "https://cdn.jkwljy.com/pk-math/3Qt2wcpEeqbofSfcNPZSYauYeHyq/22x22",
"w": 22,
"h": 22
},
"fight.png": {
"u": "https://cdn.jkwljy.com/pk-math/jQZMsqNkwA8xtcRwBm9bYpjfawj/16x16",
"w": 16,
"h": 16
},
"hook.png": {
"u": "https://cdn.jkwljy.com/pk-math/3gT6ezhpFrFcttGLwMH8fYkzHxkA/22x22",
"w": 22,
"h": 22
},
"level-a.png": {
"u": "https://cdn.jkwljy.com/pk-math/xnFXqF8qCYZCq42ajqDw7p9gmG6/32x32",
"w": 32,
"h": 32
},
"level-b-un.png": {
"u": "https://cdn.jkwljy.com/pk-math/3pz5a4jAWvu2o5uMcNjR3VvJ1zDs/32x32",
"w": 32,
"h": 32
},
"level-b.png": {
"u": "https://cdn.jkwljy.com/pk-math/3wCPHwt2GaaDPyixo8aXWZwnr4m8/32x32",
"w": 32,
"h": 32
},
"level-big-a.png": {
"u": "https://cdn.jkwljy.com/pk-math/Q8bJDXouz8NrtjdCaaVpXwtv1fC/42x42",
"w": 42,
"h": 42
},
"level-big-b.png": {
"u": "https://cdn.jkwljy.com/pk-math/xjwQkKah5cRtPkuRaZBTrZmvWM5/42x42",
"w": 42,
"h": 42
},
"level-big-s.png": {
"u": "https://cdn.jkwljy.com/pk-math/TZU5QTya4NNaP5PyvrUsv775krU/42x42",
"w": 42,
"h": 42
},
"level-s.png": {
"u": "https://cdn.jkwljy.com/pk-math/2u2TSypzoMo1GEgzLZxKYmAUPLfn/32x32",
"w": 32,
"h": 32
},
"strong.png": {
"u": "https://cdn.jkwljy.com/pk-math/UZ1GKC1sh8VYrg5HNnYWhu3dtNn/16x16",
"w": 16,
"h": 16
},
"tip-bg.png": {
"u": "https://cdn.jkwljy.com/pk-math/4WgogFzhSYUSrvpmEE7JwoVg7SH5/122x42",
"w": 122,
"h": 42
},
"top-10.png": {
"u": "https://cdn.jkwljy.com/pk-math/3AWodWz1KHby825f99okdWqsHZmX/32x32",
"w": 32,
"h": 32
},
"top-20.png": {
"u": "https://cdn.jkwljy.com/pk-math/wRyTdhoyDDvSRNiTB2MBsvukYhf/32x32",
"w": 32,
"h": 32
},
"top-30.png": {
"u": "https://cdn.jkwljy.com/pk-math/2sqERu7oRY57P55RjCgJeFNKraYD/32x32",
"w": 32,
"h": 32
},
"top-big-10.png": {
"u": "https://cdn.jkwljy.com/pk-math/3M3Cn7fMhKJUstYaAGZrhPDBWCz6/42x42",
"w": 42,
"h": 42
},
"top-big-20.png": {
"u": "https://cdn.jkwljy.com/pk-math/xMfDgm13WUkoBWZcvxvaMfdoY2C/42x42",
"w": 42,
"h": 42
},
"top-big-30.png": {
"u": "https://cdn.jkwljy.com/pk-math/N5GJ4RpzD6w42DefTfuUAENjN6G/42x42",
"w": 42,
"h": 42
},
"top-un.png": {
"u": "https://cdn.jkwljy.com/pk-math/B2JgEwC5aJLexwDDC6HXpvFGfLc/32x32",
"w": 32,
"h": 32
},
"tribe.png": {
"u": "https://cdn.jkwljy.com/pk-math/49eWzrDDoiwa5xVsPqrVnhLJ3XWB/110x110",
"w": 110,
"h": 110
},
"upgear-un.png": {
"u": "https://cdn.jkwljy.com/pk-math/au9CgV4Z4fN1Bh1kQoGKVfkfxbt/32x32",
"w": 32,
"h": 32
},
"upgear.png": {
"u": "https://cdn.jkwljy.com/pk-math/MUku7NiTEjSurhw4TPRsepZKtx2/32x32",
"w": 32,
"h": 32
}
} as const
.head {
background-image: linear-gradient(to bottom, #B7CDEB 0%, #F1FAFF 87.0301573% , #FFFFFF 100%);
padding-bottom: 64px;
position: relative;
&.S {
background-image: linear-gradient(to bottom, #FFE4A1 0%, #FFFEF3 87.0301573% , #FFFFFF 100%);
}
&.A {
background-image: linear-gradient(to bottom, #B7CDEB 0%, #F1FAFF 87.0301573% , #FFFFFF 100%);
}
&.B {
background-image: linear-gradient(to bottom, #F4C09C 0%, #FFF7F2 87.0301573% , #FFFFFF 100%);
}
&.fail {
background-image: linear-gradient(to bottom, #CECECE 0%, #F1F2F3 87.0301573% , #FFFFFF 100%);
}
}
.bg {
......
......@@ -57,6 +57,19 @@ const getLevelText = (s?: StageLevel | null) => {
}
}
const getInearGradient = (s?: StageLevel | null) => {
switch (s) {
case StageLevel.S:
return styles.S
case StageLevel.A:
return styles.A
case StageLevel.B:
return styles.B
default:
return styles.fail
}
}
const GameCompleteHead = () => {
const nav = useMemo(getMenuButtonBoundingClientRect, [])
const gameResult = useStoreState(state => state.gameModel.gameResult)
......@@ -72,8 +85,16 @@ const GameCompleteHead = () => {
return getLevelBigBg(gameResult?.level)
}, [gameResult])
const linearGradient = useMemo(() => {
return getInearGradient(gameResult?.level)
}, [gameResult])
const text = useMemo(() => {
return getLevelText(gameResult?.level)
const { text: _text, second, color } = getLevelText(gameResult?.level)
if (gameResult?.levelBefore !== gameResult?.level) {
return { text: second, color }
}
return { text: _text, color }
}, [gameResult])
const style = useMemo(() => {
......@@ -87,7 +108,7 @@ const GameCompleteHead = () => {
}
return (
<View style={style} className={styles.head}>
<View style={style} className={classNames(styles.head, linearGradient)}>
<Image src={bg} className={styles.bg}></Image>
<View style={{ color: text.color }} className={styles.tips}>{text.text}</View>
<View className={styles.item_wrap}>
......
......@@ -71,7 +71,7 @@ const gameModel: GameModel = {
upGearReward: 40,
errNum: 0,
/** 成就等级:SAB */
level: StageLevel.S,
level: StageLevel.B,
levelTime: 50,
/** 排名 */
ranks: [],
......
......@@ -114,4 +114,20 @@
text-shadow: -1px 0 #1786F7, 0 1px #1786F7, 1px 0 #1786F7, 0 -1px #1786F7;
}
}
}
@keyframes upDown {
0% {
transform: translateY(0);
}
50% {
transform: translateY(-20px);
}
100% {
transform: translateY(0);
}
}
.upDownAnimation {
animation: upDown 2s infinite ease-in-out;
}
\ No newline at end of file
import { View, Text, Image } from '@tarojs/components'
import { showToast } from '@tarojs/taro'
import classNames from 'classnames'
import { useRequest } from '@/hooks'
import { queryTribePoint, getTribePoint } from '@/api/group'
import TextPrinter from './text-printer'
import ShareButton from './share-button'
import styles from './header.module.scss'
......@@ -41,20 +42,28 @@ const CroupHeader = ({ isCreator }: { isCreator: boolean }) => {
<View className={styles.members_content}>
<View className={styles.members_today} onClick={() => data && run()}>
<View className={styles.members_score}>
<Image className={styles.members_icon} src={require('@/pages/main/assets/score.png')} />
<Text className={styles.members_number}>+{data || 0}</Text>
<Image
src={require('@/pages/main/assets/score.png')}
className={classNames(styles.members_icon, data ? styles.upDownAnimation : '')}
/>
<Text className={classNames(styles.members_number, data ? styles.upDownAnimation : '')}>
+{data || 0}
</Text>
</View>
<Text className={styles.members_stroke}>今日部落津贴</Text>
</View>
<ShareButton>
<View className={styles.members_invite}>
<View className={styles.members_score}>
<Image className={styles.members_icon} src={require('@/pages/main/assets/score.png')} />
<Text className={styles.members_number}>+100</Text>
</View>
<Text className={styles.members_stroke}>成功邀请1人</Text>
<View className={styles.members_invite}>
<View className={styles.members_score}>
<Image
className={classNames(styles.members_icon, styles.upDownAnimation)}
src={require('@/pages/main/assets/score.png')}
/>
<Text className={classNames(styles.members_number, styles.upDownAnimation)}>
+100
</Text>
</View>
</ShareButton>
<Text className={styles.members_stroke}>成功邀请1人</Text>
</View>
</View>
</View>
)
......
......@@ -33,7 +33,6 @@
.scrollView {
position: relative;
top: -30px;
padding-bottom: 40px;
.item {
display: flex;
......@@ -94,7 +93,7 @@
}
&_invite {
position: absolute;
position: fixed;
left: 60px;
right: 60px;
bottom: 66PX;
......@@ -147,11 +146,18 @@
color: #fff;
}
}
}
@supports (bottom: constant(safe-area-inset-bottom)) or (bottom: env(safe-area-inset-bottom)) {
.members_invite {
bottom: calc(66PX + constant(safe-area-inset-bottom));
bottom: calc(66PX + env(safe-area-inset-bottom));
}
}
@supports (padding-bottom: constant(safe-area-inset-bottom)) or (padding-bottom: env(safe-area-inset-bottom)) {
.scrollView {
padding-bottom: calc(100PX + constant(safe-area-inset-bottom));
padding-bottom : calc(100PX + env(safe-area-inset-bottom));
}
}
\ No newline at end of file
import { useMemo } from 'react'
import { getSystemInfoSync } from '@tarojs/taro'
import { View, Image, Text, ScrollView } from '@tarojs/components'
import { View, Image, Text } from '@tarojs/components'
import { type MemberItem } from '@/api/group'
import { useStoreState } from '@/store/hooks'
......@@ -9,15 +7,10 @@ import ShareButton from './share-button'
import styles from './members.module.scss'
const Members = ({ tabBarHeight }: { tabBarHeight: number }) => {
const { windowHeight, safeArea } = getSystemInfoSync()
const Members = () => {
const userInfo = useStoreState(state => state.userModel.userInfo)
const { groupMembers, isEmpty } = useStoreState(state => state.groupModel)
const scrollHeight = useMemo(() => {
return `calc(${windowHeight}px - ${tabBarHeight * 2}rpx - 560rpx - 30px - ${safeArea?.top! * 2}rpx)`
}, [windowHeight, tabBarHeight, safeArea?.top])
const renderItem = (item: MemberItem, index: number) => {
const isCurrent = userInfo.userId === item.memberId
return (
......@@ -53,29 +46,13 @@ const Members = ({ tabBarHeight }: { tabBarHeight: number }) => {
<Text className={styles.thead_count}>通关数</Text>
</View>
<ScrollView
scrollY
scrollWithAnimation
// refresherEnabled
// refresherTriggered={isRefresh}
// onRefresherRefresh={onRefresh}
style={{ height: scrollHeight }}
>
<View className={styles.scrollView}>
{groupMembers.map(renderItem)}
{isEmpty && <View className={styles.empty}><Text>暂无数据</Text></View>}
</View>
</ScrollView>
<View className={styles.scrollView}>
{groupMembers.map(renderItem)}
{isEmpty && <View className={styles.empty}><Text>暂无数据</Text></View>}
</View>
<View className={styles.members_invite}>
<ShareButton className={styles.members_share}>
<View className={styles.members_tip}>
<Image className={styles.members_tip_icon} src={require('@/pages/main/assets/score.png')} />
<Text className={styles.members_tip_text}>+100</Text>
</View>
<Image className={styles.members_icon} src={require('../assets/icons/invite-small.png')} />
<Text className={styles.members_text}>邀请好友加入学习部落,一起PK math</Text>
</ShareButton>
<ShareButton />
</View>
</View>
)
......
import { Button } from '@tarojs/components'
import classNames from 'classnames'
import { View, Image, Text } from '@tarojs/components'
import ShareView from './share-view'
import styles from './share-button.module.scss'
import styles from './members.module.scss'
export default ({ children, className }: { children: React.ReactNode, className?: string }) => {
export default () => {
return (
<Button openType="share" plain style={{ border: 'none' }} className={classNames(styles.share, className)}>
{children}
</Button>
<ShareView className={styles.members_share}>
<View className={styles.members_tip}>
<Image className={styles.members_tip_icon} src={require('@/pages/main/assets/score.png')} />
<Text className={styles.members_tip_text}>+100</Text>
</View>
<Image className={styles.members_icon} src={require('../assets/icons/invite-small.png')} />
<Text className={styles.members_text}>邀请好友加入学习部落,一起PK math</Text>
</ShareView>
)
}
import { Button } from '@tarojs/components'
import classNames from 'classnames'
import styles from './share-view.module.scss'
export default ({
children,
className
}: { children: React.ReactNode, className?: string }) => {
return (
<Button openType="share" plain style={{ border: 'none' }} className={classNames(styles.wrapper, className)}>
{children}
</Button>
)
}
......@@ -22,8 +22,9 @@ const Group = () => {
const [isVisible, { setTrue, setFalse }] = useBoolean(false)
const [groupNo, setGroupNo] = useState<string>('')
const fetchTribeInfo = useStoreActions(actions => actions.groupModel.fetchTribeInfo)
const { tribeInfo, loading } = useStoreState(state => state.groupModel)
const userId = useStoreState(state => state.userModel.userInfo.userId)
const fetchTribeInfo = useStoreActions(actions => actions.groupModel.fetchTribeInfo)
const tabBarHeight = useMemo(() => {
return nav.height + nav.top + 5
......@@ -37,7 +38,7 @@ const Group = () => {
useShareAppMessage(() => {
return {
title: '来看看这个有趣的页面!',
path: '/pages/main/main',
path: `pages/main/main?code=${userId}`,
imageUrl: 'https://picx.zhimg.com/v2-7b7b072d4bebd5ccf48c04ec1146e844_1440w.jpg?',
}
})
......@@ -74,7 +75,7 @@ const Group = () => {
<MainHeader isCreator={!tribeInfo?.groupNo} />
<View>
{!tribeInfo?.groupNo ? <Creator onClick={setTrue} /> : <Members tabBarHeight={tabBarHeight} />}
{!tribeInfo?.groupNo ? <Creator onClick={setTrue} /> : <Members />}
</View>
</View>
......
@import '@/styles/mixins.scss';
.mask {
position: fixed;
left: 0;
top: 0;
bottom: 0;
right: 0;
background: rgba(0, 0, 0, 0.5);
z-index: 2000;
opacity: 0;
pointer-events: none;
transition: opacity .5s cubic-bezier(0.175,0.885,0.32,1.0);
&.visible {
opacity: 1;
pointer-events: all;
}
}
.modal {
position: fixed;
bottom: 0;
left: 0;
right: 0;
z-index: 2001;
background-color: #fff;
transform: translateY(100%);
transition: transform .5s cubic-bezier(0.175,0.885,0.32,1.0);
border-radius: 32px 32px 0px 0px;
text-align: center;
padding: 32PX 24PX;
&.visible {
transform: translateY(0);
}
.close {
position: absolute;
width: 20PX;
height: 20PX;
top: 12PX;
right: 24PX;
}
.title {
font-size: 24PX;
font-weight: 600;
color: #586170;
margin-bottom: 32px;
}
.tips {
font-size: 18PX;
font-weight: 400;
color: #586170;
margin-bottom: 24PX;
}
.footer {
@include flexLayout(column);
gap: 12PX;
.buy {
height: 56PX;
@include flexLayout(row, center, center);
background-size: 100% 100%;
background-image: url('../assets/btn-primary.png');
font-weight: 500;
}
.studyTribe {
@include flexLayout(row, center, center);
height: 56PX;
background-image: url('../assets/btn-border.png');
background-size: 100% 100%;
text-align: center;
font-size: 18PX;
font-weight: 500;
color: #1786F7;
}
}
}
import { PropsWithChildren } from 'react'
import { View, RootPortal, Image, Text } from '@tarojs/components'
import { switchTab } from '@tarojs/taro'
import classNames from 'classnames'
import styles from './answer-card-modal.module.scss'
type ModalProps = {
isVisible: boolean;
onClose: () => void;
}
const AnswerSheetModal = (props: PropsWithChildren<ModalProps>) => {
const { isVisible, children, onClose } = props
return (
<RootPortal>
<View className={classNames(styles.mask, isVisible && styles.visible)} onClick={onClose}>
</View>
<View className={classNames(styles.modal, isVisible && styles.visible)}>
<Image className={styles.close} onClick={onClose} src={require('../assets/close.png')} />
<View className={styles.title}>你的答题卡已经用完啦</View>
<View className={styles.tips}>可通过以下途径获得哦</View>
<View className={styles.footer}>
<View className={styles.buy}>{children}</View>
<View className={styles.studyTribe} onClick={() => switchTab({ url: '/pages/group/index' })}>
<Text>建设学习部落,得更多答题卡</Text>
</View>
</View>
</View>
</RootPortal>
)
}
export default AnswerSheetModal
@import '@/styles/mixins.scss';
.wrapper {
margin-bottom: 64px;
position: relative;
z-index: 999;
padding: 0 32px;
text-align: center;
.title {
font-weight: bold;
margin: 20px 0;
font-size: 26PX;
font-weight: 600;
color: #FFFFFF;
}
.labels {
@include flexLayout(row, center, center);
gap: 20px;
margin-bottom: 48px;
.label {
font-size: 12PX;
font-weight: 400;
color: #FFFFFF;
padding: 8PX;
background: rgba(226,233,255,0.2);
border-radius: 6PX;
@include flexLayout(row, center);
gap: 3PX;
.icon {
width: 16PX;
height: 16PX;
}
}
}
.requirement {
@include flexLayout(column);
& > .text {
text-align: center;
font-size: 16PX;
font-weight: 500;
color: #FFFFFF;
position: relative;
margin-bottom: 12PX;
&::before, &::after {
content: "";
position: absolute;
width: 36%;
height: 1px;
top: 20px;
transform: scaleY(0.5);
background-color: #fff;
}
&::before {
left: 0;
}
&::after {
right: 0;
}
}
.details {
@include flexLayout(column);
gap: 12PX;
.detail {
background: rgba(226,233,255,0.3);
border-radius: 12PX;
@include flexLayout(row, center, space-between);
color: #fff;
.content {
@include flexLayout(row, center);
.badge {
width: 42PX;
height: 42PX;
margin-right: 16PX;
}
.center {
@include flexLayout(row, center);
gap: 4PX;
font-size: 12PX;
}
}
.icon {
width: 22PX;
height: 22PX;
}
.score {
margin-right: 32px;
@include flexLayout(row, center);
.icon {
position: relative;
right: -10PX;
}
.text {
background: #0084FF;
border-radius: 14px;
font-size: 10PX;
width: 36PX;
padding: 1PX 6PX;
}
}
}
}
}
}
\ No newline at end of file
import { View, Text, Image } from '@tarojs/components'
import assets from '@/assets/oss/assets-prepare'
import styles from './main-header.module.scss'
const scoreList = [
{ u: assets['level-big-s.png'].u },
{ u: assets['level-big-a.png'].u },
{ u: assets['level-big-b.png'].u },
]
const renderItem = ({ u }) => (
<View key={u} className={styles.detail}>
<View className={styles.content}>
<Image className={styles.badge} src={u} mode="widthFix" />
<View className={styles.center}>
<Image className={styles.icon} src={assets['hook.png'].u} mode="widthFix" />
<Text>全对,</Text>
</View>
<View className={styles.center}>
<Image className={styles.icon} src={assets['clock.png'].u} mode="widthFix" />
<Text>用时 ≤49s</Text>
</View>
</View>
<View className={styles.score}>
<Image className={styles.icon} src={assets['diamond.png'].u} mode="widthFix" />
<Text className={styles.text}>+100</Text>
</View>
</View>
)
const MainHeader = () => {
return (
<View className={styles.wrapper}>
<View className={styles.title}>表内除法</View>
<View className={styles.labels}>
<View className={styles.label}>
<Image className={styles.icon} src={assets['strong.png'].u} mode="widthFix" />
<Text>强化</Text>
</View>
<Text className={styles.label}>计算达标1</Text>
<Text className={styles.label}>共 10 题</Text>
</View>
<View className={styles.requirement}>
<Text className={styles.text}>通关要求</Text>
<View className={styles.details}>
{scoreList.map(renderItem)}
</View>
</View>
</View>
)
}
export default MainHeader
import { View, Text } from '@tarojs/components'
import styles from './index.module.scss'
const GloryBadge: React.FC = () => {
return (
<View className={styles.badge}>
<Text>TOP30%</Text>
<Text>升档成功</Text>
<Text>S级实力</Text>
</View>
)
}
export default GloryBadge
.wrapper {
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 60px;
}
.title {
font-weight: bold;
}
.totalQuestions {
margin-top: 24px;
}
.requirement {
display: flex;
justify-content: space-between;
width: 60%;
margin-top: 24px;
}
.duration {
}
.launchQuest {
position: relative;
margin-top: 48px;
z-index: 1;
width: 70%;
}
.tip {
position: absolute;
z-index: 10;
top: -32px;
right: -12%;
font-size: 24px;
color: #ff0000;
background-color: #fff;
border: 1px solid #ff0000;
border-radius: 8px;
padding: 8px 12px;
}
.topLeftInfo {
position: absolute;
top: 0;
left: 24px;
display: flex;
flex-direction: column;
gap: 16px;
font-size: 20px;
}
.calculation,
.enhancement {
background-color: #f5f5f5;
padding: 4px 8px;
border: 1px solid #ccc;
}
.badge {
display: flex;
align-items: center;
margin-top: 24px;
gap: 24px;
padding: 24px;
border: 1px solid #000;
Text {
border-radius: 8px;
padding: 12px;
display: flex;
align-items: center;
border: 1px dashed red;
}
}
\ No newline at end of file
import { memo } from 'react'
import { View, Text } from '@tarojs/components'
// import Taro from '@tarojs/taro'
// import { useRequest } from '@/hooks/use-request'
import TopLeftInfo from './top-left-info'
import LaunchQuest from './launch-quest'
import GloryBadge from './glory-badge'
import { formatTime } from '../../utils'
import styles from './index.module.scss'
const Overview = () => {
const levelInfo = {
title: '表内除法',
totalQuestions: 10,
duration: 80,
}
// useRequest(getUserInfo, {
// params: { uid: 100 },
// })
return (
<>
<TopLeftInfo />
<View className={styles.wrapper}>
<Text className={styles.title}>
{levelInfo.title}
</Text>
<Text className={styles.totalQuestions}>
共{levelInfo.totalQuestions}题
</Text>
<View className={styles.requirement}>
<Text className={styles.passingRequirement}>
通过要求:全 √
</Text>
<Text className={styles.duration}>
时间:{formatTime(levelInfo.duration)}
</Text>
</View>
<LaunchQuest />
<GloryBadge />
</View>
</>
)
}
export default memo(Overview)
import React from 'react'
import { View, Text, Button } from '@tarojs/components'
import { navigateTo, useRouter } from '@tarojs/taro'
// import Taro from '@tarojs/taro'
import Modal from '@/components/Modal'
import { useBoolean } from '@/hooks'
import { useStoreState, useStoreActions } from '@/store/hooks'
import styles from './index.module.scss'
const LaunchQuest: React.FC = () => {
const [isVisible, { setTrue, setFalse }] = useBoolean(false)
const [loading, loadingAction] = useBoolean(false)
const cardNum = useStoreState(state => state.userModel.cardNum)
const getQuestionList = useStoreActions(actions => actions.gameModel.getQuestionList)
const router = useRouter<{ id: string }>()
const _navigateTo = () => {
if (cardNum < 1) {
setTrue()
} else {
loadingAction.setTrue()
getQuestionList(+router.params.id || -1).then(() => {
loadingAction.setFalse()
navigateTo({
url: `/pages/game/play/index?id=${router.params.id}`
})
})
}
// Taro.navigateTo('/')
}
return (
<>
<View className={styles.launchQuest}>
<Button onClick={_navigateTo} loading={loading}>开始闯关</Button>
<Text className={styles.tip}>
首次免答题卡
{/* {hasFreePass ? '首次免答题卡' : '-1答题卡'} */}
</Text>
</View>
<Modal isVisible={isVisible as boolean} onClose={setFalse}>
<View>
<Text>你的答题卡已经用完了</Text>
<Button onClick={setFalse}>建设学习部落得更多答题卡</Button>
<Button onClick={setFalse}>购买</Button>
</View>
</Modal>
</>
)
}
export default LaunchQuest
import { View, Text } from '@tarojs/components'
import styles from './index.module.scss'
const TopLeftInfo = () => {
return (
<View className={styles.topLeftInfo}>
<Text className={styles.calculation}>计算达标</Text>
<Text className={styles.enhancement}>强化</Text>
</View>
)
}
export default TopLeftInfo
.wrapper {
display: flex;
flex-direction: column;
}
.head {
display: flex;
justify-content: flex-end;
&_text {
width: 160px;
text-align: center;
}
}
.timing {
min-width: 320px;
display: flex;
align-items: center;
Text {
flex: 1;
text-align: center;
}
}
.list {
min-height: 300px;
max-height: 400px;
overflow: hidden;
overflow-y: auto;
display: flex;
flex-direction: column;
row-gap: 24px;
}
.item {
padding: 16px 0;
display: flex;
justify-content: space-between;
}
.highlight {
background-color: yellow;
}
.noTopThree {
border: 1px solid red;
margin: 24px 0;
}
.userInfo {
display: flex;
column-gap: 16px;
}
.avatar {
width: 60px;
height: 60px;
border-radius: 50%;
background-color: pink;
}
.userDetails {
display: flex;
flex-direction: column;
row-gap: 16px;
line-height: 1;
}
\ No newline at end of file
import { View, Button, Text, ScrollView } from '@tarojs/components'
import classNames from 'classnames'
import { useStoreState } from '@/store/hooks'
import { useBoolean } from '@/hooks'
import { StageRank } from '@/api/game'
import styles from './index.module.scss'
interface ScrollListProps<T> {
users: T[]
}
const ScrollRankList = <T extends StageRank>({ users }: ScrollListProps<T>) => {
const [showAll, { toggle }] = useBoolean(false)
const currentUser = useStoreState((state) => state.userModel.userInfo)
const renderItem = (rank: T) => {
const isCurrentUser = currentUser.userId === rank.userId
const itemClass = classNames(styles.item, {
[styles.highlight]: isCurrentUser,
})
return (
<View key={rank.userId} className={itemClass}>
<View className={styles.userInfo}>
<View className={styles.avatar} />
{/* <Image className='avatar' src={avatar} /> */}
<View className={styles.userDetails}>
<Text className="nickname">{rank.nickName}</Text>
<Text className="school">{rank.secondName}</Text>
</View>
</View>
<View className={styles.timing}>
<Text>{rank.firstResultTime}秒</Text>
<Text>{rank.bestResultTime}秒</Text>
</View>
</View >
)
}
// const hasNextPage = true
// const loading = false
// const computedUsers = showAll ? users : topThreeUsers
const scrollStyle = {
height: '400px',
background: 'red'
}
const loadMore = () => {
console.log('loadMore')
}
return (
<View className={styles.wrapper}>
<View className={styles.header}>
<Text className={styles.header_text}>首次</Text>
<Text className={styles.header_text}>最佳</Text>
</View>
{currentUser.userId && renderItem(currentUser as T)}
<ScrollView
scrollY
enableFlex
scrollWithAnimation
style={scrollStyle}
onScrollToLower={loadMore}
>
<View style={{ height: '300px' }}>A</View>
<View style={{ height: '300px' }}>B</View>
<View style={{ height: '300px' }}>C</View>
{/* {hasNextPage && !loading && <Text>加载更多</Text>} */}
</ScrollView>
<View className={styles.list}>
{[].map(renderItem)}
</View>
{!showAll && (
<Button className={styles.loadMore} onClick={() => toggle()}>
查看更多
</Button>
)}
</View>
)
}
export default ScrollRankList
import { View, Text } from '@tarojs/components'
import { TimingProps } from '../../types'
// import { formatTime } from '../../utils'
import styles from './index.module.scss'
const Timing = ({ time = 0 }: TimingProps) => {
return (
<View className={styles.timing}>
<Text>34.23秒</Text>
<Text>21.23秒</Text>
</View>
)
}
export default Timing
import { View, Text } from '@tarojs/components'
import { UserInfoProps } from '../../types'
import styles from './index.module.scss'
const UserInfo = ({ avatar, nickname, schoolName }: UserInfoProps) => {
return (
<View className={styles.userInfo}>
<View className={styles.avatar} />
{/* <Image className='avatar' src={avatar} /> */}
<View className={styles.userDetails}>
<Text className="nickname">{nickname}</Text>
<Text className="school">{schoolName}</Text>
</View>
</View>
)
}
export default UserInfo
import { View, Text } from '@tarojs/components'
import { StageRank } from '@/api/game'
import ScrollRankList from './rank-list/index'
const StudyLeagueRank = <T extends StageRank>({ users }: { users: T[] }) => {
return (
<View>
<ScrollRankList<T> users={users} />
<Text>立即创建</Text>
</View>
)
}
export default StudyLeagueRank
.tabs {
position: relative;
display: flex;
width: 100%;
flex-direction: column;
z-index: 999;
overflow: visible;
}
.tabBar {
display: flex;
border-bottom: 1px solid #ccc;
height: 176px;
background-size: cover;
&.active_1 {
background-image: url('../assets/tab-1.png');
}
&.active_2 {
background-image: url('../assets/tab-2.png');
}
}
.tab {
flex: 1;
height: 96px;
display: flex;
align-items: center;
justify-content: center;
letter-spacing: 2PX;
font-size: 32px;
font-weight: 400;
color: #FFFFFF;
&.active {
position: relative;
font-weight: 600;
color: #1786F7;
&::before {
position: absolute;
content: "";
width: 16PX;
bottom: 0;
height: 3PX;
background: #1786F7;
border-radius: 8PX;
}
}
}
.tabPanes {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(100%, 1fr));
grid-auto-rows: min-content;
grid-auto-flow: column;
overflow: hidden;
background-color: #fff;
position: relative;
top: -40PX;
margin-bottom: -40PX;
.tabPane {
height: auto;
grid-row: 1;
grid-column: 1;
transition: transform 0.3s ease-in-out;
pointer-events: none;
&.active {
pointer-events: auto;
}
}
}
import { useState, useEffect, useCallback, CSSProperties, ReactNode } from 'react'
import { View } from '@tarojs/components'
import classNames from 'classnames'
import styles from './tabs.module.scss'
export interface TabItem {
label: string | ReactNode;
disabled?: boolean;
hidden?: boolean;
children: ReactNode;
}
interface TabsProps {
items: TabItem[];
initialIndex?: number;
tabPanesStyle?: CSSProperties;
onChange?: (index: number) => void;
}
const Tabs = ({
items,
initialIndex = 0,
tabPanesStyle,
onChange,
}: TabsProps) => {
const [activeIndex, setActiveIndex] = useState(initialIndex)
useEffect(() => {
if (items[activeIndex].hidden) {
const newIndex = items.findIndex((tab, index) => !tab.hidden && index !== activeIndex)
setActiveIndex(newIndex)
}
}, [items, activeIndex])
const handleClick = useCallback(
(index: number) => {
if (!items[index].disabled && index !== activeIndex) {
setActiveIndex(index)
onChange?.(index)
}
},
[items, activeIndex, onChange]
)
const renderTabs = () => {
return items.map((tab, index) => (
<View
key={index}
className={classNames(styles.tab, { [styles.active]: index === activeIndex })}
onClick={() => handleClick(index)}
>
{tab.label}
</View>
))
}
const renderTabPanes = () => {
return items.map((tab, index) => {
if (tab.hidden) return null
const isActive = activeIndex === index
const isHidden = tab.hidden || !isActive
const cls = classNames(styles.tabPane, {
[styles.active]: isActive,
})
const tabPaneStyle = {
transform: `translateX(${(index - activeIndex) * 100}%)`,
transition: 'transform 0.3s ease-in-out',
}
return (
<View key={index} className={cls} hidden={isHidden} style={tabPaneStyle}>
{tab.children}
</View>
)
})
}
return (
<View className={styles.tabs}>
<View className={classNames(styles.tabBar, activeIndex === 0 ? styles.active_1 : styles.active_2)}>
{renderTabs()}
</View>
<View className={styles.tabPanes} style={tabPanesStyle}>
{renderTabPanes()}
</View>
</View>
)
}
export default Tabs
.thead {
height: 40PX;
background: #F7F9FC;
display: flex;
align-items: center;
font-size: 12PX;
padding: 0 32px;
color: rgba(70,81,100,0.5);
&_index {
width: 30PX;
padding-left: 3PX;
margin-right: 23PX;
}
&_username {
flex: 1;
}
&_result {
display: flex;
align-items: center;
font-size: 12PX;
font-weight: 400;
gap: 6PX;
color: rgba(70,81,100,0.7);
&_best {
font-size: 14PX;
font-weight: 600;
color: #FE9B45;
}
}
}
\ No newline at end of file
import { View, Text } from '@tarojs/components'
import styles from './thead.module.scss'
export default () => (
<View className={styles.thead}>
<Text className={styles.thead_index}>名次</Text>
<Text className={styles.thead_username}>用户名</Text>
<View className={styles.thead_result}>
<Text className={styles.thead_result_first}>首次</Text>
<Text>|</Text>
<Text className={styles.thead_result_best}>最佳</Text>
</View>
</View>
)
.header {
position: fixed;
color: #fff;
left: 0;
top: 0;
right: 0;
z-index: 999;
}
.head_bg {
position: absolute;
left: 0;
right: 0;
width: 100%;
}
.content {
position: relative;
z-index: 2;
.inner {
display: flex;
align-items: center;
font-size: 16PX;
font-weight: 500;
color: #FFFFFF;
padding: 0 10PX;
.back_icon {
position: relative;
z-index: 10;
width: 30PX;
width: 30PX;
}
}
}
import { View, Image } from '@tarojs/components'
import { useMemo } from 'react'
import { getMenuButtonBoundingClientRect, navigateBack, getSystemInfoSync } from '@tarojs/taro'
import styles from './top-bar.module.scss'
export default () => {
const nav = getMenuButtonBoundingClientRect()
const sys = getSystemInfoSync()
const innerStyle = useMemo(() => {
return {
height: `${nav.height + 10}px`,
paddingRight: `${nav.width + (sys.windowWidth - nav.right) * 2}px`
}
}, [sys, nav])
return (
<View className={styles.header}>
<Image src={require('../assets/head-bg.png')} mode="widthFix" className={styles.head_bg} />
<View
className={styles.content}
style={{
height: `${nav.height + 10}px`,
paddingTop: `${nav.top - 5}px`
}}
>
<View className={styles.inner} style={innerStyle}>
<Image className={styles.back_icon} src={require('../assets/back.png')} mode="widthFix" onClick={() => navigateBack()} />
</View>
</View>
</View>
)
}
// export default definePageConfig({
// navigationBarTitleText: 'pk-math',
// navigationStyle: 'custom'
// })
export default definePageConfig({
navigationBarTitleText: 'pk-math',
navigationStyle: 'custom'
})
@import '@/styles/mixins.scss';
.breakthrough {
@include flexLayout(_, center, space-around);
}
\ No newline at end of file
.wrapper {
padding-bottom: 80PX;
.tribe {
&_title {
@include flexLayout(row, center, center);
height: 40PX;
font-size: 16PX;
letter-spacing: 1PX;
font-weight: 600;
color: #465164;
}
}
.empty {
color: #9999;
font-size: 12PX;
margin-top: 12PX;
text-align: center;
}
.item {
display: flex;
padding: 28px 32px 26px;
align-items: center;
&_rank {
margin-right: 40px;
@include flexLayout(row, center);
&_icon {
width: 30PX;
height: 30PX;
}
&_index {
display: block;
text-align: center;
width: 30PX;
font-size: 36px;
font-weight: 500;
color: rgba(70,81,100,0.5);
}
}
&_username {
display: flex;
flex: 1;
flex-direction: column;
gap: 4PX;
@include flexLayout(row, center);
&_text {
font-size: 14PX;
font-weight: 600;
color: #465164;
}
&_crown {
width: 36px;
height: 36px;
}
}
&_result {
@include flexLayout(row, center, center);
font-size: 12PX;
font-weight: 400;
gap: 6PX;
color: rgba(70,81,100,0.7);
&_best {
font-size: 16PX;
font-weight: 600;
color: #FE9B45;
}
}
}
.challenge {
position: fixed;
bottom: 60px;
left: 16PX;
right: 16PX;
height: 100px;
z-index: 999;
&_text {
font-size: 40px;
letter-spacing: 1PX;
font-weight: 600;
}
.card {
@include flexLayout(row, center);
position: absolute;
right: 100px;
gap: 4PX;
&_icon {
width: 32PX;
height: 32PX
}
&_text {
font-size: 18PX;
font-weight: 500;
color: #FFFFFF;
}
}
.tip {
position: absolute;
top: -32PX;
right: -9PX;
padding: 8PX 13PX 12PX;
background-image: url('https://cdn.jkwljy.com/pk-math/4WgogFzhSYUSrvpmEE7JwoVg7SH5/122x42');
background-size: 100% 100%;
&_text {
font-size: 16PX;
font-weight: 500;
color: #FFFFFF;
}
}
}
}
.modal {
@include flexLayout(row, center, center);
font-size: 18PX;
font-weight: 500;
color: #FFFFFF;
& > {
.logo {
width: 32PX;
height: 32PX;
margin-right: 4PX;
}
.buy {
margin: 0 12PX;
}
.balance {
font-weight: 400;
font-size: 14PX;
}
}
}
import { Button, View } from '@tarojs/components'
import { View, Text, Image } from '@tarojs/components'
import { useEffect } from 'react'
import Tabs, { type TabItem } from '@/components/Tabs'
import { useRouter, getMenuButtonBoundingClientRect } from '@tarojs/taro'
import { useStoreState, useStoreActions } from '@/store/hooks'
import { useRouter } from '@tarojs/taro'
import { useBoolean } from '@/hooks'
import { type StageRank } from '@/api/game'
import assets from '@/assets/oss/assets-prepare'
import Overview from './components/overview/index'
import ScrollRankList from './components/rank-list/index'
import StudyLeagueRank from './components/study-league-rank'
import Button from '@/components/Button'
import Tabs, { type TabItem } from './components/tabs'
import TopBar from './components/top-bar'
import MainHeader from './components/main-header'
import Thead from './components/thead'
import AnswerCardModal from './components/answer-card-modal'
import styles from './index.module.scss'
const Prepare: React.FC = () => {
const renderItem = (item: StageRank, index: number) => {
return (
<View key={item.userId} className={styles.item}>
<View className={styles.item_rank}>
{[0, 1, 2].includes(index)
? <Image className={styles.item_rank_icon} src={require(`@/pages/group/assets/icons/rank-${index + 1}.png`)} />
: <Text className={styles.item_rank_index}>{index}</Text>
}
</View>
<View className={styles.item_username}>
<Text className={styles.item_username_text}>{item.nickName || '-'}</Text>
<Image className={styles.item_username_crown} src={require('@/pages/group/assets/icons/crown-small.png')} />
</View>
<View className={styles.item_result}>
<Text className={styles.item_result_first}>{65.23}s</Text>
<Text>|</Text>
<Text className={styles.item_result_best}>{34.23}s</Text>
</View>
</View>
)
}
const Prepare = () => {
const nav = getMenuButtonBoundingClientRect()
const [isVisible, { setTrue, setFalse }] = useBoolean(false)
const stageDetail = useStoreState(state => state.gameModel.stageDetail)
const getStageDetail = useStoreActions(actions => actions.gameModel.getStageDetail)
......@@ -20,20 +51,68 @@ const Prepare: React.FC = () => {
getStageDetail(+router.params.id || 1)
}, [router, getStageDetail])
const renderList = (list = []) => {
const isEmpty = list.length < 1
return (
<>
<Thead />
{list.map(renderItem)}
{isEmpty && <View className={styles.empty}>暂无数据</View>}
</>
)
}
const tabs: TabItem[] = [
{ label: '成都排行榜', children: <ScrollRankList users={stageDetail?.ranks!} /> },
{ label: '学习部落排行榜', children: <StudyLeagueRank users={stageDetail?.ranks!} /> }
{
label: '成都排行榜',
children: (
<>{renderList()}</>
)
},
{
label: '学习部落排行榜',
children: (
<View className={styles.tribe}>
<Text className={styles.tribe_title}>极客学霸俱乐部</Text>
{renderList()}
</View>
)
}
]
return (
<View>
<Overview />
<Tabs items={tabs} />
<View className={styles.breakthrough}>
<Button>继续闯关</Button>
<Button>再次努力,变得更棒</Button>
<>
<View className={styles.wrapper}>
<TopBar />
<View style={{ position: 'relative', paddingTop: `${nav.height + nav.top + 5}px` }}>
<MainHeader />
<Tabs items={tabs} />
</View>
<View className={styles.challenge}>
<Button type="custom" size="large" onClick={setTrue}>
<Text className={styles.challenge_text}>开始闯关</Text>
<View className={styles.card}>
<Image className={styles.card_icon} src={require('@/pages/main/assets/ph.png')} />
<Text className={styles.card_text}>-1</Text>
</View>
{false && <View className={styles.tip}>
<Text className={styles.tip_text}>首次免答题卡</Text>
</View>}
</Button>
</View>
</View>
</View>
<AnswerCardModal isVisible={isVisible} onClose={setFalse}>
<View className={styles.modal}>
<Image className={styles.logo} src={assets['diamond.png'].u} mode="widthFix" />
<Text>-30</Text>
<Text className={styles.buy}>购买</Text>
<Text className={styles.balance}>(当前剩余 120)</Text>
</View>
</AnswerCardModal>
</>
)
}
......
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