From a83f8c13ed8527101e41fcea03c2d6bc8885f7ec Mon Sep 17 00:00:00 2001 From: qsj <731458905@qq.com> Date: Wed, 20 Mar 2024 17:16:33 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/moduleIOT/pages/iotCarePlan/FR200.tsx | 26 +++++++++++++++++------ src/moduleIOT/pages/iotCarePlan/WL200.tsx | 2 -- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/moduleIOT/pages/iotCarePlan/FR200.tsx b/src/moduleIOT/pages/iotCarePlan/FR200.tsx index aa1d832..f4d72ee 100644 --- a/src/moduleIOT/pages/iotCarePlan/FR200.tsx +++ b/src/moduleIOT/pages/iotCarePlan/FR200.tsx @@ -155,7 +155,7 @@ class IotCarePlanFR200 extends Component { }, // 当前选中模式 SwitchActiveModeItem: {}, // 切换选中模式 ModeID: "mode_", // 模式KEY - activeModeID: "154", // 当前选中模式ID:用于高亮 + activeModeID: "", // 当前选中模式ID:用于高亮 ModeStepIndex: 0, // 当前护理功效步骤:每个步骤时间不定,所以时间另外计算,根据步骤显示 ModeStepTimeArray: [], // 护理功效时间步骤,用于切换显示GIF currentServiceData: { @@ -383,7 +383,8 @@ class IotCarePlanFR200 extends Component { ModeList: res.data.data, }); - if (this.state.activeModeID != '') { + + if(this.state.activeModeID){ this.state.ModeList.map(item => { if (item.id === this.state.activeModeID) { this.setState({ @@ -391,11 +392,17 @@ class IotCarePlanFR200 extends Component { }); } }) + let res1= res.data.data.find(e =>e.id == this.state.activeModeID) + setTimeout(() => { + this.modeCurrentFun(res1); + }, 100); + } else { + setTimeout(() => { + this.modeCurrentFun(res.data.data[0]); + }, 100); } - let res1= res.data.data.find(e =>e.id == this.state.activeModeID) - setTimeout(() => { - this.modeCurrentFun(res1); - }, 100); + + } else { this.setState({ ModeList: [] }); } @@ -1231,10 +1238,13 @@ class IotCarePlanFR200 extends Component { workMode: ActiveModeItem.modeType, // 使用模式 workStatus: newWorkStatus, }; - + console.log(ActiveModeItem,'查看ActiveModeItem'); + // 水分测试需要特殊处理 // 水分测试准备 水分测试工作 水分测试启动 if (ActiveModeItem.modeType === "moistureTest") { + console.log('查看切换-----------------------------------------'); + sendParams.testStatus = "standby"; // 切换为准备 if (isBtnClick) { // 水分测试启动 @@ -1952,6 +1962,8 @@ class IotCarePlanFR200 extends Component { JSON.stringify(obj) ); } else if ("moistureTest" === nursingData.workMode) { + // go(`/recoding/pages/moisture_test_report/moisture_test_report?data=${item.nursingData}&date=${item.createTime}`); + // go("/pages/face_report/face_report?id=" + this.state.currentDevice.id); console.log("水分测试"); } else { go("/pages/face_report/face_report?id=" + this.state.currentDevice.id); diff --git a/src/moduleIOT/pages/iotCarePlan/WL200.tsx b/src/moduleIOT/pages/iotCarePlan/WL200.tsx index 7a641bb..485a3db 100644 --- a/src/moduleIOT/pages/iotCarePlan/WL200.tsx +++ b/src/moduleIOT/pages/iotCarePlan/WL200.tsx @@ -2048,8 +2048,6 @@ class IotCarePlanWL200 extends Component { this.setState({ isMuted }); }; GetVideosTime = (event) => { - let videoRef = Taro.createVideoContext("myVideo", this); - // videoRef.currentTime console.log("获取播放时间", event.detail.currentTime); }; onPlay = (e) => { From 4c24a110402e79367f9f2983ed7ddbe39d2c0fb5 Mon Sep 17 00:00:00 2001 From: qsj <731458905@qq.com> Date: Thu, 21 Mar 2024 11:45:50 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BB=AA=E5=99=A8=E8=B7=B3=E8=BD=AC?= =?UTF-8?q?=E6=B0=B4=E5=88=86=E6=8A=A5=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/moduleIOT/pages/iotCarePlan/FR200.tsx | 175 +++++++++++++++--- src/moduleIOT/pages/iotCarePlan/WL200.tsx | 2 + .../iotCarePlan/components/Footer/FR200.tsx | 24 ++- .../iotCarePlan/components/ModeList/FR200.tsx | 14 +- .../components/WaterTest/index.tsx | 58 +++--- 5 files changed, 210 insertions(+), 63 deletions(-) diff --git a/src/moduleIOT/pages/iotCarePlan/FR200.tsx b/src/moduleIOT/pages/iotCarePlan/FR200.tsx index 1eb5f17..6ad0e3b 100644 --- a/src/moduleIOT/pages/iotCarePlan/FR200.tsx +++ b/src/moduleIOT/pages/iotCarePlan/FR200.tsx @@ -122,7 +122,37 @@ class IotCarePlanFR200 extends Component { { name: "左脸颊", forehead: 6, Total: 10 }, { name: "右脸颊", forehead: 2, Total: 10 }, ], - + stepList:[ + { + value: "Step1", + name: "额头", + finish: false, + schedule:0, + color:'#c2e5f3', + forehead:0 + }, + { + value: "Step2", + name: "左脸颊", + finish: false, + schedule:0, + color:'#c2e5f3', + forehead:0 + }, + { + value: "Step3", + name: "右脸颊", + finish: false, + schedule:0, + color:'#c2e5f3', + forehead:0 + }, + ], + stepIndex:0, + // 进度条定时器 + timerIdSchedule:null, + timerIdSuccess:null, + gear: { gear: 1 }, currentShowDialog: "", showVideoPlayBtn: true, // 视频播放按钮 @@ -133,7 +163,7 @@ class IotCarePlanFR200 extends Component { /** 连接设备 End */ /** 护理过程 */ - isRuningTest: false, // 是否正在测试 + isRuningTest: 1, // 是否正在测试 isShowStepTips: false, // 是否显示介绍步骤弹窗 isConnectionBlutoot: true, // 是否已连接蓝牙 isShowNurse: true, // 是否开始并显示护理 FR200默认已经开始准备护理 @@ -148,13 +178,13 @@ class IotCarePlanFR200 extends Component { isModeLock: false, // 模式是否锁定 isSwitchActiveMode: false, // 是否显示弹窗切换模式 ModeList: [], - ModeType: "all", // all + ModeType: "base", // all modeClass: "", // 1基础护理 2专区护理 3专研促渗 4敏期护理 5智能测肤 ActiveModeItem: { openSourceData: [], }, // 当前选中模式 SwitchActiveModeItem: {}, // 切换选中模式 - ModeID: "base_", // 模式KEY + ModeID: "mode_", // 模式KEY activeModeID: "", // 当前选中模式ID:用于高亮 ModeStepIndex: 0, // 当前护理功效步骤:每个步骤时间不定,所以时间另外计算,根据步骤显示 ModeStepTimeArray: [], // 护理功效时间步骤,用于切换显示GIF @@ -380,6 +410,7 @@ class IotCarePlanFR200 extends Component { this.setState({ ModeList: res.data.data, // 模式列表 ActiveModeItem: res.data.data[0], // 让模式列表正常显示 + ModeType: this.ModeTypeArray[res.data.data[0].modeClass], }); if (this.state.activeModeID != "") { @@ -599,6 +630,7 @@ class IotCarePlanFR200 extends Component { this.handleWorkStatus(false, MODE_WORKING_ENUM.STANDBY); }); }; + /** 开始护理按钮:点击开始,页面进行到下一步 */ onStartNurse = async () => { this.stepNext(); @@ -613,6 +645,37 @@ class IotCarePlanFR200 extends Component { // 如果检查失败,则报错 this.onEmitErrorTips(); }; + /** 完成护理,跳转到水分 */ + onsuccess = async () => { + let stepList= this.state.stepList + this.setState({ + isShowNursingSuccess:true + }) + // return; + let { currentDevice, ActiveModeItem } = this.state; + let params = {}; + let nursingData ={ + nursingData:JSON.stringify({ + GearData:[...stepList] + }) + } + params = { + instrumentId: currentDevice.id, + instrumentName: currentDevice.name, + modeId: ActiveModeItem.id, + modeName: ActiveModeItem.modeName, + nursingTime: s_to_hms(this.elapsedTime), + }; + params = { ...params, ...nursingData }; + let res: any = await InstrumentInfo.apiNursingLog.addLog(JSON.stringify(params)); + setTimeout(() => { + + this.setState({ + isShowNursingSuccess: false, + }) + go(`/recoding/pages/moisture_test_report/moisture_test_report?data=${nursingData}&date=${s_to_hms(this.elapsedTime)}&modeId=${ActiveModeItem.id}`); + }, 2000); + }; /** * @name 不可切换光照提示 @@ -740,11 +803,8 @@ class IotCarePlanFR200 extends Component { break; case "working": //设备的运行中状态 - console.log("设备状态同步 运行中状态", jsonStatus); - if (jsonStatus.workMode === "moistureTest") { - // 水分测试 - // teststatus:success - } + console.log("设备状态同步 运行中状态", jsonStatus.workMode); + // 脸部模式 if (jsonStatus.workMode === "face") { @@ -761,6 +821,56 @@ class IotCarePlanFR200 extends Component { default: break; } + if (jsonStatus.workMode === "moistureTest") { + if('success' === jsonStatus.testStatus){ + let stepList =this.state.stepList + let stepIndex =this.state.stepIndex + let timerIdSuccess =this.state.timerIdSuccess + let timerIdSchedule =this.state.timerIdSchedule + + if(stepList[stepIndex].finish){ + stepList[stepIndex].forehead =jsonStatus.waterLevel + if(stepIndex === 2){ + this.setState({ + isRuningTest:4 + }); + }else{ + this.setState({ + isRuningTest:1 + }); + } + + + clearTimeout(timerIdSuccess); + clearTimeout(timerIdSchedule); + console.log('成功拿到',jsonStatus,stepIndex); + let num =stepIndex + if(stepIndex < 2){ + num =stepIndex+1 + } + this.setState({ + timerIdSuccess:null,timerIdSchedule:null,stepIndex:num,stepList + }); + } + }else{ + let stepList =this.state.stepList + let stepIndex =this.state.stepIndex + let timerIdSuccess =this.state.timerIdSuccess + let timerIdSchedule =this.state.timerIdSchedule + if(stepList[stepIndex].finish){ + clearTimeout(timerIdSuccess); + clearTimeout(timerIdSchedule); + stepList[stepIndex].schedule=0 + stepList[stepIndex].finish=false + this.setState({ + stepList,isRuningTest:3 + }); + } + } + // 水分测试 + // testStatus:success + } + console.log( "jsonStatus?.workMode === this.state.ActiveModeItem.modeType", jsonStatus?.workMode === this.state.ActiveModeItem.modeType @@ -1227,17 +1337,39 @@ class IotCarePlanFR200 extends Component { workMode: ActiveModeItem.modeType, // 使用模式 workStatus: newWorkStatus, }; - console.log(ActiveModeItem,'查看ActiveModeItem'); + console.log(ActiveModeItem,'查看工作状态'); // 水分测试需要特殊处理 // 水分测试准备 水分测试工作 水分测试启动 if (ActiveModeItem.modeType === "moistureTest") { - console.log('查看切换-----------------------------------------'); - sendParams.testStatus = "standby"; // 切换为准备 + let stepList =this.state.stepList + let stepIndex =this.state.stepIndex + let timerIdSchedule =this.state.timerIdSchedule + let timerIdSuccess =this.state.timerIdSuccess if (isBtnClick) { + + timerIdSchedule= setTimeout(function() { + stepList[stepIndex].schedule=100 + + timerIdSuccess= setTimeout(function() { + stepList[stepIndex].finish=true + this.setState({ + stepList, + }); + }, 2000); + this.setState({ + stepList,timerIdSuccess + }); + }, 3000); + this.setState({ + isRuningTest: 2, + timerIdSchedule + }); // 水分测试启动 sendParams.testStatus = "start"; // 点击开始再开始 + console.log('点击开始',isBtnClick); + } } @@ -1263,7 +1395,7 @@ class IotCarePlanFR200 extends Component { */ onNursingTap(type = "") { // 如果已禁止运行,则停止执行后续逻辑 - if (this.state.isRuningTest) return; + if (this.state.isRuningTest === 2) return; // 防止多次点击 if (this.state.hadClickStart) return; this.setState({ @@ -1619,13 +1751,7 @@ class IotCarePlanFR200 extends Component { Taro.removeStorageSync("FR200NursingHistory"); }; - // todoPromise = () => { - // return new Promise((resolve, reject) => { - // setTimeout(() => { - // resolve(); - // }); - // }); - // }; + // 脸部one todoPromise = async () => { const nowFR200NursingHistory = Taro.getStorageSync("FR200NursingHistory"); @@ -1951,8 +2077,6 @@ class IotCarePlanFR200 extends Component { JSON.stringify(obj) ); } else if ("moistureTest" === nursingData.workMode) { - // go(`/recoding/pages/moisture_test_report/moisture_test_report?data=${item.nursingData}&date=${item.createTime}`); - // go("/pages/face_report/face_report?id=" + this.state.currentDevice.id); console.log("水分测试"); } else { go("/pages/face_report/face_report?id=" + this.state.currentDevice.id); @@ -2050,6 +2174,8 @@ class IotCarePlanFR200 extends Component { title, isConnectShow, GearData, + stepList, + stepIndex, isShowStepTips, isShowNurse, isStopNurse, @@ -2259,7 +2385,7 @@ class IotCarePlanFR200 extends Component { showFullscreenBtn={false} /> )} - + {isShowNurse && ( {isStopNurse ? ( @@ -2341,6 +2467,8 @@ class IotCarePlanFR200 extends Component { )} @@ -2352,6 +2480,7 @@ class IotCarePlanFR200 extends Component { onEmitStartNurse={this.onStartNurse} onEmitSwitchChange={this.onSwitchChange} onEmitEndPlan={this.onEndPlan} + onsuccess={this.onsuccess} /> diff --git a/src/moduleIOT/pages/iotCarePlan/WL200.tsx b/src/moduleIOT/pages/iotCarePlan/WL200.tsx index 485a3db..7a641bb 100644 --- a/src/moduleIOT/pages/iotCarePlan/WL200.tsx +++ b/src/moduleIOT/pages/iotCarePlan/WL200.tsx @@ -2048,6 +2048,8 @@ class IotCarePlanWL200 extends Component { this.setState({ isMuted }); }; GetVideosTime = (event) => { + let videoRef = Taro.createVideoContext("myVideo", this); + // videoRef.currentTime console.log("获取播放时间", event.detail.currentTime); }; onPlay = (e) => { diff --git a/src/moduleIOT/pages/iotCarePlan/components/Footer/FR200.tsx b/src/moduleIOT/pages/iotCarePlan/components/Footer/FR200.tsx index f739cd7..9607bc1 100644 --- a/src/moduleIOT/pages/iotCarePlan/components/Footer/FR200.tsx +++ b/src/moduleIOT/pages/iotCarePlan/components/Footer/FR200.tsx @@ -5,10 +5,11 @@ interface Props { // isShowNurse: boolean; currentWorkModeType: number; // 当前工作模式 1:基础脸部等,只有结束按钮 2.促渗,可以开始暂停和结束 3.水分测试 isStopNurse: boolean; - isRuningTest: boolean; // 是否在运行测试 + isRuningTest: any; // 是否在运行测试 1是启动,2进行中,3重新检测,4检测完成 onEmitStartNurse: Function; // 每次点击item,回调事件和数据给父组件 onEmitSwitchChange: Function; onEmitEndPlan: Function; + onsuccess:Function } function Index({ currentWorkModeType, @@ -17,6 +18,7 @@ function Index({ onEmitStartNurse, onEmitSwitchChange, onEmitEndPlan, + onsuccess }: Props) { const onStartNurse = () => { onEmitStartNurse(); @@ -35,14 +37,18 @@ function Index({ {currentWorkModeType === 3 && ( - {!isRuningTest ? ( - - 启动检测 - - ) : ( - 检测中... - )} - + {isRuningTest === 1 ? ( + + 启动检测 + + ) : isRuningTest === 2 ? ( + 检测中... + ) : isRuningTest === 3 ? ( + 重新检测 + ) : ( + 检测完成 + )} + )} {currentWorkModeType === 2 && ( diff --git a/src/moduleIOT/pages/iotCarePlan/components/ModeList/FR200.tsx b/src/moduleIOT/pages/iotCarePlan/components/ModeList/FR200.tsx index 6a39ebb..16fc624 100644 --- a/src/moduleIOT/pages/iotCarePlan/components/ModeList/FR200.tsx +++ b/src/moduleIOT/pages/iotCarePlan/components/ModeList/FR200.tsx @@ -26,14 +26,12 @@ function Index({ onEmitShowAll, onModeLockOpen, }: Props) { - - let BaseList = ModeList.filter((item) => item.modeClass === 1); // 基础护理 let ZoneList = ModeList.filter((item) => item.modeClass === 2); // 专区护理 let PermeationList = ModeList.filter((item) => item.modeClass === 3); // 专研促渗 let SensitiveList = ModeList.filter((item) => item.modeClass === 4); // 敏感期护理 let IntelligenceList = ModeList.filter((item) => item.modeClass === 5); // 智能测肤 - console.log(activeModeID,'查看id',BaseList,ModeList); + console.log(activeModeID, "查看id", BaseList, ModeList); const onItemClick = (item) => { if (item.lock) { onModeLockOpen(); // 点击了锁定模式 @@ -71,7 +69,7 @@ function Index({ return ( @@ -69,7 +81,7 @@ function Index(isRuningTest, TestModeStepIndex) { {stepIndex > index && ( )} @@ -89,12 +101,12 @@ function Index(isRuningTest, TestModeStepIndex) { style={{ width: "300rpx", }} - percentage="80" + percentage={stepList[stepIndex].schedule} strokeWidth="14" showPivot={false} - color="#C2E5F3" + color={stepList[stepIndex].color} > - {stepList[stepIndex].finish && 80 >= 99 ? ( + {stepList[stepIndex].finish ? (