Browse Source

只有在测量完成时,保存按钮可用

master
zhangjiming 4 months ago
parent
commit
93c5afbfdf
  1. 26
      src/pages/Measure.tsx
  2. 2
      src/services/socket.ts

26
src/pages/Measure.tsx

@ -94,15 +94,15 @@ export default function Measure() {
// } else {
// console.log("当前环境不支持 React Native WebView");
// }
if (!contextState.device.connected) {
Dialog.alert({
content: '蓝牙未连接,请先连接蓝牙',
onConfirm: () => {
navigate("/home/bluetooth");
},
})
return
}
if (!contextState.device.connected) {
Dialog.alert({
content: '蓝牙未连接,请先连接蓝牙',
onConfirm: () => {
navigate('/home/bluetooth');
},
});
return;
}
Bridge.startMeasure().then((res) => {
if (res.success) {
dispatch(updateTaskState('START_RECORD_SIG'));
@ -219,9 +219,13 @@ export default function Measure() {
<div className="btn-contained rounded-md text-sm h-10 flex-1" onClick={onStartClick}>
{measureState.leftPoints.length > 0 ? '重新测量' : '开始测量'}
</div>
<div className="btn-contained rounded-md text-sm h-10 flex-1" onClick={onSaveClick}>
<button
className="btn-contained rounded-md text-sm h-10 flex-1"
disabled={measureState.taskState !== 'FINISH_RECORD_RIGHT'}
onClick={onSaveClick}
>
</div>
</button>
</section>
<section className="grid grid-cols-2 gap-[10px] px-3">

2
src/services/socket.ts

@ -7,7 +7,7 @@ class WebSocketClient {
private ws: WebSocket | null = null;
private url: string;
private reconnectAttempts: number = -1;
private maxReconnectAttempts: number = 5;
private maxReconnectAttempts: number = 50;
private reconnectInterval: number = 3000;
private dataSub = new Subject<MobileDatagram>();

Loading…
Cancel
Save