fix:无人船2
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import React, { useEffect } from 'react';
|
||||
import { ConfigProvider, Button } from 'antd';
|
||||
import { LogoutOutlined } from '@ant-design/icons';
|
||||
import { ConfigProvider, Button, Spin } from 'antd';
|
||||
import { LogoutOutlined, DisconnectOutlined, ReloadOutlined } from '@ant-design/icons';
|
||||
import { darkTheme } from '@/theme';
|
||||
import LeftPanel from './components/LeftPanel';
|
||||
import CenterView from './components/CenterView';
|
||||
@@ -11,22 +11,20 @@ import EmergencyButton from './components/EmergencyButton';
|
||||
import { useClientAuth } from './hooks/useClientAuth';
|
||||
import { useClientSSE } from './hooks/useClientSSE';
|
||||
import { useRouteData } from './hooks/useRouteData';
|
||||
import { useMockTelemetry } from './hooks/useMockTelemetry';
|
||||
import { useNavigationState } from './hooks/useNavigationState';
|
||||
import { useNavigationData } from './hooks/useNavigationData';
|
||||
import styles from './index.less';
|
||||
|
||||
const ClientPage: React.FC = () => {
|
||||
// ── 认证 ──
|
||||
const { boatData: sseBoatData, sseConnected, connectSSE, disconnectSSE } = useClientSSE();
|
||||
const { boatData: sseBoatData, sseConnected, loading: sseLoading, deviceOffline, connectSSE, disconnectSSE } = useClientSSE();
|
||||
const { deviceSn, deviceInfo, handleLogout } = useClientAuth(disconnectSSE);
|
||||
|
||||
// ── 航线数据 ──
|
||||
const { routes, routeWaypointsMap, selectedRouteId, setSelectedRouteId, routeLoading } =
|
||||
useRouteData(deviceSn);
|
||||
|
||||
// ── 模拟遥测 ──
|
||||
const { boatData, handleModelCenter } = useMockTelemetry(deviceSn, sseBoatData);
|
||||
const boatData = sseBoatData;
|
||||
|
||||
// ── 沉浸模式状态机 ──
|
||||
const {
|
||||
@@ -70,6 +68,32 @@ const ClientPage: React.FC = () => {
|
||||
return (
|
||||
<ConfigProvider theme={darkTheme}>
|
||||
<div className={`${styles.container} ${isImmersive ? styles.sailing : ''}`}>
|
||||
{/* 设备离线遮罩 */}
|
||||
{deviceOffline && !sseConnected && (
|
||||
<div className={styles.offlineOverlay}>
|
||||
<div className={styles.offlineCard}>
|
||||
<DisconnectOutlined className={styles.offlineIcon} />
|
||||
<div className={styles.offlineTitle}>设备不在线</div>
|
||||
<div className={styles.offlineDesc}>
|
||||
无法订阅设备 <span className={styles.offlineSn}>{deviceInfo.deviceName || deviceSn}</span> 的实时数据
|
||||
<br />
|
||||
{sseLoading ? '正在重新连接...' : '请检查设备是否已开机并接入网络'}
|
||||
</div>
|
||||
{sseLoading ? (
|
||||
<Spin size="small" style={{ marginTop: 16 }} />
|
||||
) : (
|
||||
<Button
|
||||
icon={<ReloadOutlined />}
|
||||
onClick={() => connectSSE(deviceSn)}
|
||||
style={{ marginTop: 16, borderColor: 'rgba(0,212,255,0.4)', color: '#00d4ff' }}
|
||||
ghost
|
||||
>
|
||||
重试连接
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{/* 左侧游览线路 */}
|
||||
<div className={styles.leftPanel}>
|
||||
<LeftPanel
|
||||
@@ -88,7 +112,6 @@ const ClientPage: React.FC = () => {
|
||||
routes={routes}
|
||||
selectedRouteId={selectedRouteId}
|
||||
boatData={boatData}
|
||||
onModelCenter={handleModelCenter}
|
||||
isSailing={isSailing}
|
||||
sailingLoading={sailingLoading}
|
||||
previewStopSignal={previewStopSignal}
|
||||
|
||||
Reference in New Issue
Block a user