feat: 下任务推流地址修改
This commit is contained in:
Binary file not shown.
@@ -61,6 +61,13 @@ const DeviceForm: React.FC<DeviceFormProps> = ({ title, visible, onVisibleChange
|
||||
placeholder="如:http://220.205.16.27:8024/rtc/v1/whep/?app=live&stream=xxx"
|
||||
tooltip="WHEP视频流完整地址,用于无人机图传播放"
|
||||
/>
|
||||
<ProFormText
|
||||
name="pushStreamUrl"
|
||||
label="视频推流地址"
|
||||
width="lg"
|
||||
placeholder="如:http://220.205.16.27:8024/rtc/v1/whip/?app=live&stream=xxx"
|
||||
tooltip="用于无人机推流的地址"
|
||||
/>
|
||||
<ProFormTextArea name="deviceDesc" label="备注" width="lg" />
|
||||
</ProForm.Group>
|
||||
</ModalForm>
|
||||
|
||||
+15
-6
@@ -1,7 +1,7 @@
|
||||
import { useState, useRef, useEffect, useCallback } from 'react';
|
||||
import { message } from 'antd';
|
||||
import { notification } from 'antd';
|
||||
|
||||
// 空闲超时时间:30分钟(毫秒)
|
||||
// 空闲超时时间:1分钟(测试用,正式环境改为30分钟)
|
||||
const IDLE_TIMEOUT_MS = 30 * 60 * 1000;
|
||||
|
||||
// GPS信息
|
||||
@@ -182,12 +182,21 @@ export function useDeviceSSE(): UseDeviceSSEResult {
|
||||
console.log('[DeviceSSE] 连接已断开');
|
||||
}, []);
|
||||
|
||||
// 因空闲断开连接
|
||||
// 因空闲断开连接并显示提醒
|
||||
const disconnectDueToIdle = useCallback(() => {
|
||||
console.log('[DeviceSSE] 页面空闲超过30分钟,断开SSE连接以节省资源');
|
||||
console.log('[DeviceSSE] 页面空闲超过1分钟,断开SSE连接');
|
||||
setIsIdleDisconnected(true);
|
||||
// 禁止自动重连
|
||||
shouldReconnectRef.current = false;
|
||||
// 断开连接
|
||||
disconnectSSE();
|
||||
message.warning('页面空闲超过30分钟,已断开实时数据连接,请刷新页面重新连接');
|
||||
// 显示提醒,使用统一的 key 避免重复
|
||||
notification.warning({
|
||||
message: '页面长时间未操作',
|
||||
description: '已断开实时数据连接,请刷新页面重新连接',
|
||||
duration: 0,
|
||||
key: 'page-idle-warning',
|
||||
});
|
||||
}, [disconnectSSE]);
|
||||
|
||||
// 重置空闲定时器
|
||||
@@ -454,4 +463,4 @@ export function useDeviceSSE(): UseDeviceSSEResult {
|
||||
};
|
||||
}
|
||||
|
||||
export default useDeviceSSE;
|
||||
export default useDeviceSSE;
|
||||
|
||||
+15
-6
@@ -1,7 +1,7 @@
|
||||
import { useState, useRef, useEffect, useCallback } from 'react';
|
||||
import { message } from 'antd';
|
||||
import { notification } from 'antd';
|
||||
|
||||
// 空闲超时时间:30分钟(毫秒)
|
||||
// 空闲超时时间:1分钟(测试用,正式环境改为30分钟)
|
||||
const IDLE_TIMEOUT_MS = 30 * 60 * 1000;
|
||||
|
||||
// 无人机遥测数据接口定义(从useDeviceSSE.ts复制)
|
||||
@@ -185,12 +185,21 @@ export const useDroneSSE = (): UseDroneSSEReturn => {
|
||||
reconnectAttemptsRef.current = 0;
|
||||
}, []);
|
||||
|
||||
// 因空闲断开连接
|
||||
// 因空闲断开连接并显示提醒
|
||||
const disconnectDueToIdle = useCallback(() => {
|
||||
console.log('[DroneSSE] 页面空闲超过30分钟,断开SSE连接以节省资源');
|
||||
console.log('[DroneSSE] 页面空闲超过1分钟,断开SSE连接');
|
||||
setIsIdleDisconnected(true);
|
||||
// 禁止自动重连
|
||||
shouldReconnectRef.current = false;
|
||||
// 断开连接
|
||||
disconnectDroneSSE();
|
||||
message.warning('页面空闲超过30分钟,已断开无人机数据连接,请刷新页面重新连接');
|
||||
// 显示提醒,使用统一的 key 避免重复
|
||||
notification.warning({
|
||||
message: '页面长时间未操作',
|
||||
description: '已断开实时数据连接,请刷新页面重新连接',
|
||||
duration: 0,
|
||||
key: 'page-idle-warning',
|
||||
});
|
||||
}, [disconnectDroneSSE]);
|
||||
|
||||
// 重置空闲定时器
|
||||
@@ -488,4 +497,4 @@ export const useDroneSSE = (): UseDroneSSEReturn => {
|
||||
disconnectDroneSSE,
|
||||
resetDroneData,
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user