From 487903cf4331c63a287678cb141c261482090261 Mon Sep 17 00:00:00 2001 From: blak-kong <546598185@qq.com> Date: Wed, 13 Mar 2024 15:04:14 +0800 Subject: [PATCH] . --- src/components/bluetoot/connection/index.tsx | 24 ++++------ .../device-connection-popup.tsx | 47 +++++++++++++++++-- .../components/ModeContent/index.tsx | 38 ++++++++------- .../pages/iotCarePlan/iotCarePlan.tsx | 3 +- src/pages/index/index.tsx | 24 ++++++++++ src/pages/instrument/instrument.tsx | 4 +- 6 files changed, 101 insertions(+), 39 deletions(-) diff --git a/src/components/bluetoot/connection/index.tsx b/src/components/bluetoot/connection/index.tsx index 91da10e..8ac11a8 100644 --- a/src/components/bluetoot/connection/index.tsx +++ b/src/components/bluetoot/connection/index.tsx @@ -104,7 +104,7 @@ class ConnectionBluetoot extends Component { searchError: false, //是否没有搜索到设备 connectionStatus: false, //是否连接成功状态 hasVersionInfo: false, // 是否已获得版本信息 - hasSyncRecord: false, + hasSyncRecord: false, // 是否已同步记录 subDeviceConnectedStatus: false, //子设备是否连接成功状态 synchronousStatus: false, // 设备同步记录状态 islian: false, //是否获取离线记录状态 @@ -131,11 +131,6 @@ class ConnectionBluetoot extends Component { // 只有非断开状态的弹窗才自动连接蓝牙 if (!this.props.isDisconnect) { this.connection(); - } else { - // 断开状态弹窗:自动设置为错误模式 - this.setState({ - error: true, - }); } } @@ -989,22 +984,17 @@ class ConnectionBluetoot extends Component { this.sendGetVersion(); } } - }, 1000); + }, 600); // 5秒后没有收到版本返回,直接跳去护理页 - // if (isGetVersionTimer) clearTimeout(isGetVersionTimer); - // isGetVersionTimer = setTimeout(() => { - // that.setData({ - // connectionStatus: true, - // // subDeviceConnectedStatus: true, // 子设备连接状态 - // }) - // this.sendSyncRecording() - // }, 5000); + if (isGetVersionTimer) clearTimeout(isGetVersionTimer); + isGetVersionTimer = setTimeout(() => { + this.sendSyncRecording(); + }, 5000); } /** 发送同步记录 */ sendSyncRecording() { - const { deviceInfo } = this.props; const versionCommand = { commandType: "InfoQuery", infoQueryType: "offlineClockSummary", @@ -1035,6 +1025,7 @@ class ConnectionBluetoot extends Component { console.log("onReconnect"); // 重置信息并重连 this.setState({ + isBreak: false, error: false, searchError: false, errorText: "", @@ -1077,6 +1068,7 @@ class ConnectionBluetoot extends Component { connectionSuccess={connectionSuccess} isConnection={isConnection} error={error} + isDisconnect={isDisconnect} title="面罩模式启动中" /> diff --git a/src/components/bluetoot/device-connection-popup/device-connection-popup.tsx b/src/components/bluetoot/device-connection-popup/device-connection-popup.tsx index a4cdf1b..f288875 100644 --- a/src/components/bluetoot/device-connection-popup/device-connection-popup.tsx +++ b/src/components/bluetoot/device-connection-popup/device-connection-popup.tsx @@ -84,6 +84,7 @@ export default class DeviceConnectPopup extends Component { isConnection, currentDeviceType, error, + isDisconnect, } = this.props; return ( @@ -103,7 +104,7 @@ export default class DeviceConnectPopup extends Component { > {/* 非错误弹窗 */} - {!error && ( + {!error && !isDisconnect && ( { )} - {/* 错误与失败弹窗 */} - {error && ( + {/* 断开弹窗 */} + {!error && isDisconnect && ( + + + {data.bluetoothClosedTitle} + + + {!this.isImage(data.bluetoothClosed) ? ( + + + + + + + )} + + {/* 错误失败弹窗 */} + {error && !isDisconnect && ( 模式功效 {ActiveModeItem.modeDesc} - - 当前输出技术 - - {ActiveModeItem.combineData.map((item) => { - return ( - - - - {item.effectContent}({item.technologyInfo}) + {ActiveModeItem.combineData.length > 0 && ( + + 当前输出技术 + + {ActiveModeItem.combineData.map((item) => { + return ( + + + + {item.effectContent}({item.technologyInfo}) + - - ); - })} + ); + })} + - + )} )} diff --git a/src/moduleIOT/pages/iotCarePlan/iotCarePlan.tsx b/src/moduleIOT/pages/iotCarePlan/iotCarePlan.tsx index c84de6d..8cb13ae 100644 --- a/src/moduleIOT/pages/iotCarePlan/iotCarePlan.tsx +++ b/src/moduleIOT/pages/iotCarePlan/iotCarePlan.tsx @@ -1468,8 +1468,9 @@ class IotCarePlan extends Component { // 仪器缓存模式,判断是否存在于现有模式中 let recordModeItem = ModeList.find((item) => { - return item.id == WL200NursingHistory.currentServiceData.id; + return item.id == WL200NursingHistory.currentServiceData.modeId; }); + console.log("recordModeItem", recordModeItem); if (!WL200NursingHistory || !recordModeItem) { console.log("仪器有数据, 但是缓存没有数据, 忽略"); return; diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx index c284c79..a44ac5a 100644 --- a/src/pages/index/index.tsx +++ b/src/pages/index/index.tsx @@ -106,6 +106,7 @@ class Index extends Component { isBindingError: false, // 绑定失败 isBeforeBindingError: false, // 绑定前校验错误弹窗 BeforeBindingErrorText: "", // 绑定前校验错误文本 + isBindingError203: false, // 绑定失败弹窗:已被别人绑定 instrumentList: [], // 仪器列表 unbindingInstrumentList: [], // 未绑定仪器列表 @@ -661,6 +662,8 @@ class Index extends Component { this.getInstrumentIntroInfo(instrumentInfo.id); }, 1000); return; + } else if (data.code === 203) { + this.setState({ isBindingError203: true }); } else if (data.code === 202) { // 换绑操作 this.setState({ isExchangeBinding: true, isVisibleBinding: true }); @@ -705,6 +708,7 @@ class Index extends Component { } }; // 仪器绑定失败弹窗 + // 绑定失败 onBindErrorClose = () => { this.setState({ isBindingError: false }); this.removeScanFun(); @@ -713,6 +717,15 @@ class Index extends Component { this.onBindErrorClose(); go("/pages/consultant/consultant?customBack=true"); }; + // 已被别人绑定 + onBindErrorClose203 = () => { + this.setState({ isBindingError203: false }); + }; + onBindErrorConfirm203 = () => { + this.onBindErrorClose203(); + go("/pages/consultant/consultant"); + }; + // 绑定后弹窗 onBeforeBindClose = () => { this.setState({ isBeforeBindingError: false }); this.removeScanFun(); @@ -951,6 +964,7 @@ class Index extends Component { isBindingError, isBeforeBindingError, BeforeBindingErrorText, + isBindingError203, isRegisterBoolean, isExchangeBinding, instrumentInfo, @@ -1080,6 +1094,16 @@ class Index extends Component { confirm={this.onBeforeBindConfirm} /> + + { let code = Number(res.code); // 强制类型转换 if (code === 200) { this.openBindingVisible(); - } else if (code === 204) { + } else if (code === 204 || code === 205) { this.setState({ isBindingCheckError: true }); } else { this.setState({ isBindingError: true }); @@ -345,6 +345,8 @@ export default class Instrument extends Component { go("/pages/instrument/intro?id=" + channelInfo.id); } else if (res.data.code === 204) { this.setState({ isBindingCheckError: false }); + } else if (res.data.code === 203) { + this.setState({ isBindingError203: true }); } else { this.setState({ isBindingError: true }); }