任务、消息

This commit is contained in:
liu
2026-07-01 22:16:15 +08:00
parent 137db25b49
commit d98457e1dd
22 changed files with 1504 additions and 63 deletions
@@ -0,0 +1,27 @@
.activity-card {
.type-badge.activity {
background: #e8fff0;
color: #07c160;
font-size: 22px;
padding: 4px 12px;
border-radius: 6px;
font-weight: 500;
}
.participants-count {
font-size: 24px;
color: #646566;
}
.progress-bar-wrap {
margin: 16px 0 8px;
height: 8px;
background: #f2f3f5;
border-radius: 4px;
overflow: hidden;
.progress-bar {
height: 100%;
background: linear-gradient(90deg, #07c160, #1989fa);
border-radius: 4px;
transition: width 0.3s;
}
}
}
@@ -0,0 +1,42 @@
import type { Task } from '@/types/task'
import { View, Text, Image } from '@tarojs/components'
import './index.less'
interface Props { task: Task }
export default function ActivityCard({ task }: Props) {
const progress = task.maxParticipants
? Math.round(((task.participants || 0) / task.maxParticipants) * 100)
: 0
return (
<View className='task-card activity-card'>
<View className='card-top'>
<View className='task-info'>
<View className='task-type-row'>
<Text className='type-badge activity'></Text>
<Text className='participants-count'>👥 {task.participants}/{task.maxParticipants}</Text>
</View>
<Text className='task-title'>{task.title}</Text>
<Text className='task-desc'>{task.desc}</Text>
</View>
</View>
{/* 参与进度条 */}
{task.maxParticipants && (
<View className='progress-bar-wrap'>
<View className='progress-bar' style={{ width: `${progress}%` }} />
</View>
)}
<View className='card-bottom'>
<View className='publisher'>
<Image className='pub-avatar' src={task.publisher.avatar} mode='aspectFill' />
<Text className='pub-name'>{task.publisher.name}</Text>
</View>
<View className='task-meta'>
<Text className='meta-item'>📍 {task.location}</Text>
<Text className='meta-item'>🕐 {task.time}</Text>
</View>
</View>
</View>
)
}