From 9b93ce8c0adb24c0adfad64fbd96a52e25c45ab6 Mon Sep 17 00:00:00 2001 From: blak-kong <546598185@qq.com> Date: Fri, 1 Mar 2024 18:14:03 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E6=8A=A4=E7=90=86=E6=8A=A5=E5=91=8A?= =?UTF-8?q?=E6=98=BE=E7=A4=BAbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/face_report/face_report.tsx | 32 +++++++++++----- src/pages/iotCarePlan/iotCarePlan.tsx | 54 ++++++++++++--------------- 2 files changed, 46 insertions(+), 40 deletions(-) diff --git a/src/pages/face_report/face_report.tsx b/src/pages/face_report/face_report.tsx index cf0937b..bb024c3 100644 --- a/src/pages/face_report/face_report.tsx +++ b/src/pages/face_report/face_report.tsx @@ -42,19 +42,26 @@ export default class Index extends Component { } async getRecord(id, recordId) { + console.log("id, recordId", id, recordId); let data = {}; if (id != null) { data["instrumentId"] = id; } let res = await InstrumentInfo.apiNursingLog.getRecord(data); if (res.data.code === 200) { - res.data.rows.map((item) => { - item.nursingTime = this.getTime(item.nursingTime); - item.createTime = getdates(item.createTime).replace(/-/g, "."); - if (item.id == recordId) { - this.setState({ recordData: item }); - } - }); + if (recordId) { + res.data.rows.map((item) => { + item.nursingTime = this.getTime(item.nursingTime); + item.createTime = getdates(item.createTime).replace(/-/g, "."); + + if (item.id == recordId) { + this.setState({ recordData: item }); + } + }); + } else { + this.setState({ recordData: res.data.rows[0] }); + } + this.setState({ recordList: res.data.rows.filter((item) => item.id != recordId), }); @@ -140,13 +147,20 @@ export default class Index extends Component { 完成度: 100 + ? 100 + : recordData.completionPercentage * 100 + } strokeWidth="12" color="linearGradient(to right, #eecda1, #ffe9c7) !important" /> {" "} - {recordData.completionPercentage * 100}% + {recordData.completionPercentage * 100 > 100 + ? 100 + : recordData.completionPercentage * 100} + % diff --git a/src/pages/iotCarePlan/iotCarePlan.tsx b/src/pages/iotCarePlan/iotCarePlan.tsx index 238d78c..8d0b761 100644 --- a/src/pages/iotCarePlan/iotCarePlan.tsx +++ b/src/pages/iotCarePlan/iotCarePlan.tsx @@ -222,6 +222,7 @@ class IotCarePlan extends Component { componentWillUnmount() {} componentDidShow() { + console.log("页面显示了"); this.initData(); this.getWL200NursingHistory(); @@ -230,7 +231,10 @@ class IotCarePlan extends Component { this.hadGotInstrumentHistoryData = false; } - componentDidHide() {} + componentDidHide() { + // 页面隐藏后,下次显示需要重新检查记录 + this.hadCheckReport = false; + } async initData() { let objStr = getStorageSync("instrument_detail"); @@ -985,6 +989,7 @@ class IotCarePlan extends Component { ModeStepIndex, ActiveModeItem, } = this.state; + console.log("resetTimer workStatus", workStatus); if ( workStatus == MODE_WORKING_ENUM.WORKING && step == 2 && @@ -997,6 +1002,7 @@ class IotCarePlan extends Component { console.log("ModeStepTimeArray", ModeStepTimeArray); this.elapsedTime = checkTime; if (currentSeconds >= 1) { + // 小程序显示倒计时 this.setState({ currentTime: s_to_ms(--currentSeconds), }); @@ -1004,7 +1010,6 @@ class IotCarePlan extends Component { let length = ModeStepTimeArray.length; if (length) { // 模式多个步骤节点切换 - // 已运行时间达到下一节点时,切换 if (checkTime > ModeStepTimeArray[ModeStepIndex]) { // 已运行时间达到下一节点,步骤切换时更新 @@ -1181,35 +1186,13 @@ class IotCarePlan extends Component { if (this.checkNurseTime()) { this.PostNursingLogClock(); } else { - this.showTips("护理时间不足,请重新连接护理"); + // 时间不满足,回到主页 + this.handleWorkStatus(false, "end"); + this.setState({ + isEndCarePlan: false, + isNotEnoughTime: true, + }); } - - // setTimeout(() => { - // //TODO IOS关闭蓝牙太快导致关机指令没发出去,暂时这么解决 - // const isEnough = this.checkNurseTime(); - // if (!isEnough) { - // Taro.showModal({ - // title: "提示", - // content: "护理时间不足,请重新连接护理", - // showCancel: false, - // success: (res) => { - // if (!this.state.endPlace || this.state.endPlace !== "report") { - // // back(); - // console.log("back"); - // } - // // this.state.innerAudioContext.destroy(); - // Taro.closeBluetoothAdapter(); - // }, - // }); - // } else { - // if (!this.state.endPlace || this.state.endPlace !== "report") { - // // back(); - // console.log("back"); - // } - // // this.state.innerAudioContext.destroy(); - // Taro.closeBluetoothAdapter(); - // } - // }, 500); } /** 检查时间是否达标仪器最低护理时间 */ @@ -1368,6 +1351,8 @@ class IotCarePlan extends Component { } else { // 5.判断设备状态-运行中 正常逻辑,这里不做处理,如果用户操作,则按正常流程判断 console.log("同步异常,但设备运行中"); + console.log("同步异常,但设备运行中"); + console.log("同步异常,但设备运行中"); } }; /** 获取小程序本地缓存的历史记录 */ @@ -1422,7 +1407,14 @@ class IotCarePlan extends Component { let res: any = await InstrumentInfo.apiNursingLog.addLog(params); console.log("PostNursingLogClock", res); - this.goFaceReport(); + if (res.data.code === 200) { + this.setState({ + isShowNursingSuccess: true, + }); + setTimeout(() => { + this.goFaceReport(); + }, 1000); + } }; /*** 护理记录 END ***/