优化 全屏功能
This commit is contained in:
@@ -7,7 +7,9 @@ import zhCN from 'antd/locale/zh_CN';
|
||||
import {
|
||||
DashboardOutlined, ExperimentOutlined, VideoCameraOutlined,
|
||||
BellOutlined, UserOutlined, LogoutOutlined,
|
||||
AppstoreOutlined, SettingOutlined, MenuUnfoldOutlined, MenuFoldOutlined
|
||||
AppstoreOutlined, SettingOutlined, MenuUnfoldOutlined, MenuFoldOutlined,
|
||||
CompressOutlined,
|
||||
ExpandOutlined
|
||||
} from '@ant-design/icons';
|
||||
import logo from '../assets/logo.png';
|
||||
import { useSelector } from 'react-redux';
|
||||
@@ -25,6 +27,8 @@ export default function AppLayout() {
|
||||
const [time, setTime] = useState(new Date().toLocaleString());
|
||||
const [menuList, setMenuList] = useState([]);
|
||||
const [stationList, setStationList] = useState([]);
|
||||
const [isFullScreen, setIsFullScreen] = useState(false); // 新增全屏标识
|
||||
|
||||
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
@@ -49,6 +53,17 @@ export default function AppLayout() {
|
||||
}
|
||||
});
|
||||
};
|
||||
const toggleFullScreen = () => {
|
||||
if (!document.fullscreenElement) {
|
||||
document.documentElement.requestFullscreen();
|
||||
setIsFullScreen(true);
|
||||
} else {
|
||||
if (document.exitFullscreen) {
|
||||
document.exitFullscreen();
|
||||
setIsFullScreen(false);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const handleStationChange = (id: number) => {
|
||||
const station = stationList.find(s => s.id === id);
|
||||
@@ -98,6 +113,14 @@ export default function AppLayout() {
|
||||
return () => clearInterval(timer);
|
||||
}, [userInfo]);
|
||||
|
||||
useEffect(() => {
|
||||
const fullscreenChange = () => {
|
||||
setIsFullScreen(!!document.fullscreenElement);
|
||||
};
|
||||
document.addEventListener('fullscreenchange', fullscreenChange);
|
||||
return () => document.removeEventListener('fullscreenchange', fullscreenChange);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<ConfigProvider
|
||||
locale={zhCN}
|
||||
@@ -182,6 +205,14 @@ export default function AppLayout() {
|
||||
</Space>
|
||||
|
||||
<Space size="middle" style={{ flexWrap: 'wrap' }}>
|
||||
<Button
|
||||
type="text"
|
||||
icon={isFullScreen ? <CompressOutlined /> : <ExpandOutlined />}
|
||||
onClick={toggleFullScreen}
|
||||
style={{ color: '#fff', fontSize: 'clamp(12px, 1vw, 14px)' }}
|
||||
>
|
||||
{isFullScreen ? '退出全屏' : '全屏'}
|
||||
</Button>
|
||||
<span style={{ fontSize: 'clamp(12px, 1vw, 13px)' }}>{time}</span>
|
||||
<Space
|
||||
style={{ cursor: 'pointer', padding: '0 4px' }}
|
||||
|
||||
@@ -839,19 +839,16 @@ export default function CesiumMap({ ifClear, ifClearPlanLine, ifClearNavLine, fi
|
||||
}
|
||||
return;
|
||||
}
|
||||
console.log(22222222222)
|
||||
|
||||
|
||||
|
||||
const point = { lng: finishPoint.lng, lat: finishPoint.lat };
|
||||
console.log(isNavigationModeRef.current, drawRealTime, 8888888888)
|
||||
|
||||
// 如果是定位模式且还没有导航模式,则切换到导航模式
|
||||
if (!isNavigationModeRef.current && drawRealTime) {
|
||||
tracePointRef.current.setMode(TPMode.NAVIGATION);
|
||||
isNavigationModeRef.current = true;
|
||||
}
|
||||
console.log(444444444)
|
||||
|
||||
|
||||
tracePointRef.current.upsert(point, TPAction.ADD);
|
||||
|
||||
@@ -639,7 +639,6 @@ export default function DeviceStatusPage({
|
||||
|
||||
<div
|
||||
style={{
|
||||
height: 450,
|
||||
borderRadius: 8,
|
||||
overflow: 'hidden',
|
||||
display: 'flex',
|
||||
|
||||
@@ -115,9 +115,10 @@ export default function RobotTaskPage() {
|
||||
const handleFinish = (data) => {
|
||||
setExecute(false);
|
||||
utils.message.success('任务已完成');
|
||||
if (controllerRef.current) {
|
||||
controllerRef.current.destroy?.();
|
||||
}
|
||||
//if (controllerRef.current) {
|
||||
// controllerRef.current.destroy?.();
|
||||
//}
|
||||
setClearNavLine(clearNavLine + 1);
|
||||
setSelectedRobotForExecute(null);
|
||||
setSelectedRouteForExecute(null);
|
||||
fetchTaskList();
|
||||
@@ -445,9 +446,9 @@ export default function RobotTaskPage() {
|
||||
fetchTaskPoolList();
|
||||
fetchTaskHistoryList();
|
||||
setExecute(false);
|
||||
if (controllerRef.current) {
|
||||
controllerRef.current.destroy?.();
|
||||
}
|
||||
//if (controllerRef.current) {
|
||||
// controllerRef.current.destroy?.();
|
||||
//}
|
||||
setSelectedRobotForExecute(null);
|
||||
setSelectedRouteForExecute(null);
|
||||
} else {
|
||||
@@ -1147,7 +1148,7 @@ export default function RobotTaskPage() {
|
||||
{activeTab === 'history' && (
|
||||
<>
|
||||
<div style={{ marginBottom: 8, display: 'flex', gap: 8, alignItems: 'center' }}>
|
||||
{/*<RangePicker
|
||||
<RangePicker
|
||||
size="small"
|
||||
format="YYYY-MM-DD HH:mm:ss"
|
||||
placeholder={['开始时间', '结束时间']}
|
||||
@@ -1156,7 +1157,7 @@ export default function RobotTaskPage() {
|
||||
setHistoryFilterForm(prev => ({ ...prev, dateRange: dates }));
|
||||
}}
|
||||
showTime
|
||||
/>*/}
|
||||
/>
|
||||
<Select
|
||||
style={{ width: 120 }}
|
||||
size="small"
|
||||
|
||||
@@ -66,7 +66,7 @@ export default class DeviceController {
|
||||
// 切后台:关闭 WS
|
||||
if (document.visibilityState === 'hidden') {
|
||||
console.log('🔌 页面切后台,关闭 WebSocket');
|
||||
this.release();
|
||||
//this.release();
|
||||
wsManager.close();
|
||||
this.connectedDeviceSn = null;
|
||||
|
||||
@@ -127,7 +127,7 @@ export default class DeviceController {
|
||||
|
||||
this.unSubMessage?.();
|
||||
this.unSubStatus?.();
|
||||
this.release();
|
||||
//this.release();
|
||||
|
||||
//wsManager.close();
|
||||
this.connectedDeviceSn = null;
|
||||
@@ -158,7 +158,7 @@ export default class DeviceController {
|
||||
this.isControlled = false;
|
||||
this.onControlStatusChange?.(false);
|
||||
|
||||
//wsManager.close();
|
||||
wsManager.close();
|
||||
|
||||
try {
|
||||
const res = await getControlRight({
|
||||
|
||||
@@ -47,7 +47,7 @@ export function useWebRTCPlayer(deviceId: string, url: string) {
|
||||
v.style.height = '100%';
|
||||
v.style.objectFit = 'contain';
|
||||
videoRef.current = v;
|
||||
const token = "eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjE4ZDEwNGYzLTk0NjMtNDgwYS05YTYwLTI2YzI1YzQyZGU2ZiJ9.mYX8k1GOBPZQK_k-gitZRODr_XNtn3GyT-gJVbZjQi5VT1SURgUEdDyb2GriaMqyEgoER5BX9O6-LxTOw5aMOw"
|
||||
const token = "eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6Ijg4N2JiMWU4LTdmNjMtNDlhNy05NjVmLTRjMWFlOGMyZTIzYiJ9.PVeQayWLEPtHHWBQFtHb1Qkc5T-KVINPdXxChJ5vRasBpXOvyiGRfPPjWvB63aKdTZWLE2xV6r_8BCV0aphYmg"
|
||||
//const token = localStorage.getItem('videotoken') || JSON.parse(localStorage.getItem('userInfo') || '{}')?.token;
|
||||
const videoUrl = `${url}?token=${token}`;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user