任务、消息

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
+152 -16
View File
@@ -1,29 +1,165 @@
/* ========================================
消息页面
======================================== */
.messages-page {
min-height: 100vh;
display: flex;
flex-direction: column;
background: #f7f8fa;
}
.page-placeholder {
.messages-scroll {
flex: 1;
}
/* ========== 分区 ========== */
.section-block {
margin: 20px 24px 0;
background: #fff;
border-radius: 16px;
overflow: hidden;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
.section-title {
font-size: 28px;
font-weight: 500;
color: #323233;
padding: 24px 24px 12px;
}
}
/* ========== 消息列表项 ========== */
.message-item {
display: flex;
align-items: center;
padding: 24px;
transition: background 0.15s;
&:active {
background: #f7f8fa;
}
& + .message-item {
border-top: 1px solid #f2f3f5;
}
}
/* ========== 系统消息 ========== */
.system-msg {
.sys-icon {
width: 88px;
height: 88px;
border-radius: 50%;
background: linear-gradient(135deg, #1989fa 0%, #07c160 100%);
color: #fff;
font-size: 36px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding-top: 300px;
flex-shrink: 0;
}
.placeholder-icon {
font-size: 96px;
margin-bottom: 24px;
.pinned-tag {
font-size: 20px;
color: #1989fa;
background: #e8f4ff;
padding: 4px 10px;
border-radius: 4px;
flex-shrink: 0;
align-self: flex-start;
margin-top: 4px;
}
}
/* ========== 聊天消息 ========== */
.chat-msg {
.avatar-wrap {
position: relative;
flex-shrink: 0;
.msg-avatar {
width: 96px;
height: 96px;
border-radius: 50%;
}
.placeholder-text {
font-size: 36px;
font-weight: 500;
color: #323233;
margin-bottom: 12px;
}
.placeholder-desc {
font-size: 28px;
color: #969799;
.online-dot {
position: absolute;
bottom: 2px;
right: 2px;
width: 18px;
height: 18px;
border-radius: 50%;
background: #07c160;
border: 3px solid #fff;
}
}
}
/* ========== 消息内容区 ========== */
.msg-body {
flex: 1;
margin-left: 20px;
overflow: hidden;
.msg-top {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 8px;
.msg-name-row {
display: flex;
align-items: center;
}
.msg-name {
font-size: 30px;
font-weight: 500;
color: #1a1a1a;
}
.msg-time {
font-size: 22px;
color: #c8c9cc;
flex-shrink: 0;
}
}
.msg-preview {
font-size: 26px;
color: #969799;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
display: block;
}
}
/* ========== 角色标签 ========== */
.role-tag {
font-size: 20px;
padding: 2px 8px;
border-radius: 4px;
margin-left: 10px;
&.role-rider {
background: #fff3e8;
color: #ff976a;
}
&.role-merchant {
background: #e8f4ff;
color: #1989fa;
}
&.role-user {
background: #f2f3f5;
color: #646566;
}
}
.bottom-safe {
height: 20px;
}
+92 -7
View File
@@ -1,15 +1,100 @@
import { View, Text } from '@tarojs/components'
import CustomTabBar from "@/custom-tab-bar"
import Taro from '@tarojs/taro'
import { View, Text, Image, ScrollView } from '@tarojs/components'
import { Badge } from '@antmjs/vantui'
import CustomTabBar from '@/custom-tab-bar'
import { chatList } from '@/mock/messages'
import type { ChatItem } from '@/types/message'
import './index.less'
/** 角色标签 */
const ROLE_LABEL: Record<string, { text: string; className: string }> = {
rider: { text: '骑手', className: 'role-rider' },
merchant: { text: '商家', className: 'role-merchant' },
user: { text: '同学', className: 'role-user' },
}
export default function Messages() {
const handleChatClick = (item: ChatItem) => {
Taro.showToast({ title: `${item.name || item.title} 聊天即将上线`, icon: 'none' })
}
// 分组:置顶系统消息 + 普通聊天
const systemMsgs = chatList.filter((m) => m.type === 'system')
const chatMsgs = chatList.filter((m) => m.type === 'chat')
return (
<View className='messages-page'>
<View className='page-placeholder'>
<Text className='placeholder-icon'>💬</Text>
<Text className='placeholder-text'></Text>
<Text className='placeholder-desc'>线</Text>
</View>
<ScrollView className='messages-scroll' scrollY enhanced showScrollbar={false}>
{/* ========== 置顶系统消息 ========== */}
{systemMsgs.length > 0 && (
<View className='section-block'>
<View className='section-title'></View>
{systemMsgs.map((msg) => (
<View
key={msg.id}
className='message-item system-msg'
onClick={() => handleChatClick(msg)}
>
<View className='sys-icon'>{msg.title.slice(0, 2)}</View>
<View className='msg-body'>
<View className='msg-top'>
<Text className='msg-name'>{msg.title}</Text>
<Text className='msg-time'>{msg.time}</Text>
</View>
<Text className='msg-preview'>{msg.content}</Text>
</View>
{msg.pinned && <Text className='pinned-tag'></Text>}
</View>
))}
</View>
)}
{/* ========== 聊天消息 ========== */}
<View className='section-block'>
<View className='section-title'></View>
{chatMsgs.map((msg) => (
<View
key={msg.id}
className='message-item chat-msg'
onClick={() => handleChatClick(msg)}
>
{/* 头像 */}
<View className='avatar-wrap'>
<Image
className='msg-avatar'
src={msg.avatar || ''}
mode='aspectFill'
/>
{msg.online && <View className='online-dot' />}
</View>
{/* 消息内容 */}
<View className='msg-body'>
<View className='msg-top'>
<View className='msg-name-row'>
<Text className='msg-name'>{msg.name}</Text>
{msg.role && (
<Text className={`role-tag ${ROLE_LABEL[msg.role]?.className || ''}`}>
{ROLE_LABEL[msg.role]?.text || ''}
</Text>
)}
</View>
<Text className='msg-time'>{msg.time}</Text>
</View>
<Text className='msg-preview'>{msg.lastMessage}</Text>
</View>
{/* 未读数 */}
{msg.unread ? (
<Badge content={msg.unread} max={99} />
) : null}
</View>
))}
</View>
<View className='bottom-safe' />
</ScrollView>
<CustomTabBar activeKey='messages' />
</View>
)
+215 -15
View File
@@ -1,29 +1,229 @@
/* ========================================
个人中心页面
======================================== */
.profile-page {
min-height: 100vh;
background: #f7f8fa;
}
.page-placeholder {
/* ========== 顶部背景区域 ========== */
.profile-header {
position: relative;
background: linear-gradient(160deg, #1989fa 0%, #07c160 100%);
padding-bottom: 32px;
overflow: hidden;
/* 背景装饰圆 */
&::before {
content: '';
position: absolute;
top: -80px;
right: -60px;
width: 280px;
height: 280px;
border-radius: 50%;
background: rgba(255, 255, 255, 0.08);
}
&::after {
content: '';
position: absolute;
bottom: -40px;
left: -40px;
width: 200px;
height: 200px;
border-radius: 50%;
background: rgba(255, 255, 255, 0.05);
}
}
/* 设置按钮 */
.header-actions {
display: flex;
justify-content: flex-end;
padding: 12px 24px 0;
.settings-btn {
width: 60px;
height: 60px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
background: rgba(255, 255, 255, 0.15);
backdrop-filter: blur(10px);
}
}
/* 用户卡片 */
.user-card {
display: flex;
align-items: center;
padding: 24px 32px 20px;
position: relative;
z-index: 1;
.avatar {
width: 120px;
height: 120px;
border-radius: 50%;
border: 4px solid rgba(255, 255, 255, 0.4);
flex-shrink: 0;
}
.user-info {
flex: 1;
margin-left: 24px;
.name-row {
display: flex;
align-items: center;
margin-bottom: 8px;
.name {
font-size: 40px;
font-weight: 600;
color: #fff;
margin-right: 12px;
}
.gender-tag {
font-size: 22px;
width: 36px;
height: 36px;
line-height: 36px;
text-align: center;
border-radius: 50%;
background: rgba(255, 255, 255, 0.25);
color: #fff;
}
}
.class-name {
font-size: 26px;
color: rgba(255, 255, 255, 0.8);
}
}
.van-icon {
flex-shrink: 0;
}
}
/* 点赞/评论/收藏 */
.stats-row {
display: flex;
justify-content: space-around;
padding: 0 32px;
position: relative;
z-index: 1;
.stat-item {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding-top: 300px;
.placeholder-icon {
font-size: 96px;
margin-bottom: 24px;
}
.placeholder-text {
.stat-num {
font-size: 36px;
font-weight: 500;
color: #323233;
margin-bottom: 12px;
font-weight: 600;
color: #fff;
line-height: 1.4;
}
.placeholder-desc {
font-size: 28px;
color: #969799;
.stat-label {
font-size: 24px;
color: rgba(255, 255, 255, 0.75);
}
}
}
/* ========== 滚动内容 ========== */
.profile-scroll {
height: calc(100vh - 100px);
}
/* ========== 通用卡片 ========== */
.section-card {
margin: 20px 24px;
background: #fff;
border-radius: 16px;
overflow: hidden;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
.card-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 28px 24px 20px;
.card-title {
font-size: 32px;
font-weight: 500;
color: #323233;
}
.card-more {
display: flex;
align-items: center;
.more-text {
font-size: 26px;
color: #969799;
margin-right: 4px;
}
}
}
}
/* ========== 订单区域 ========== */
.order-tabs {
display: flex;
justify-content: space-around;
padding: 0 8px 28px;
.order-tab {
display: flex;
flex-direction: column;
align-items: center;
padding: 12px 8px;
.tab-label {
font-size: 24px;
color: #646566;
margin-top: 10px;
}
}
}
/* ========== 功能列表 ========== */
.feature-list {
margin-top: 20px;
.van-cell-group--inset {
margin: 0;
}
.van-cell {
padding: 28px 24px;
}
}
/* ========== 底部信息 ========== */
.footer-info {
display: flex;
flex-direction: column;
align-items: center;
padding: 40px 0 20px;
.footer-icp {
font-size: 22px;
color: #c8c9cc;
margin-bottom: 8px;
}
.footer-version {
font-size: 22px;
color: #c8c9cc;
}
}
+153 -6
View File
@@ -1,15 +1,162 @@
import { View, Text } from '@tarojs/components'
import CustomTabBar from "@/custom-tab-bar"
import { useMemo } from 'react'
import Taro from '@tarojs/taro'
import { View, Text, Image, ScrollView } from '@tarojs/components'
import { Cell, CellGroup, Icon } from '@antmjs/vantui'
import CustomTabBar from '@/custom-tab-bar'
import './index.less'
/** 状态栏高度 */
function getStatusBarHeight(): number {
try {
return Taro.getSystemInfoSync().statusBarHeight || 20
} catch {
return 20
}
}
/** 用户信息(后续接入 API) */
const USER_INFO = {
avatar: 'https://picsum.photos/seed/avatar/200/200',
name: '张三',
className: '计算机科学与技术 2022级',
gender: '男' as const,
stats: { likes: 128, comments: 46, favorites: 89 },
}
/** 订单入口 */
const ORDER_TABS = [
{ key: 'all', label: '全部', icon: 'orders-o' },
{ key: 'pending', label: '待付款', icon: 'balance-pay' },
{ key: 'progress', label: '进行中', icon: 'logistics' },
{ key: 'confirm', label: '待确认', icon: 'checked' },
{ key: 'review', label: '待评价', icon: 'star-o' },
]
/** 功能列表 */
const FEATURE_LIST = [
{ key: 'goods', label: '商品订单', icon: 'orders-o' },
{ key: 'address', label: '地址管理', icon: 'location-o' },
{ key: 'about', label: '关于我们', icon: 'info-o' },
{ key: 'feedback', label: '意见反馈', icon: 'chat-o' },
{ key: 'settings', label: '系统设置', icon: 'setting-o' },
] as const
export default function Profile() {
const statusBarH = useMemo(getStatusBarHeight, [])
const handleSettings = () => {
Taro.showToast({ title: '设置页面即将上线', icon: 'none' })
}
const handleEditProfile = () => {
Taro.showToast({ title: '编辑资料即将上线', icon: 'none' })
}
const handleOrderTab = (key: string) => {
Taro.showToast({ title: `${ORDER_TABS.find(t => t.key === key)?.label || ''}订单即将上线`, icon: 'none' })
}
const handleFeature = (item: typeof FEATURE_LIST[number]) => {
Taro.showToast({ title: `${item.label}即将上线`, icon: 'none' })
}
const handleAllOrders = () => {
Taro.showToast({ title: '全部订单即将上线', icon: 'none' })
}
return (
<View className='profile-page'>
<View className='page-placeholder'>
<Text className='placeholder-icon'>👤</Text>
<Text className='placeholder-text'></Text>
<Text className='placeholder-desc'>线</Text>
{/* ========== 背景图区域 ========== */}
<View
className='profile-header'
style={{ paddingTop: `${statusBarH}px` }}
>
{/* 设置按钮 */}
<View className='header-actions'>
<View className='settings-btn' onClick={handleSettings}>
<Icon name='setting-o' size={22} color='#fff' />
</View>
</View>
{/* 头像 + 用户信息 */}
<View className='user-card' onClick={handleEditProfile}>
<Image className='avatar' src={USER_INFO.avatar} mode='aspectFill' />
<View className='user-info'>
<View className='name-row'>
<Text className='name'>{USER_INFO.name}</Text>
<Text className='gender-tag'>{USER_INFO.gender === '男' ? '♂' : '♀'}</Text>
</View>
<Text className='class-name'>{USER_INFO.className}</Text>
</View>
<Icon name='arrow' size={18} color='rgba(255,255,255,0.7)' />
</View>
{/* 点赞/评论/收藏 */}
<View className='stats-row'>
<View className='stat-item'>
<Text className='stat-num'>{USER_INFO.stats.likes}</Text>
<Text className='stat-label'></Text>
</View>
<View className='stat-item'>
<Text className='stat-num'>{USER_INFO.stats.comments}</Text>
<Text className='stat-label'></Text>
</View>
<View className='stat-item'>
<Text className='stat-num'>{USER_INFO.stats.favorites}</Text>
<Text className='stat-label'></Text>
</View>
</View>
</View>
{/* ========== 可滚动内容 ========== */}
<ScrollView className='profile-scroll' scrollY enhanced showScrollbar={false}>
{/* ========== 订单卡片 ========== */}
<View className='section-card order-card'>
<View className='card-header' onClick={handleAllOrders}>
<Text className='card-title'></Text>
<View className='card-more'>
<Text className='more-text'></Text>
<Icon name='arrow' size={14} color='#969799' />
</View>
</View>
<View className='order-tabs'>
{ORDER_TABS.map((tab) => (
<View
key={tab.key}
className='order-tab'
onClick={() => handleOrderTab(tab.key)}
>
<Icon name={tab.icon} size={24} color='#323233' />
<Text className='tab-label'>{tab.label}</Text>
</View>
))}
</View>
</View>
{/* ========== 功能列表 ========== */}
<View className='section-card feature-list'>
<CellGroup inset>
{FEATURE_LIST.map((item, index) => (
<Cell
key={item.key}
title={item.label}
icon={item.icon}
isLink
border={index < FEATURE_LIST.length - 1}
onClick={() => handleFeature(item)}
/>
))}
</CellGroup>
</View>
{/* ========== 底部信息 ========== */}
<View className='footer-info'>
<Text className='footer-icp'>ICP备2024000000号-1</Text>
<Text className='footer-version'> v1.0.0</Text>
</View>
</ScrollView>
{/* ========== TabBar ========== */}
<CustomTabBar activeKey='profile' />
</View>
)
+81 -13
View File
@@ -1,29 +1,97 @@
/* ========================================
校园任务页面
======================================== */
.tasks-page {
min-height: 100vh;
display: flex;
flex-direction: column;
background: #f7f8fa;
}
.page-placeholder {
/* 搜索栏 */
.tasks-search-bar {
padding: 20px 24px;
background: #fff;
}
/* 分类筛选 */
.tasks-filter {
background: #fff;
padding-bottom: 16px;
.filter-scroll {
white-space: nowrap;
}
.filter-tabs {
display: flex;
padding: 0 24px;
gap: 12px;
}
.filter-tab {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding-top: 300px;
padding: 16px 20px;
border-radius: 16px;
background: #f7f8fa;
flex-shrink: 0;
min-width: 120px;
transition: all 0.2s;
.placeholder-icon {
font-size: 96px;
margin-bottom: 24px;
&.active {
background: #1989fa;
box-shadow: 0 4px 16px rgba(25, 137, 250, 0.3);
.filter-emoji {
transform: scale(1.1);
}
.filter-label {
color: #fff;
}
}
.placeholder-text {
.filter-emoji {
font-size: 36px;
font-weight: 500;
color: #323233;
margin-bottom: 12px;
margin-bottom: 6px;
transition: transform 0.2s;
}
.placeholder-desc {
font-size: 28px;
color: #969799;
.filter-label {
font-size: 24px;
color: #646566;
}
}
}
/* 任务列表 */
.tasks-scroll {
flex: 1;
}
.tasks-list {
padding: 16px 24px;
.task-card-wrap {
margin-bottom: 16px;
transition: transform 0.2s;
&:active {
transform: scale(0.98);
}
}
.empty-tip {
text-align: center;
padding: 120px 0;
font-size: 28px;
color: #969799;
}
}
.bottom-safe {
height: 20px;
}
+97 -6
View File
@@ -1,15 +1,106 @@
import { View, Text } from '@tarojs/components'
import CustomTabBar from "@/custom-tab-bar"
import { useState, useMemo } from 'react'
import Taro from '@tarojs/taro'
import { View, ScrollView } from '@tarojs/components'
import { Search, Tabs, Tab } from '@antmjs/vantui'
import TaskCard from '@/components/TaskCard'
import CustomTabBar from '@/custom-tab-bar'
import { tasks } from '@/mock/tasks'
import type { TaskType } from '@/types/task'
import './index.less'
/** 筛选标签 */
const FILTER_TABS = [
{ title: '全部', value: 'all' as const },
{ title: '快递代取', value: 'express' as const },
{ title: '二手交易', value: 'secondhand' as const },
{ title: '求助', value: 'help' as const },
{ title: '活动', value: 'activity' as const },
{ title: '拼车', value: 'carpool' as const },
]
/** 任务类型 → emoji */
const TYPE_EMOJI: Record<string, string> = {
all: '📋',
express: '📦',
secondhand: '🛍️',
help: '🆘',
activity: '🎉',
carpool: '🚗',
}
export default function Tasks() {
const [activeFilter, setActiveFilter] = useState(0)
const [searchValue, setSearchValue] = useState('')
const filteredTasks = useMemo(() => {
const filterValue = FILTER_TABS[activeFilter]?.value || 'all'
let list = filterValue === 'all' ? tasks : tasks.filter((t) => t.type === filterValue)
if (searchValue.trim()) {
const kw = searchValue.trim().toLowerCase()
list = list.filter(
(t) =>
t.title.toLowerCase().includes(kw) ||
t.desc.toLowerCase().includes(kw) ||
t.location.toLowerCase().includes(kw),
)
}
return list
}, [activeFilter, searchValue])
const handleTaskClick = (id: string) => {
Taro.showToast({ title: '任务详情即将上线', icon: 'none' })
}
return (
<View className='tasks-page'>
<View className='page-placeholder'>
<Text className='placeholder-icon'>📋</Text>
<Text className='placeholder-text'></Text>
<Text className='placeholder-desc'>线</Text>
{/* 搜索栏 */}
<View className='tasks-search-bar'>
<Search
value={searchValue}
placeholder='搜索校园任务...'
shape='round'
onChange={(e) => setSearchValue(e.detail)}
onClear={() => setSearchValue('')}
/>
</View>
{/* 分类标签 */}
<View className='tasks-filter'>
<ScrollView scrollX enhanced showScrollbar={false} className='filter-scroll'>
<View className='filter-tabs'>
{FILTER_TABS.map((tab, idx) => (
<View
key={tab.value}
className={`filter-tab ${activeFilter === idx ? 'active' : ''}`}
onClick={() => setActiveFilter(idx)}
>
<View className='filter-emoji'>{TYPE_EMOJI[tab.value]}</View>
<View className='filter-label'>{tab.title}</View>
</View>
))}
</View>
</ScrollView>
</View>
{/* 任务列表 */}
<ScrollView className='tasks-scroll' scrollY enhanced showScrollbar={false}>
<View className='tasks-list'>
{filteredTasks.map((task) => (
<View
key={task.id}
className='task-card-wrap'
onClick={() => handleTaskClick(task.id)}
>
<TaskCard task={task} />
</View>
))}
{filteredTasks.length === 0 && (
<View className='empty-tip'></View>
)}
</View>
<View className='bottom-safe' />
</ScrollView>
<CustomTabBar activeKey='tasks' />
</View>
)