任务、消息
This commit is contained in:
+153
-6
@@ -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>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user