Commit 990471e1 authored by 666's avatar 666

feat: update ui

parent 72cd038d
{
"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"
}
}
......@@ -6,9 +6,9 @@
export default {
pages: [
'pages/prepare/index',
'pages/main/main',
'pages/group/index',
'pages/prepare/index',
'pages/study-market/index',
'pages/game/play/index',
'pages/game/complete/index',
......
/* 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
......@@ -115,3 +115,19 @@
}
}
}
@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>
<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>
<Text className={styles.members_stroke}>成功邀请1人</Text>
</View>
</ShareButton>
</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;
......@@ -148,9 +147,17 @@
}
}
}
@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.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>
)
}
......@@ -75,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 { View, Text } from '@tarojs/components'
export default () => {
return (
<View>
<View>
<Text>名次</Text>
<Text>用户名</Text>
<View>
<Text>首次</Text>
<Text>|</Text>
<Text>最佳</Text>
</View>
</View>
</View>
)
}
@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;
}
}
.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
.tabs {
position: relative;
display: flex;
width: 100%;
flex-direction: column;
z-index: 999;
}
.tabBar {
display: flex;
border-bottom: 1px solid #ccc;
height: 176px;
&.active_1 {
background: url('../assets/tab-1.png') no-repeat;
}
&.active_2 {
background: url('../assets/tab-2.png') no-repeat;
}
}
.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 {
position: relative;
overflow: hidden;
min-height: 400px; /* 根据需要设置最小高度 */
.tabPane {
position: absolute;
top: 0;
left: 0;
width: 100%;
transition: transform 0.3s ease-in-out;
&.active {
display: block;
}
}
}
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;
tabBarGutter?: number;
tabBarStyle?: CSSProperties;
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
.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, 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" />
</View>
</View>
</View>
)
}
// export default definePageConfig({
// navigationBarTitleText: 'pk-math',
// navigationStyle: 'custom'
// })
export default definePageConfig({
navigationBarTitleText: 'pk-math',
navigationStyle: 'custom'
})
@import '@/styles/mixins.scss';
.wrapper {
}
.breakthrough {
@include flexLayout(_, center, space-around);
}
.start {
position: fixed;
bottom: 32PX;
left: 16PX;
right: 16PX;
height: 100px;
z-index: 999;
.text {
font-size: 40px;
letter-spacing: 2PX;
font-weight: 600;
}
}
@supports (bottom: constant(safe-area-inset-bottom)) or (bottom: env(safe-area-inset-bottom)) {
.start {
bottom: calc(32PX + constant(safe-area-inset-bottom));
bottom: calc(32PX + env(safe-area-inset-bottom));
}
}
\ No newline at end of file
import { Button, View } from '@tarojs/components'
import { View, Text } from '@tarojs/components'
import { useEffect } from 'react'
import Tabs, { type TabItem } from '@/components/Tabs'
import { useStoreState, useStoreActions } from '@/store/hooks'
import { useRouter } from '@tarojs/taro'
import { useRouter, getMenuButtonBoundingClientRect } from '@tarojs/taro'
import Overview from './components/overview/index'
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 ScrollRankList from './components/rank-list/index'
import StudyLeagueRank from './components/study-league-rank'
import styles from './index.module.scss'
const Prepare: React.FC = () => {
const nav = getMenuButtonBoundingClientRect()
const stageDetail = useStoreState(state => state.gameModel.stageDetail)
const getStageDetail = useStoreActions(actions => actions.gameModel.getStageDetail)
......@@ -26,12 +30,18 @@ const Prepare: React.FC = () => {
]
return (
<View>
<Overview />
<View className={styles.wrapper}>
<TopBar />
<View style={{ paddingTop: `${nav.height + nav.top + 5}px` }}>
<MainHeader />
<Tabs items={tabs} />
<View className={styles.breakthrough}>
<Button>继续闯关</Button>
<Button>再次努力,变得更棒</Button>
</View>
<View className={styles.start}>
<Button type="custom" size="large">
<Text className={styles.text}>开始闯关</Text>
</Button>
</View>
</View>
)
......
import { Image, View, Text } from '@tarojs/components'
import { type MemberItem } from '@/api/group'
import styles from './index.module.scss'
const renderItem = (item: MemberItem, index: number) => {
return (
<View key={item.memberId} 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}>4{index}</Text>
}
</View>
<View className={styles.item_username}>
<View className={styles.avatar}>
<Text className={styles.nickname}>{item.memberName || '-'}</Text>
<Image className={styles.crown} src={require('@/pages/group/assets/icons/crown-small.png')} />
</View>
<Text className={styles.schoolName}>{item.schoolName}</Text>
</View>
<Text className={styles.item_role}>CTO</Text>
<Text className={styles.item_count}>{item.stageNum}</Text>
</View>
)
}
export default renderItem
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