feat: 客户端pad
This commit is contained in:
@@ -0,0 +1,167 @@
|
||||
.panel {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
/* ========== 头部 ========== */
|
||||
.header {
|
||||
padding: 18px 16px;
|
||||
border-bottom: 1px solid rgba(0, 212, 255, 0.12);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.headerIcon {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
border-radius: 10px;
|
||||
background: linear-gradient(135deg, rgba(0, 112, 212, 0.3), rgba(0, 180, 255, 0.15));
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #00d4ff;
|
||||
font-size: 16px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.headerTitle {
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
color: #fff;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.headerSub {
|
||||
font-size: 11px;
|
||||
color: rgba(255, 255, 255, 0.35);
|
||||
}
|
||||
|
||||
.count {
|
||||
margin-left: auto;
|
||||
background: rgba(0, 112, 212, 0.2);
|
||||
color: #00b4ff;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
padding: 2px 10px;
|
||||
border-radius: 10px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
/* ========== 列表 ========== */
|
||||
.list {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.center {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 200px;
|
||||
}
|
||||
|
||||
/* ========== 线路卡片 ========== */
|
||||
.routeCard {
|
||||
padding: 14px;
|
||||
margin-bottom: 8px;
|
||||
border-radius: 10px;
|
||||
cursor: pointer;
|
||||
transition: all 0.25s;
|
||||
border: 1px solid rgba(255, 255, 255, 0.06);
|
||||
background: rgba(255, 255, 255, 0.03);
|
||||
|
||||
&:hover {
|
||||
background: rgba(0, 150, 220, 0.08);
|
||||
border-color: rgba(0, 180, 255, 0.2);
|
||||
}
|
||||
}
|
||||
|
||||
.routeCardActive {
|
||||
background: rgba(0, 112, 212, 0.12);
|
||||
border-color: rgba(0, 150, 255, 0.4);
|
||||
box-shadow: 0 0 16px rgba(0, 112, 212, 0.12);
|
||||
|
||||
.routeName {
|
||||
color: #00d4ff;
|
||||
}
|
||||
}
|
||||
|
||||
.routeName {
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
color: rgba(255, 255, 255, 0.92);
|
||||
margin-bottom: 8px;
|
||||
transition: color 0.2s;
|
||||
}
|
||||
|
||||
/* ========== 标签行 ========== */
|
||||
.tagRow {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.tag {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
font-size: 11px;
|
||||
color: rgba(255, 255, 255, 0.5);
|
||||
background: rgba(255, 255, 255, 0.06);
|
||||
padding: 2px 8px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.tagIcon {
|
||||
font-size: 10px;
|
||||
color: rgba(0, 180, 255, 0.6);
|
||||
}
|
||||
|
||||
/* ========== 航点路径 ========== */
|
||||
.waypointPath {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
padding: 10px 0 4px;
|
||||
border-top: 1px dashed rgba(255, 255, 255, 0.08);
|
||||
}
|
||||
|
||||
.waypointDot {
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
border-radius: 50%;
|
||||
background: rgba(0, 180, 255, 0.6);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.waypointName {
|
||||
font-size: 12px;
|
||||
color: rgba(255, 255, 255, 0.7);
|
||||
}
|
||||
|
||||
.waypointArrow {
|
||||
font-size: 11px;
|
||||
color: rgba(0, 180, 255, 0.5);
|
||||
margin: 0 1px;
|
||||
}
|
||||
|
||||
/* ========== 开始航行按钮 ========== */
|
||||
.startBtn {
|
||||
margin-top: 12px;
|
||||
height: 36px;
|
||||
border-radius: 8px;
|
||||
font-weight: 600;
|
||||
font-size: 14px;
|
||||
letter-spacing: 1px;
|
||||
background: linear-gradient(135deg, #0070d4, #0096ff);
|
||||
border: none;
|
||||
|
||||
&:hover {
|
||||
background: linear-gradient(135deg, #0080e8, #00a8ff);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
import React, { useMemo } from 'react';
|
||||
import { Spin, Empty } from 'antd';
|
||||
import {
|
||||
ClockCircleOutlined,
|
||||
EnvironmentOutlined,
|
||||
SendOutlined,
|
||||
NodeIndexOutlined,
|
||||
} from '@ant-design/icons';
|
||||
import type { BoatRouteListVO, BoatWaypointVO } from '@/types/boatRoute';
|
||||
import styles from './index.less';
|
||||
|
||||
interface LeftPanelProps {
|
||||
routes: BoatRouteListVO[];
|
||||
routeWaypointsMap: Record<string, BoatWaypointVO[]>;
|
||||
loading: boolean;
|
||||
selectedRouteId: string | null;
|
||||
onSelectRoute: (routeId: string | null) => void;
|
||||
}
|
||||
|
||||
/** 格式化时间(秒 → "XX分钟") */
|
||||
const formatDuration = (seconds?: number) => {
|
||||
if (!seconds || seconds <= 0) return null;
|
||||
const min = Math.round(seconds / 60);
|
||||
return min > 0 ? `${min}分钟` : '<1分钟';
|
||||
};
|
||||
|
||||
/** 格式化距离 */
|
||||
const formatDistance = (meters?: number) => {
|
||||
if (!meters || meters <= 0) return null;
|
||||
return meters >= 1000 ? `${(meters / 1000).toFixed(1)}km` : `${Math.round(meters)}m`;
|
||||
};
|
||||
|
||||
const LeftPanel: React.FC<LeftPanelProps> = ({
|
||||
routes,
|
||||
routeWaypointsMap,
|
||||
loading,
|
||||
selectedRouteId,
|
||||
onSelectRoute,
|
||||
}) => {
|
||||
return (
|
||||
<div className={styles.panel}>
|
||||
<div className={styles.header}>
|
||||
<div className={styles.headerIcon}>
|
||||
<SendOutlined />
|
||||
</div>
|
||||
<div>
|
||||
<div className={styles.headerTitle}>游览线路</div>
|
||||
<div className={styles.headerSub}>选择线路开始游览</div>
|
||||
</div>
|
||||
<span className={styles.count}>{routes.length}</span>
|
||||
</div>
|
||||
|
||||
<div className={styles.list}>
|
||||
{loading ? (
|
||||
<div className={styles.center}><Spin /></div>
|
||||
) : routes.length === 0 ? (
|
||||
<div className={styles.center}>
|
||||
<Empty description="暂无游览线路" image={Empty.PRESENTED_IMAGE_SIMPLE} />
|
||||
</div>
|
||||
) : (
|
||||
routes.map((route) => {
|
||||
const isSelected = selectedRouteId === route.routeId;
|
||||
const waypoints = routeWaypointsMap[route.routeId] || [];
|
||||
const duration = formatDuration(route.totalDuration);
|
||||
const distance = formatDistance(route.totalDistance);
|
||||
|
||||
// 构建航点路径名称列表
|
||||
const waypointNames = waypoints
|
||||
.filter((wp) => wp.pointName)
|
||||
.map((wp) => wp.pointName);
|
||||
|
||||
return (
|
||||
<div
|
||||
key={route.routeId}
|
||||
className={`${styles.routeCard} ${isSelected ? styles.routeCardActive : ''}`}
|
||||
onClick={() => onSelectRoute(isSelected ? null : route.routeId)}
|
||||
>
|
||||
{/* 线路名称 */}
|
||||
<div className={styles.routeName}>{route.routeName}</div>
|
||||
|
||||
{/* 时长 + 距离 标签 */}
|
||||
<div className={styles.tagRow}>
|
||||
{duration && (
|
||||
<span className={styles.tag}>
|
||||
<ClockCircleOutlined className={styles.tagIcon} />
|
||||
{duration}
|
||||
</span>
|
||||
)}
|
||||
{distance && (
|
||||
<span className={styles.tag}>
|
||||
<EnvironmentOutlined className={styles.tagIcon} />
|
||||
{distance}
|
||||
</span>
|
||||
)}
|
||||
<span className={styles.tag}>
|
||||
<NodeIndexOutlined className={styles.tagIcon} />
|
||||
{route.waypointCount || waypoints.length}个景点
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{/* 航点路径 */}
|
||||
{waypointNames.length > 0 && (
|
||||
<div className={styles.waypointPath}>
|
||||
{waypointNames.map((name, idx) => (
|
||||
<React.Fragment key={idx}>
|
||||
<span className={styles.waypointDot} />
|
||||
<span className={styles.waypointName}>{name}</span>
|
||||
{idx < waypointNames.length - 1 && (
|
||||
<span className={styles.waypointArrow}>→</span>
|
||||
)}
|
||||
</React.Fragment>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
})
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default LeftPanel;
|
||||
Reference in New Issue
Block a user