feat: 第三方相关文档
This commit is contained in:
@@ -0,0 +1,567 @@
|
||||
# 客户端 Pad 页面实现方案
|
||||
|
||||
## 1. 需求概述
|
||||
|
||||
为 Pad 端客户提供一个独立的设备监控页面,用户通过设备 SN 登录后,实时查看设备状态、航线信息和三维模型,并可对设备进行基础操控。
|
||||
|
||||
### 核心功能
|
||||
- **设备 SN 登录**:输入设备 SN 号直接登录,无需账号密码
|
||||
- **SSE 实时订阅**:登录后通过 SSE 持续接收设备上报消息
|
||||
- **三栏布局**:左侧航线列表 / 中间三维模型 / 右侧设备信息与操控
|
||||
|
||||
### 参考设计
|
||||
参见 `public/7.png`,整体为深色主题三栏布局,适配 Pad 横屏。
|
||||
|
||||
---
|
||||
|
||||
## 2. 技术方案
|
||||
|
||||
### 2.1 技术栈(复用现有项目)
|
||||
|
||||
| 层面 | 技术 | 说明 |
|
||||
|------|------|------|
|
||||
| 框架 | UmiJS 3.5 + React 18 | 与现有项目一致 |
|
||||
| UI | Ant Design 5.x | 复用现有主题配置 |
|
||||
| 3D 引擎 | Cesium 1.110 | 复用现有 CesiumContainer |
|
||||
| SSE | Fetch + ReadableStream | 复用现有 `useDeviceSSE` 模式 |
|
||||
| 样式 | Less + CSS Modules | 深色主题,适配 Pad |
|
||||
|
||||
### 2.2 页面路由
|
||||
|
||||
```
|
||||
/client/login → 设备 SN 登录页(无布局,layout: false)
|
||||
/client → 客户端主页(独立布局,layout: false)
|
||||
```
|
||||
|
||||
在 `config/routes.ts` 中新增:
|
||||
|
||||
```typescript
|
||||
// 客户端 Pad 页面 - 无布局
|
||||
{
|
||||
path: '/client/login',
|
||||
component: '@/pages/client/Login',
|
||||
layout: false,
|
||||
},
|
||||
{
|
||||
path: '/client',
|
||||
component: '@/pages/client',
|
||||
layout: false,
|
||||
},
|
||||
```
|
||||
|
||||
### 2.3 认证方案
|
||||
|
||||
客户端采用轻量级方案:Gateway 放行 `/client/**` 路径 + 后端 SN 校验,无需 JWT 认证。
|
||||
|
||||
```
|
||||
用户输入设备 SN → 调用后端校验接口 → 返回设备信息 → 存入 sessionStorage → 进入主页
|
||||
```
|
||||
|
||||
**后端接口(需新增)**:
|
||||
|
||||
```
|
||||
GET /api-device/client/auth/check?deviceSn=xxx
|
||||
Response: { code: 0, data: { deviceSn: string, deviceName: string, deviceType: number } }
|
||||
```
|
||||
|
||||
**前端存储**:
|
||||
- `sessionStorage.setItem('client_device_sn', deviceSn)` — 关闭标签页即失效
|
||||
- `sessionStorage.setItem('client_device_info', JSON.stringify(deviceInfo))`
|
||||
|
||||
**安全白名单**:在 device-center 的 `application.yml` 中配置 `zlt.security.ignore.httpUrls: /client/**`,Gateway 层面放行。
|
||||
|
||||
**后续请求**:所有客户端 API 通过 `?deviceSn=xxx` 参数传递设备标识,无需 Authorization header。
|
||||
|
||||
---
|
||||
|
||||
## 3. 页面结构设计
|
||||
|
||||
### 3.1 目录结构
|
||||
|
||||
```
|
||||
src/pages/client/
|
||||
├── Login/
|
||||
│ ├── index.tsx # SN 登录页
|
||||
│ └── index.less
|
||||
├── index.tsx # 主页入口(三栏布局容器)
|
||||
├── index.less # 主页样式
|
||||
├── components/
|
||||
│ ├── LeftPanel/ # 左侧 - 航线列表
|
||||
│ │ ├── index.tsx
|
||||
│ │ ├── index.less
|
||||
│ │ └── RouteItem.tsx # 航线列表项
|
||||
│ ├── CenterView/ # 中间 - 三维模型视图
|
||||
│ │ ├── index.tsx
|
||||
│ │ └── index.less
|
||||
│ ├── RightPanel/ # 右侧 - 设备信息与操控
|
||||
│ │ ├── index.tsx
|
||||
│ │ ├── index.less
|
||||
│ │ ├── DeviceStatus.tsx # 设备状态卡片
|
||||
│ │ ├── DeviceControl.tsx # 设备操控面板
|
||||
│ │ └── DeviceTelemetry.tsx # 遥测数据展示
|
||||
│ └── SSEProvider.tsx # SSE 连接管理(Context)
|
||||
├── hooks/
|
||||
│ ├── useClientAuth.ts # 客户端认证 hook
|
||||
│ ├── useClientSSE.ts # SSE 订阅 hook(复用 useDeviceSSE 模式)
|
||||
│ └── useClientRoutes.ts # 航线数据 hook
|
||||
├── services/
|
||||
│ └── clientApi.ts # 客户端专用 API
|
||||
└── types/
|
||||
└── index.ts # 类型定义
|
||||
```
|
||||
|
||||
### 3.2 整体布局
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────┐
|
||||
│ 客户端主页 (100vw × 100vh) │
|
||||
├────────────┬──────────────────────────┬─────────────────┤
|
||||
│ │ │ │
|
||||
│ 左侧面板 │ 中间三维视图 │ 右侧面板 │
|
||||
│ 280px │ flex: 1 │ 320px │
|
||||
│ │ │ │
|
||||
│ ┌──────┐ │ ┌──────────────────┐ │ ┌───────────┐ │
|
||||
│ │航线列表│ │ │ │ │ │ 设备状态 │ │
|
||||
│ │ │ │ │ Cesium 3D │ │ │ │ │
|
||||
│ │ 航线1 │ │ │ 模型 + 航线 │ │ ├───────────┤ │
|
||||
│ │ 航线2 │ │ │ 轨迹渲染 │ │ │ 遥测数据 │ │
|
||||
│ │ 航线3 │ │ │ │ │ │ │ │
|
||||
│ │ ... │ │ │ │ │ ├───────────┤ │
|
||||
│ │ │ │ └──────────────────┘ │ │ 设备操控 │ │
|
||||
│ └──────┘ │ │ └───────────┘ │
|
||||
│ │ │ │
|
||||
├────────────┴──────────────────────────┴─────────────────┤
|
||||
│ 底部状态栏(SSE 连接状态) │
|
||||
└─────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 4. 模块详细设计
|
||||
|
||||
### 4.1 登录页(Login)
|
||||
|
||||
**功能**:
|
||||
- 单一输入框,输入设备 SN
|
||||
- 点击登录调用认证接口
|
||||
- 验证通过后跳转 `/client`
|
||||
- 深色主题,居中卡片布局,适配 Pad
|
||||
|
||||
**交互流程**:
|
||||
```
|
||||
输入 SN → 点击登录 → loading →
|
||||
成功 → 存储 token/deviceSn → history.push('/client')
|
||||
失败 → 提示"设备不存在或未绑定"
|
||||
```
|
||||
|
||||
**核心代码结构**:
|
||||
```tsx
|
||||
// pages/client/Login/index.tsx
|
||||
const ClientLogin: React.FC = () => {
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const onSubmit = async (values: { deviceSn: string }) => {
|
||||
setLoading(true);
|
||||
const res = await clientApi.loginBySn(values.deviceSn);
|
||||
if (res.code === 0) {
|
||||
sessionStorage.setItem('client_token', res.data.token);
|
||||
sessionStorage.setItem('client_device_sn', res.data.deviceSn);
|
||||
history.push('/client');
|
||||
} else {
|
||||
message.error(res.msg || '设备验证失败');
|
||||
}
|
||||
setLoading(false);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={styles.loginContainer}>
|
||||
<div className={styles.loginCard}>
|
||||
<img src={logo} className={styles.logo} />
|
||||
<h2>设备客户端</h2>
|
||||
<Form onFinish={onSubmit}>
|
||||
<Form.Item name="deviceSn" rules={[{ required: true, message: '请输入设备SN' }]}>
|
||||
<Input prefix={<ApiOutlined />} placeholder="请输入设备SN号" size="large" />
|
||||
</Form.Item>
|
||||
<Button type="primary" htmlType="submit" loading={loading} block size="large">
|
||||
登录
|
||||
</Button>
|
||||
</Form>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
```
|
||||
|
||||
### 4.2 SSE 连接管理(SSEProvider)
|
||||
|
||||
复用现有项目 `useDeviceSSE` 的 Fetch + ReadableStream 模式,通过 React Context 向子组件分发实时数据。
|
||||
|
||||
**SSE 订阅地址(复用现有)**:
|
||||
```
|
||||
GET /api-device/device/sse/events?deviceSn={sn}
|
||||
Header: Authorization: Bearer {client_token}
|
||||
```
|
||||
|
||||
**事件类型**:
|
||||
| 事件名 | 说明 | 数据结构 |
|
||||
|--------|------|----------|
|
||||
| `device_status` | 设备在线/离线状态 | `{ status: 0\|1, deviceSn }` |
|
||||
| `telemetry` | 遥测数据(经纬度、高度、速度、电量等) | `{ lat, lng, alt, speed, battery, ... }` |
|
||||
| `mission_status` | 任务执行状态 | `{ missionId, status, progress }` |
|
||||
| `device_log` | 设备日志 | `{ level, message, timestamp }` |
|
||||
|
||||
**Context 结构**:
|
||||
```tsx
|
||||
// components/SSEProvider.tsx
|
||||
interface SSEContextValue {
|
||||
connected: boolean; // SSE 连接状态
|
||||
deviceStatus: DeviceStatus; // 设备状态
|
||||
telemetry: TelemetryData; // 最新遥测数据
|
||||
missionStatus: MissionStatus; // 任务状态
|
||||
logs: DeviceLog[]; // 设备日志(最近 100 条)
|
||||
}
|
||||
|
||||
const SSEContext = createContext<SSEContextValue>(defaultValue);
|
||||
|
||||
export const SSEProvider: React.FC<{ deviceSn: string; token: string }> = ({ deviceSn, token, children }) => {
|
||||
// 复用 useDeviceSSE 的 fetch + ReadableStream 模式
|
||||
// 自动重连机制(3s/6s/12s 指数退避,最大 30s)
|
||||
// 解析 SSE 事件并更新 state
|
||||
// 通过 Context.Provider 向下分发
|
||||
};
|
||||
```
|
||||
|
||||
### 4.3 左侧面板 — 航线列表(LeftPanel)
|
||||
|
||||
**功能**:
|
||||
- 展示当前设备绑定的所有航线
|
||||
- 点击航线在中间三维视图中高亮显示轨迹
|
||||
- 显示航线基本信息(名称、距离、预计时长)
|
||||
- 当前执行中的航线高亮标记
|
||||
|
||||
**数据来源**:
|
||||
```typescript
|
||||
// 复用现有 API
|
||||
import { getBoatRoutesByDeviceSn } from '@/services/boatRoute';
|
||||
|
||||
// 获取设备航线列表
|
||||
const routes = await getBoatRoutesByDeviceSn(deviceSn);
|
||||
```
|
||||
|
||||
**航线列表项展示**:
|
||||
```
|
||||
┌─────────────────────────┐
|
||||
│ 📍 航线名称 │
|
||||
│ 距离: 2.3km 时长: 15min │
|
||||
│ 航点: 8个 状态: 就绪 │
|
||||
└─────────────────────────┘
|
||||
```
|
||||
|
||||
**交互**:
|
||||
- 单击选中 → 中间视图渲染航线轨迹 + 相机飞到航线区域
|
||||
- 选中态高亮(左侧边框 + 背景色变化)
|
||||
- 执行中的航线显示进度条
|
||||
|
||||
### 4.4 中间视图 — 三维模型(CenterView)
|
||||
|
||||
**功能**:
|
||||
- 加载水域三维模型(Cesium 3DTileset)
|
||||
- 选中航线后在模型上渲染航线轨迹(Polyline + 航点标记)
|
||||
- 实时显示设备当前位置(基于 SSE 遥测数据)
|
||||
- 支持触摸手势操作(旋转、缩放、平移)
|
||||
|
||||
**复用现有组件**:
|
||||
- `CesiumContainer` — Cesium Viewer 初始化、3DTileset 加载
|
||||
- 航线轨迹渲染逻辑 — 复用 `useRouteRenderer` 中的 Polyline 绘制
|
||||
|
||||
**核心实现**:
|
||||
```tsx
|
||||
// components/CenterView/index.tsx
|
||||
const CenterView: React.FC<{ selectedRoute: BoatRouteVO | null }> = ({ selectedRoute }) => {
|
||||
const viewerRef = useRef<Cesium.Viewer>();
|
||||
const { telemetry } = useSSEContext(); // 从 SSE Context 获取实时位置
|
||||
|
||||
// 1. 初始化 Cesium Viewer(复用现有配置)
|
||||
// 2. 加载 3DTileset 水域模型
|
||||
// 3. 选中航线时渲染轨迹
|
||||
useEffect(() => {
|
||||
if (selectedRoute && viewerRef.current) {
|
||||
renderRouteOnMap(viewerRef.current, selectedRoute);
|
||||
flyToRoute(viewerRef.current, selectedRoute);
|
||||
}
|
||||
}, [selectedRoute]);
|
||||
|
||||
// 4. 实时更新设备位置标记
|
||||
useEffect(() => {
|
||||
if (telemetry && viewerRef.current) {
|
||||
updateDevicePosition(viewerRef.current, telemetry);
|
||||
}
|
||||
}, [telemetry]);
|
||||
};
|
||||
```
|
||||
|
||||
**航线轨迹渲染**:
|
||||
- 航线路径:`Cesium.PolylineGraphics`,蓝色半透明线条
|
||||
- 航点标记:`Cesium.BillboardGraphics`,带序号标注
|
||||
- 设备位置:动态 Entity,带方向箭头
|
||||
- 选中航线时相机 `flyTo` 到航线包围盒
|
||||
|
||||
### 4.5 右侧面板 — 设备信息与操控(RightPanel)
|
||||
|
||||
右侧面板分为三个区域,纵向排列:
|
||||
|
||||
#### 4.5.1 设备状态卡片(DeviceStatus)
|
||||
|
||||
展示设备基础信息和连接状态:
|
||||
|
||||
```
|
||||
┌─────────────────────────┐
|
||||
│ 🟢 在线 │
|
||||
│ 设备名称: 巡检船-01 │
|
||||
│ SN: 4TADL12345678 │
|
||||
│ 类型: 无人船 │
|
||||
│ 信号强度: ████░░ 67% │
|
||||
│ SSE: 已连接 ✓ │
|
||||
└─────────────────────────┘
|
||||
```
|
||||
|
||||
#### 4.5.2 遥测数据展示(DeviceTelemetry)
|
||||
|
||||
实时展示 SSE 推送的遥测数据:
|
||||
|
||||
```
|
||||
┌─────────────────────────┐
|
||||
│ 📊 实时遥测 │
|
||||
│ 经度: 120.3456°E │
|
||||
│ 纬度: 30.1234°N │
|
||||
│ 航向: 125.3° │
|
||||
│ 速度: 3.2 m/s │
|
||||
│ 电量: ██████░░░ 72% │
|
||||
│ 水深: 4.5m │
|
||||
│ 任务: 执行中 (65%) │
|
||||
│ 更新: 2s 前 │
|
||||
└─────────────────────────┘
|
||||
```
|
||||
|
||||
数据从 `SSEContext.telemetry` 实时获取,每次 SSE 推送自动刷新。
|
||||
|
||||
#### 4.5.3 设备操控面板(DeviceControl)
|
||||
|
||||
提供基础设备操控功能:
|
||||
|
||||
```
|
||||
┌─────────────────────────┐
|
||||
│ 🎮 设备操控 │
|
||||
│ │
|
||||
│ [▶ 启动任务] [⏸ 暂停] │
|
||||
│ [⏹ 停止任务] [🏠 返航] │
|
||||
│ │
|
||||
│ ── 航线执行 ── │
|
||||
│ 选择航线: [下拉选择] │
|
||||
│ [▶ 执行选中航线] │
|
||||
│ │
|
||||
│ ── 手动控制 ── │
|
||||
│ 速度: ──●────── 3.0 m/s │
|
||||
│ │
|
||||
└─────────────────────────┘
|
||||
```
|
||||
|
||||
**操控 API(复用现有)**:
|
||||
```typescript
|
||||
// 复用 deviceApi 中的控制接口
|
||||
deviceApi.takeoff(params) // 起飞/启动
|
||||
deviceApi.returnToHome(deviceSn) // 返航
|
||||
deviceApi.pauseMission(deviceSn) // 暂停任务
|
||||
deviceApi.resumeMission(deviceSn) // 恢复任务
|
||||
deviceApi.stopMission(deviceSn) // 停止任务
|
||||
```
|
||||
|
||||
操控按钮需二次确认(Popconfirm),防止误操作。
|
||||
|
||||
---
|
||||
|
||||
## 5. SSE 数据流设计
|
||||
|
||||
```
|
||||
┌──────────┐ SSE Stream ┌──────────────┐
|
||||
│ 后端设备 │ ──────────────────→ │ SSEProvider │
|
||||
│ 消息推送 │ device_status │ (Context) │
|
||||
│ │ telemetry │ │
|
||||
│ │ mission_status │ │
|
||||
└──────────┘ device_log └──────┬───────┘
|
||||
│ Context
|
||||
┌─────────────┼─────────────┐
|
||||
▼ ▼ ▼
|
||||
┌──────────┐ ┌──────────┐ ┌──────────┐
|
||||
│LeftPanel │ │CenterView│ │RightPanel│
|
||||
│ 任务状态 │ │ 设备位置 │ │ 遥测数据 │
|
||||
│ 航线进度 │ │ 实时轨迹 │ │ 设备状态 │
|
||||
└──────────┘ └──────────┘ │ 操控反馈 │
|
||||
└──────────┘
|
||||
```
|
||||
|
||||
### SSE 连接生命周期
|
||||
|
||||
```
|
||||
登录成功 → 进入主页 → SSEProvider 挂载
|
||||
→ 建立 SSE 连接(fetch + ReadableStream)
|
||||
→ 持续接收事件 → 更新 Context state → 子组件响应式刷新
|
||||
→ 连接断开 → 指数退避重连(3s → 6s → 12s → 最大 30s)
|
||||
→ 页面卸载 → AbortController 取消连接
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 6. 类型定义
|
||||
|
||||
```typescript
|
||||
// pages/client/types/index.ts
|
||||
|
||||
/** 客户端登录响应 */
|
||||
interface ClientAuthResult {
|
||||
token: string;
|
||||
deviceSn: string;
|
||||
deviceName: string;
|
||||
deviceType: string;
|
||||
}
|
||||
|
||||
/** 设备状态 */
|
||||
interface DeviceStatus {
|
||||
online: boolean;
|
||||
deviceSn: string;
|
||||
deviceName: string;
|
||||
deviceType: string;
|
||||
signalStrength: number;
|
||||
lastHeartbeat: string;
|
||||
}
|
||||
|
||||
/** 遥测数据 */
|
||||
interface TelemetryData {
|
||||
longitude: number;
|
||||
latitude: number;
|
||||
altitude: number;
|
||||
heading: number;
|
||||
speed: number;
|
||||
battery: number;
|
||||
waterDepth?: number;
|
||||
timestamp: number;
|
||||
}
|
||||
|
||||
/** 任务状态 */
|
||||
interface MissionStatus {
|
||||
missionId: string;
|
||||
routeId: string;
|
||||
status: 'idle' | 'running' | 'paused' | 'completed' | 'failed';
|
||||
progress: number; // 0-100
|
||||
currentWaypoint: number;
|
||||
totalWaypoints: number;
|
||||
}
|
||||
|
||||
/** 设备日志 */
|
||||
interface DeviceLog {
|
||||
level: 'info' | 'warn' | 'error';
|
||||
message: string;
|
||||
timestamp: number;
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 7. 样式与适配
|
||||
|
||||
### 7.1 深色主题
|
||||
|
||||
与现有管理后台保持一致的深色风格:
|
||||
|
||||
```less
|
||||
// 主色调
|
||||
@bg-primary: #0a0e27; // 主背景
|
||||
@bg-panel: #111631; // 面板背景
|
||||
@bg-card: #1a1f42; // 卡片背景
|
||||
@border-color: #2a2f52; // 边框
|
||||
@text-primary: #e0e6ff; // 主文字
|
||||
@text-secondary: #8b92b3; // 次要文字
|
||||
@accent-blue: #3b82f6; // 强调色
|
||||
@accent-green: #22c55e; // 在线/成功
|
||||
@accent-red: #ef4444; // 离线/错误
|
||||
```
|
||||
|
||||
### 7.2 Pad 适配
|
||||
|
||||
- 目标设备:10-12 英寸 Pad,横屏模式(1920×1200 / 2560×1600)
|
||||
- 触摸优化:按钮最小 44×44px,间距适当加大
|
||||
- 字体:基础 14px,标题 18px,数据 16px
|
||||
- 面板可折叠:左右面板支持点击收起/展开,最大化中间视图
|
||||
- 横屏锁定提示:竖屏时显示旋转提示
|
||||
|
||||
### 7.3 响应式断点
|
||||
|
||||
```less
|
||||
// Pad 横屏
|
||||
@media (min-width: 1024px) and (max-width: 1920px) {
|
||||
.left-panel { width: 260px; }
|
||||
.right-panel { width: 300px; }
|
||||
}
|
||||
|
||||
// 大屏 Pad / 小笔记本
|
||||
@media (min-width: 1920px) {
|
||||
.left-panel { width: 300px; }
|
||||
.right-panel { width: 360px; }
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 8. 后端接口设计
|
||||
|
||||
### 8.1 客户端专用接口(需新增,Gateway 放行)
|
||||
|
||||
| 接口 | 方法 | 说明 |
|
||||
|------|------|------|
|
||||
| `/api-device/client/auth/check?deviceSn=xxx` | GET | 校验设备 SN,返回设备信息 |
|
||||
| `/api-device/client/routes?deviceSn=xxx` | GET | 获取设备航线列表 |
|
||||
| `/api-device/client/models?deviceSn=xxx` | GET | 获取设备关联的 3D 模型 |
|
||||
| `/api-device/client/sse/telemetry/{deviceSn}` | GET | SSE 遥测数据订阅(text/event-stream) |
|
||||
|
||||
### 8.2 安全策略
|
||||
|
||||
- Gateway 放行 `/client/**`(通过 `zlt.security.ignore.httpUrls` 配置白名单)
|
||||
- 后端通过 `deviceSn` 参数校验设备是否存在
|
||||
- 客户端只能访问 `/api-device/client/**` 下的接口,不能访问管理后台接口
|
||||
- 所有接口通过 `deviceSn` 限定数据范围,实现设备级数据隔离
|
||||
|
||||
---
|
||||
|
||||
## 9. 实现步骤
|
||||
|
||||
### Phase 1:基础框架(1-2天)
|
||||
1. 创建页面目录结构和路由配置
|
||||
2. 实现 SN 登录页和认证逻辑
|
||||
3. 搭建三栏布局框架和深色主题样式
|
||||
4. 实现 `clientApi.ts` 服务层
|
||||
|
||||
### Phase 2:SSE 与数据层(1天)
|
||||
5. 实现 `SSEProvider` 和 `useClientSSE` hook
|
||||
6. 定义类型和 Context 数据结构
|
||||
7. SSE 连接管理(重连、断线提示)
|
||||
|
||||
### Phase 3:三栏功能实现(2-3天)
|
||||
8. 左侧面板:航线列表加载与选中交互
|
||||
9. 中间视图:Cesium 初始化、3DTileset 加载、航线轨迹渲染
|
||||
10. 右侧面板:设备状态、遥测数据展示、操控按钮
|
||||
|
||||
### Phase 4:联调与优化(1-2天)
|
||||
11. 对接后端 SN 登录接口
|
||||
12. SSE 真实数据联调
|
||||
13. Pad 触摸交互优化和横屏适配
|
||||
14. 异常处理和边界情况
|
||||
|
||||
---
|
||||
|
||||
## 10. 注意事项
|
||||
|
||||
1. **安全性**:Gateway 放行 + SN 校验,客户端只能访问 `/client/**` 接口,不能越权
|
||||
2. **性能**:Cesium 在 Pad 上需注意内存占用,3DTileset 按需加载,控制 Entity 数量
|
||||
3. **网络**:SSE 断线重连机制必须可靠,弱网环境下给出明确提示
|
||||
4. **触摸**:所有交互元素适配触摸操作,避免 hover 依赖
|
||||
5. **复用**:最大程度复用现有 services、hooks、Cesium 配置,避免重复代码
|
||||
Reference in New Issue
Block a user