diff --git a/env.js b/env.js
index 8259afa..5f29637 100644
--- a/env.js
+++ b/env.js
@@ -15,8 +15,8 @@ const envConfig = {
},
[ENV.PROD]: {
// baseURL: 'http://192.168.2.56:8081',
- baseURL: 'http://1.95.137.212:59015',//http://192.168.2.56:8081
- //baseURL: 'https://serviceri.satabot.com',
+ //baseURL: 'http://1.95.137.212:59015',//http://192.168.2.56:8081
+ baseURL: 'https://serviceri.satabot.com',
WS_URL: 'wss://ri.satabot.com/ws/'
},
};
diff --git a/src/components/devices/DeviceControl.tsx b/src/components/devices/DeviceControl.tsx
index 9a6e2ab..9ce1b57 100644
--- a/src/components/devices/DeviceControl.tsx
+++ b/src/components/devices/DeviceControl.tsx
@@ -86,6 +86,7 @@ const RobotControlCenter = ({ setView }) => {
const [selectedRoute, setSelectedRoute] = useState(null); // ✅ 新增
const [activeTab, setActiveTab] = useState<'remote' | 'gps' | 'vizanti'>('remote');
const [waypoints, setWaypoints] = useState(INITIAL_WAYPOINTS);
+ const [isConnecting, setIsConnecting] = useState(false); // 连接中状态
const [newWaypoint, setNewWaypoint] = useState({ id: 0, lon: '', lat: '' });
const [taskIssued, setTaskIssued] = useState(false);
const [taskRunning, setTaskRunning] = useState(false);
@@ -456,6 +457,8 @@ const RobotControlCenter = ({ setView }) => {
}
const getControl = (serialnum) => {
+ setIsConnecting(true);
+
const data = { platform: "web", deviceId: serialnum };
getJurisdiction(data).then(res => {
if (res?.data?.code === 200 && res?.data?.data?.remoteControl == true) {
@@ -470,7 +473,9 @@ const RobotControlCenter = ({ setView }) => {
}).catch(err => {
controlRef.current = false;
setIsControlled(false);
- })
+ }).finally(() => {
+ setIsConnecting(false);
+ });
};
const handleSelectRobot = async (robot) => {
@@ -1541,6 +1546,7 @@ const RobotControlCenter = ({ setView }) => {
onGamepadUpdate={handleGamepad}
handleControlModal={handleControlModal}
isControlled={isControlled}
+ isConnecting={isConnecting}
/>
diff --git a/src/components/devices/XboxController.tsx b/src/components/devices/XboxController.tsx
index 1c35f03..8c744b6 100644
--- a/src/components/devices/XboxController.tsx
+++ b/src/components/devices/XboxController.tsx
@@ -1,7 +1,7 @@
import React, { useEffect, useState, useRef } from 'react';
-const XboxController = ({ onGamepadUpdate, handleControlModal, isControlled }) => {
+const XboxController = ({ onGamepadUpdate, handleControlModal, isControlled, isConnecting }) => {
const [gamepadState, setGamepadState] = useState<{
buttons: boolean[];
axes: number[];
@@ -123,15 +123,24 @@ const XboxController = ({ onGamepadUpdate, handleControlModal, isControlled }) =
{/* Gamepad Status Badge */}
- {connected ? isControlled ? '控制中' : '重新选中设备获取控制权限' : '无控制器连接'}
+ {connected
+ ? isConnecting
+ ? '连接中...'
+ : isControlled
+ ? '控制中'
+ : '无控制权限'
+ : '未连接设备'
+ }