Commit 14cd9484 authored by 666's avatar 666

feat: update ui

parent 990471e1
......@@ -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;
......
......@@ -89,6 +89,7 @@
.center {
@include flexLayout(row, center);
gap: 4PX;
font-size: 12PX;
}
}
......
......@@ -10,13 +10,14 @@
display: flex;
border-bottom: 1px solid #ccc;
height: 176px;
background-size: cover;
&.active_1 {
background: url('../assets/tab-1.png') no-repeat;
background-image: url('../assets/tab-1.png');
}
&.active_2 {
background: url('../assets/tab-2.png') no-repeat;
background-image: url('../assets/tab-2.png');
}
}
......@@ -48,19 +49,26 @@
}
.tabPanes {
position: relative;
display: grid;
grid-template-columns: repeat(auto-fit, minmax(100%, 1fr));
grid-auto-rows: min-content;
grid-auto-flow: column;
overflow: hidden;
min-height: 400px; /* 根据需要设置最小高度 */
background-color: #fff;
position: relative;
top: -40PX;
height: 100%;
margin-bottom: -40PX;
.tabPane {
position: absolute;
top: 0;
left: 0;
width: 100%;
grid-row: 1;
grid-column: 1;
transition: transform 0.3s ease-in-out;
will-change: transform;
pointer-events: none;
&.active {
display: block;
pointer-events: auto;
}
}
}
......
......@@ -14,8 +14,6 @@ export interface TabItem {
interface TabsProps {
items: TabItem[];
initialIndex?: number;
tabBarGutter?: number;
tabBarStyle?: CSSProperties;
tabPanesStyle?: CSSProperties;
onChange?: (index: number) => void;
}
......
.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>
)
@import '@/styles/mixins.scss';
.wrapper {
}
padding-bottom: 80PX;
.breakthrough {
@include flexLayout(_, center, space-around);
}
.tribe {
&_title {
@include flexLayout(row, center, center);
height: 40PX;
font-size: 16PX;
letter-spacing: 1PX;
font-weight: 600;
color: #465164;
}
}
.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);
.start {
&_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: 32PX;
bottom: 60px;
left: 16PX;
right: 16PX;
height: 100px;
z-index: 999;
.text {
&_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 { View, Text } from '@tarojs/components'
import { View, Text, Image } from '@tarojs/components'
import { useEffect } from 'react'
import { useStoreState, useStoreActions } from '@/store/hooks'
import { useRouter, getMenuButtonBoundingClientRect } from '@tarojs/taro'
import { type StageRank } from '@/api/game'
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 Thead from './components/thead'
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 stageDetail = useStoreState(state => state.gameModel.stageDetail)
......@@ -25,8 +48,25 @@ const Prepare: React.FC = () => {
}, [router, getStageDetail])
const tabs: TabItem[] = [
{ label: '成都排行榜', children: <ScrollRankList users={stageDetail?.ranks!} /> },
{ label: '学习部落排行榜', children: <StudyLeagueRank users={stageDetail?.ranks!} /> }
{
label: '成都排行榜',
children: (
<>
<Thead />
{[].map(renderItem)}
</>
)
},
{
label: '学习部落排行榜',
children: (
<View className={styles.tribe}>
<Text className={styles.tribe_title}>极客学霸俱乐部</Text>
<Thead />
{[].map(renderItem)}
</View>
)
}
]
return (
......@@ -35,12 +75,12 @@ const Prepare: React.FC = () => {
<View style={{ paddingTop: `${nav.height + nav.top + 5}px` }}>
<MainHeader />
<Tabs items={tabs} />
<Tabs initialIndex={1} items={tabs} />
</View>
<View className={styles.start}>
<View className={styles.challenge}>
<Button type="custom" size="large">
<Text className={styles.text}>开始闯关</Text>
<Text className={styles.challenge_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