12451 06765f99db feat: H5 用户端 Taro 重写 + 前后端接口对齐修复
- 使用 Taro + React 重写 H5 用户端(替换旧的 React+Vite+H5 实现)
- 6 个页面:登录、首页、设备列表、设备详情、仓体详情、个人中心
- Zustand 状态管理 + API 层封装 11 个接口
- 后端 H5 路由:新增仪表盘/项目/设备/充电控制接口,组织数据隔离
- 扫码入口:/h5/{abstract_id} → 免认证查设备 + 登录后跳转
- 管理端:新增绑定码管理、二维码展示下载、设备绑定/替换 IMEI
- 产品落地页更新(hero-bg + logo 替换)
- 接口对齐修复:修正 action 路径/请求体,DashboardData 和 CabinetItem 字段匹配后端
- 布局兼容性:grid → flex,提升移动浏览器兼容性
- 移除旧 H5 项目 software/h5/
2026-07-03 02:45:00 +08:00

45 lines
1.3 KiB
TypeScript

import React from 'react'
import { View, Text } from '@tarojs/components'
import { ChannelStatusBadge } from './StatusBadge'
interface Props {
channelId: number
status: number
voltage?: number
current?: number
onClick?: () => void
}
const COLORS: Record<number, string> = {
0: '#9ca3af', // idle
1: '#16a34a', // charging
2: '#dc2626', // fault
3: '#d1d5db', // offline
}
export default function ChannelCard({ channelId, status, voltage, current, onClick }: Props) {
return (
<View
style={{
backgroundColor: '#fff',
borderRadius: 12,
padding: 16,
border: `2px solid ${COLORS[status] || '#e5e7eb'}`,
cursor: onClick ? 'pointer' : undefined,
}}
onClick={onClick}
>
<View style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 8 }}>
<Text style={{ fontSize: 24, fontWeight: 600, color: '#111' }}>#{channelId}</Text>
<ChannelStatusBadge status={status} />
</View>
{voltage !== undefined && (
<Text style={{ fontSize: 22, color: '#6b7280' }}>{voltage.toFixed(1)}V</Text>
)}
{current !== undefined && (
<Text style={{ fontSize: 22, color: '#6b7280' }}>{current.toFixed(1)}A</Text>
)}
</View>
)
}