From 79dba2b6a15ba317cf49c9ad8d343becff3d20dc Mon Sep 17 00:00:00 2001 From: blak-kong <546598185@qq.com> Date: Fri, 15 Mar 2024 18:01:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=B4=E6=97=B6=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/bluetoot/connection/fr200.js | 2 +- src/moduleIOT/pages/iotCarePlan/FR200.tsx | 340 +++++------------- src/moduleIOT/pages/iotCarePlan/WL200.tsx | 36 +- .../components/ElectricityView/index.tsx | 10 +- .../iotCarePlan/components/Footer/index.less | 2 +- .../components/ModeContent/FR200.tsx | 15 +- .../iotCarePlan/components/ModeList/FR200.tsx | 6 + .../iotCarePlan/components/ModeList/WL200.tsx | 22 +- src/pages/instrumentClickinUpload/index.tsx | 57 +-- 9 files changed, 178 insertions(+), 312 deletions(-) diff --git a/src/components/bluetoot/connection/fr200.js b/src/components/bluetoot/connection/fr200.js index 80a01fd..45c83c8 100644 --- a/src/components/bluetoot/connection/fr200.js +++ b/src/components/bluetoot/connection/fr200.js @@ -71,7 +71,7 @@ export const fr200DeviceControlCommand = { work: { commandType: "DeviceControl", workStatus: "working", - workMode: "face", + workMode: "", // face }, // 切换/进入水分测试 switchTestMode: { diff --git a/src/moduleIOT/pages/iotCarePlan/FR200.tsx b/src/moduleIOT/pages/iotCarePlan/FR200.tsx index 25eed0d..e98cdd7 100644 --- a/src/moduleIOT/pages/iotCarePlan/FR200.tsx +++ b/src/moduleIOT/pages/iotCarePlan/FR200.tsx @@ -66,6 +66,7 @@ import commandMap from "@/utils/commandMap"; import { Popup } from "@antmjs/vantui"; const deviceToolKitInstanceFR200 = new DeviceToolKitWM("FR200"); +let deviceToolKitInstance = deviceToolKitInstanceFR200; let currentTimeTimer: any = null; // 当前项目时间定时器 let CountdownTimer: any = null; @@ -102,7 +103,6 @@ let DeviceSyncData = { totalWorkingMinutes: 0, totalWorkingSeconds: 0, }; -let deviceToolKitInstance = deviceToolKitInstanceFR200; class IotCarePlanFR200 extends Component { constructor(props) { @@ -121,7 +121,7 @@ class IotCarePlanFR200 extends Component { basicModeList: [], //模式列表 modelActiveIndex: 0, //模式下标 sliderProgress: 22, - facialMaskConnectStatus: 1, // 面罩连接状态 0未连接 1已连接 + DeviceConnectStatus: 1, // 面罩连接状态 0未连接 1已连接 Electricity: 4, // WL200电量 matrixElectricity: 4, // WE200发箍电量 @@ -129,7 +129,6 @@ class IotCarePlanFR200 extends Component { gear: { gear: 1 }, currentShowDialog: "", - step: 1, // 1:选择模式并播放视频, 2:护理中 showVideoPlayBtn: true, // 视频播放按钮 duration: 0, // 视频总时长 hadShowBreakTips: false, // 是否展示过支架断开提示 @@ -148,11 +147,14 @@ class IotCarePlanFR200 extends Component { /** 护理过程 END*/ // 模式列表 + isModeLock: false, // 模式是否锁定 isSwitchActiveMode: false, // 是否显示弹窗切换模式 ModeList: [], ModeType: "all", // all modeClass: "", // 1基础护理 2专区护理 3专研促渗 4敏期护理 5智能测肤 - ActiveModeItem: {}, // 当前选中模式 + ActiveModeItem: { + openSourceData: [], + }, // 当前选中模式 SwitchActiveModeItem: {}, // 切换选中模式 ModeID: "mode_", // 模式KEY activeModeID: "", // 当前选中模式ID:用于高亮 @@ -164,8 +166,6 @@ class IotCarePlanFR200 extends Component { stopSource: "", }, - // 模式组合 - isCombineSuccess: false, // 组合模式是否设置成功 // 倒计时 isShowCountdown: false, // 倒计时弹窗 countdown: 3, @@ -209,6 +209,17 @@ class IotCarePlanFR200 extends Component { hadGotInstrumentHistoryData = false; // 是否已缓存仪器历史数据 hadLoadedPage = false; // 判断是否首次进入页面 + // FR200同步状态 + FR200Status: any = { + gear: 1, // 1-5 挡位 + isCharging: false, // 是否充电 + joulePerSecond: 0, // 每秒焦耳 0-10 + nasolabialOrMandibularOutput: false, // 鼻唇或下颌输出 + partition: 0, // 分割? + pointOutChangeSide: false, // 交叉输出点 + impedance: 107, // 阻抗? + }; + /** FR200模式类型:名称 */ ModeTypeArray: string[] = [ "all", @@ -450,10 +461,6 @@ class IotCarePlanFR200 extends Component { if (data.serviceData.length > 0) { this.setServiceTimeData(); } - // 存在组合模式时,设置组合模式 - if (data.combineData.length > 0) { - this.setCustomMaskData(); - } }); // 如果是正在运行中切换,则直接准备运行 @@ -480,7 +487,7 @@ class IotCarePlanFR200 extends Component { return false; } - if (this.state.step == 2 && this.state.facialMaskConnectStatus == 1) { + if (this.isRuning === true && this.state.DeviceConnectStatus == 1) { // 提示切换护理模式 if (this.isCheckNurseTime()) { // 满足时间条件,提示是否保存部分护理记录 @@ -533,11 +540,11 @@ class IotCarePlanFR200 extends Component { stepNext = () => { let modeClass = this.state.ActiveModeItem.modeClass; this.workStatus = "pause"; + this.isRuning = true; // 暂停也是运行中 this.setState({ ModeType: this.ModeTypeArray[modeClass], isShowNurse: true, isStopNurse: true, - step: 2, }); setTimeout(() => { @@ -565,7 +572,7 @@ class IotCarePlanFR200 extends Component { /** * @name 不可切换光照提示 - * @description isCabinMode是否舱体模式。 0.检测面罩与舱体是否仍在连接中,需要分离 1.检测是否连接失败,需要重新连接 + * @description 检测紧贴肌肤 */ onEmitErrorTips = async () => { setTimeout(() => { @@ -574,13 +581,7 @@ class IotCarePlanFR200 extends Component { // 按钮不可点击时,提示报错 let isDisabled = this.footerIsDisabled(); if (isDisabled) { - if (ActiveModeItem.isCabinMode === 0) { - this.showTips("检测到面罩与舱体仍在连接中,该模式需要分离面罩和舱体"); - } else { - this.showTips( - "检测到面罩与舱体未连接成功,请确认面罩是否和舱体连接并接通舱体电源" - ); - } + this.showTips("检测到您的设备没有紧贴肌肤,请紧贴肌肤后重新尝试"); } }); }; @@ -626,119 +627,19 @@ class IotCarePlanFR200 extends Component { this.setState({ isShowStepTips: false }); }; - /** 蓝牙相关 */ + /** 蓝牙连接相关 */ switchBLEMatch = (jsonStatus: any) => { - console.log("蓝牙相关", jsonStatus); - let { ActiveModeItem } = this.state; - + console.log("蓝牙连接相关", jsonStatus); switch (jsonStatus.bleCommandType) { // 如果设备配对链接发送配对码的时候,设备应答小程序配对码是否正确。 case "SendMatchCode": if (jsonStatus.matchedSuccess) { console.log("设备配对成功"); this.setState({ - facialMaskConnectStatus: 1, + DeviceConnectStatus: 1, }); } break; - - // 设备状态主动上报,这种指令是主机主动上报某个附属设备断开或者连上了 - case "BleStatusSync": - console.log("BleStatusSync 附属设备状态主动上报", jsonStatus); - switch (jsonStatus.connectMessage?.deviceName) { - case "WL200": - if (jsonStatus.connectMessage?.connectType == "CONNECTED") { - } else { - this.setState({ - facialMaskConnectStatus: 0, // 蓝牙断开 - isFooterBtnDisabled: false, // 蓝牙断开所以不可点击 - }); - // 断开连接直接暂停:会自动暂停定时器 - this.judgementWorkStatus( - MODE_WORKING_ENUM.PAUSE, - ActiveModeItem?.modeType - ); - // 设备断开时,给定一个断开时间 - ActiveModeItem.breakTimeStr = this.state.currentTime; - } - break; - // 附属设备是否连接支架 - case "Stand": - if (jsonStatus.connectMessage?.connectType == "CONNECTED") { - console.log("舱体支架连接"); - this.setState({ - isStandStatus: true, - }); - if (!this.state.isStandStatus && this.isRuning) { - // 断开连接直接暂停 - this.judgementWorkStatus( - MODE_WORKING_ENUM.PAUSE, - ActiveModeItem?.modeType - ); - } - } else { - console.log("舱体支架断开连接"); - - if (this.state.isStandStatus && this.isRuning) { - // 断开连接直接暂停 - this.judgementWorkStatus( - MODE_WORKING_ENUM.PAUSE, - ActiveModeItem?.modeType - ); - } - - // 设备断开时,给定一个断开时间 - ActiveModeItem.breakTimeStr = this.state.currentTime; - - this.setState({ - isStandStatus: false, - isStopNurse: true, - ActiveModeItem, - }); - - setTimeout(() => { - this.onEmitErrorTips(); - }, 500); - } - setTimeout(() => { - this.footerIsDisabled(); - }, 100); - break; - default: - console.log("监听到到设备连接状态改变 this.footerIsDisabled()"); - this.footerIsDisabled(); // 判断底部运行按钮是否可点击 - break; - } - break; - - //小程序主动问主机,现在链接了哪些附属设备,这时候主机给小程序的回复消息 - case "QueryMatchStatus": - console.log("QueryMatchStatus 设备回复小程序", jsonStatus); - - const isStandDevice = jsonStatus?.subDeviceList?.includes("Stand"); - deviceToolKitInstance = deviceToolKitInstanceFR200; - console.log("支架是否链接", isStandDevice); - this.setState({ - isStandStatus: isStandDevice, - }); - setTimeout(() => { - this.footerIsDisabled(); - }); - - // 连上面罩后, 获取仪器记录, 与缓存信息对比 - if (!this.hadGotInstrumentHistoryData) { - // 查询护理记录 - this.getInstrumentHistoryData(); - - // 查询仪器状态 - const queryDeviceArrayBuffer = deviceToolKitInstance.toBleCommand( - bleCommandSamples.queryDeviceStatus as any - ); - console.log("发送查询设备指令 获取仪器状态"); - sendCommand({ - value: queryDeviceArrayBuffer, - }); - } } }; @@ -776,16 +677,18 @@ class IotCarePlanFR200 extends Component { break; //设备状态同步 case "DeviceStatusSync": - console.log("设备状态同步", jsonStatus); switch (jsonStatus.workStatus) { case "standby": //设备的待机状态 可能workMode字段为空 + console.log("设备状态同步 待机状态", jsonStatus); break; case "pause": //设备的暂停状态 + console.log("设备状态同步 暂停状态", jsonStatus); break; case "working": //设备的运行中状态 + console.log("设备状态同步 运行中状态", jsonStatus); break; default: break; @@ -954,8 +857,8 @@ class IotCarePlanFR200 extends Component { if ( sceneTime > totalTime && - this.state.step == 2 && - this.state.facialMaskConnectStatus == 1 + this.isRuning === true && + this.state.DeviceConnectStatus == 1 ) { // 界面倒计时同步设备时间 const t = sceneTime - totalTime; // 场景时间 - 已运行时间 = 剩余时间 @@ -999,7 +902,7 @@ class IotCarePlanFR200 extends Component { * params 工作状态 工作模式 响应状态 */ judgementWorkStatus(nWorkStatus, nWorkMode) { - const { step, workMode, ActiveModeItem, ModeList } = this.state; + const { workMode, ActiveModeItem, ModeList } = this.state; const opts: any = {}; // ActiveModeItem let nowModeItem; @@ -1026,11 +929,11 @@ class IotCarePlanFR200 extends Component { this.setState({ isShowCountdown: false, }); - if (nowModeItem?.isCabinMode && step == 2) { + if (nowModeItem?.isCabinMode && this.isRuning === true) { opts.currentTime = nowCurrentTime; - } else if (!nowModeItem?.isCabinMode && step == 2) { + } else if (!nowModeItem?.isCabinMode && this.isRuning === true) { // fix: 启动非支架模式倒计时时,连上支架,仪器的状态变为standby - opts.step = 1; + this.isRuning === false; } }, setting: () => { @@ -1038,14 +941,14 @@ class IotCarePlanFR200 extends Component { this.setState({ hadShowBreakTips: false, }); - if (step != 2 && !ActiveModeItem.isCabinMode) { - opts.step = 2; + if (this.isRuning === false && !ActiveModeItem.isCabinMode) { + this.isRuning = true; this.setState({ title: "正在护理", isStopNurse: false, }); - } else if (step != 2 && ActiveModeItem.isCabinMode) { - opts.step = 2; + } else if (this.isRuning === false && ActiveModeItem.isCabinMode) { + this.isRuning = true; // this.setState({ // title: "正在护理", // }); @@ -1066,11 +969,11 @@ class IotCarePlanFR200 extends Component { } }, working: () => { - if (this.state.facialMaskConnectStatus != 1) { + if (this.state.DeviceConnectStatus != 1) { opts.workStatus = MODE_WORKING_ENUM.STANDBY; - opts.step = 1; - } else if (step != 2) { - opts.step = 2; + this.isRuning = false; + } else if (this.isRuning === false) { + this.isRuning = false; this.setState({ title: "正在护理", isStopNurse: false, @@ -1140,8 +1043,7 @@ class IotCarePlanFR200 extends Component { currentTimeTimer && clearInterval(currentTimeTimer); currentTimeTimer = setInterval(() => { let { - step, - facialMaskConnectStatus, + DeviceConnectStatus, currentTime, ModeStepTimeArray, ModeStepIndex, @@ -1149,8 +1051,8 @@ class IotCarePlanFR200 extends Component { } = this.state; if ( this.workStatus == MODE_WORKING_ENUM.WORKING && - step == 2 && - facialMaskConnectStatus == 1 + this.isRuning && + DeviceConnectStatus == 1 ) { let totalSeconds = ActiveModeItem?.breakTimeStr ? minSecToS(ActiveModeItem.breakTimeStr) @@ -1220,23 +1122,15 @@ class IotCarePlanFR200 extends Component { // 检测并控制工作状态 handleWorkStatus = (isBtnClick: boolean, workStatus) => { - const { facialMaskConnectStatus, isStandStatus, ActiveModeItem } = - this.state; + const { DeviceConnectStatus, ActiveModeItem } = this.state; let newWorkStatus = workStatus || (this.workStatus == MODE_WORKING_ENUM.WORKING ? "pause" : "working"); if (isBtnClick && newWorkStatus == "working") { - // 舱体模式 - if (ActiveModeItem.isCabinMode === 1 && !isStandStatus) { - this.showTips( - `检测到舱体未连接成功,请确认面罩开机后与舱体连接,并接通舱体电源` - ); - return; - } - // 非舱体模式 - if (!ActiveModeItem.isCabinMode && facialMaskConnectStatus != 1) { - console.log("facialMaskConnectStatus", facialMaskConnectStatus); - this.showTips("检测到面罩未连接成功,请确认面罩开机并佩戴"); + // todo FR200 不判断舱体,判断肌肤 + if (!ActiveModeItem.isCabinMode && DeviceConnectStatus != 1) { + console.log("DeviceConnectStatus", DeviceConnectStatus); + this.showTips("检测到您的设备没有紧贴肌肤,请紧贴肌肤后点击重新检测"); return; } } @@ -1280,48 +1174,11 @@ class IotCarePlanFR200 extends Component { }); }, 500); - const { ActiveModeItem, isStandStatus, facialMaskConnectStatus } = - this.state; + const { ActiveModeItem, DeviceConnectStatus } = this.state; - if (isStandStatus === true && ActiveModeItem.isCabinMode === 0) { - console.log("已连接舱体,只可选择舱体模式"); - return; - } - if (isStandStatus === false && ActiveModeItem.isCabinMode === 1) { - console.log("未连接舱体!"); - return; - } - - console.info( - commandMap.WL200Command, - "点击开始护理按钮", - `当前模式: ${ActiveModeItem.modeType}`, - `当前面罩状态:${facialMaskConnectStatus}`, - `当前仪器模式:${this.workStatus}` - ); - console.log(ActiveModeItem); - console.log("isStandStatus:" + isStandStatus); - - if (facialMaskConnectStatus != 1) { - console.log("facialMaskConnectStatus 开始处", facialMaskConnectStatus); - this.showTips("检测到面罩未连接成功,请确认面罩开机并佩戴"); - return; - } - // 如果是强效舒缓,需要判断是否连接支架 - if (ActiveModeItem.isCabinMode && !isStandStatus) { - this.showTips( - `检测到舱体未连接成功,请确认面罩开机后与舱体连接,并接通舱体电源` - ); - return; - } else if (!ActiveModeItem.isCabinMode && isStandStatus) { - this.showTips(`检测到面罩仍和舱体连接中,请分离后切换`); - return; - } - if ( - ActiveModeItem.modeType === "MaskCustom" && - !this.state.isCombineSuccess - ) { - this.showTips(`${ActiveModeItem.modeName}模式设置失败,请联系小助手`); + if (DeviceConnectStatus != 1) { + console.log("DeviceConnectStatus 开始处", DeviceConnectStatus); + this.showTips("检测到FR200未连接成功,请确认FR200开机并佩戴"); return; } @@ -1424,6 +1281,7 @@ class IotCarePlanFR200 extends Component { isFooterBtnDisabled: false, }); if (this.workJsonStatus.workMode) { + // FR200可能要判断是否水分测试 Test console.log("this.workJsonStatus.workMode", this.workJsonStatus.workMode); if (this.workJsonStatus.workMode.indexOf("Stand") > -1) { console.log( @@ -1471,7 +1329,6 @@ class IotCarePlanFR200 extends Component { console.log("workStatus", workStatus); console.log("jsonStatus", jsonStatus, this.workJsonStatus); console.log("currentTime", WL200NursingHistory.currentTime); - console.log("isStandStatus", this.state.isStandStatus); let historyElapsedTime = minSecToS(recordModeItem.modeTimeStr) - @@ -1539,9 +1396,7 @@ class IotCarePlanFR200 extends Component { // 同步时间 if (jsonStatus.id == WL200NursingHistory.id) { if (WL200NursingHistory.currentTime) { - this.setState({ - step: 2, - }); + this.isRuning = true; this.resetTimer(); } } @@ -1572,10 +1427,6 @@ class IotCarePlanFR200 extends Component { if (ActiveModeItem.serviceData.length > 0) { this.setServiceTimeData(); } - // 存在组合模式时,设置组合模式 - if (ActiveModeItem.combineData.length > 0) { - this.setCustomMaskData(); - } }); } } @@ -1771,43 +1622,6 @@ class IotCarePlanFR200 extends Component { }); return modesArray; }; - setCustomMaskData() { - console.log("================"); - console.log("setCustomMaskData"); - console.log("================"); - - // modesArray 发送组合模式数组指令到设备存储 - let modesArray = this.getCustomModesArray(); - console.log("组合模式modesArray", modesArray); - - let customModeSetCommand = { - commandType: "InfoQuery", - infoQueryType: "customModeSet", - modesArray, - }; - let commandBuffer = deviceToolKitInstance.toBleCommand( - customModeSetCommand as any - ); - sendCommand({ - value: commandBuffer, - }).then((res) => { - console.info("发送切换组合模式指令成功", res); - }); - } - // 发送启动组合模式指令 - startCombinationMode() { - const jsonCommand = { - commandType: "DeviceControl", - workStatus: "working", - workMode: "MaskCustom", - }; - let commandBuffer = deviceToolKitInstance.toBleCommand(jsonCommand as any); - sendCommand({ - value: commandBuffer, - }).then(() => { - console.info("发送启动组合模式指令成功 参数为 =>", jsonCommand); - }); - } // 护理的错误提示 showTips(ctx) { @@ -1960,20 +1774,11 @@ class IotCarePlanFR200 extends Component { * @returns 返回true则禁用 */ footerIsDisabled = () => { - let { isStandStatus } = this.state; - let isCanClick = isStandStatus - ? this.tempModeCurrent?.isCabinMode === 1 - : this.tempModeCurrent?.isCabinMode === 0; - // 如果舱体状态和模式类型不相等,则禁用 let isFooterBtnDisabled = false; - if (!isCanClick) { - isFooterBtnDisabled = true; - } - console.log("isCanClick", isCanClick); - console.log("isFooterBtnDisabled", isFooterBtnDisabled); - // 仅在值变化时更新state - // if (isFooterBtnDisabled !== this.state.isFooterBtnDisabled) { + // if () { + // isFooterBtnDisabled = true; + // } this.setState({ isFooterBtnDisabled: isFooterBtnDisabled, }); @@ -1986,6 +1791,13 @@ class IotCarePlanFR200 extends Component { Taro.reLaunch({ url: "/pages/index/index" }); }; + onModeLockOpen = async () => { + this.setState({ isModeLock: true }); + }; + onModeLockClose = async () => { + this.setState({ isModeLock: false }); + }; + render() { let { title, @@ -1998,7 +1810,6 @@ class IotCarePlanFR200 extends Component { ModeStepIndex, currentServiceData, ActiveModeItem, - SwitchActiveModeItem, isSwitchActiveMode, ModeID, activeModeID, @@ -2009,7 +1820,7 @@ class IotCarePlanFR200 extends Component { errorTips, isEndCarePlan, currentTime, - facialMaskConnectStatus, + DeviceConnectStatus, isShowErrorTipsText, errorTipsText, isNotEnoughTime, @@ -2022,7 +1833,7 @@ class IotCarePlanFR200 extends Component { isShowReReadRecordSave, isFooterBtnDisabled, isShowHistoryMsg, - stepIndex, + isModeLock, } = this.state; return ( @@ -2035,6 +1846,17 @@ class IotCarePlanFR200 extends Component { /> + { ModeType={ModeType} onEmit={this.switchModeCurrentFun} onEmitShowAll={this.openModeSwitch} + onModeLockOpen={this.onModeLockOpen} /> } textAlgin="center" @@ -2083,7 +1906,7 @@ class IotCarePlanFR200 extends Component { confirm={this.confirmModeSwitchBtn} /> - {ActiveModeItem.openSourceData && ( + {ActiveModeItem.openSourceData.length > 0 && ( { @@ -2237,6 +2060,7 @@ class IotCarePlanFR200 extends Component { activeModeID={activeModeID} onEmit={this.modeCurrentFun} onEmitShowAll={this.openModeSwitch} + onModeLockOpen={this.onModeLockOpen} /> )} diff --git a/src/moduleIOT/pages/iotCarePlan/WL200.tsx b/src/moduleIOT/pages/iotCarePlan/WL200.tsx index 0dd73b3..8847c22 100644 --- a/src/moduleIOT/pages/iotCarePlan/WL200.tsx +++ b/src/moduleIOT/pages/iotCarePlan/WL200.tsx @@ -166,11 +166,14 @@ class IotCarePlanWL200 extends Component { /** 护理过程 END*/ // 模式列表 + isModeLock: false, // 模式锁定 isSwitchActiveMode: false, // 是否显示弹窗切换模式 ModeList: [], ModeType: "all", // all visor面罩 cabin舱体 yimeish医美 modeClass: "", // 1面罩 2舱体 3医美 - ActiveModeItem: {}, // 当前选中模式 + ActiveModeItem: { + openSourceData: [], + }, // 当前选中模式 SwitchActiveModeItem: {}, // 切换选中模式 ModeID: "mode_", // 模式KEY activeModeID: "", // 当前选中模式ID:用于高亮 @@ -682,7 +685,7 @@ class IotCarePlanWL200 extends Component { this.setState({ isStandStatus: true, }); - if (!this.state.isStandStatus && this.isRuning) { + if (!this.state.isStandStatus && this.state.step === 2) { // 断开连接直接暂停 this.judgementWorkStatus( MODE_WORKING_ENUM.PAUSE, @@ -692,7 +695,7 @@ class IotCarePlanWL200 extends Component { } else { console.log("舱体支架断开连接"); - if (this.state.isStandStatus && this.isRuning) { + if (this.state.isStandStatus && this.state.step === 2) { // 断开连接直接暂停 this.judgementWorkStatus( MODE_WORKING_ENUM.PAUSE, @@ -2023,6 +2026,13 @@ class IotCarePlanWL200 extends Component { Taro.reLaunch({ url: "/pages/index/index" }); }; + onModeLockOpen = async () => { + this.setState({ isModeLock: true }); + }; + onModeLockClose = async () => { + this.setState({ isModeLock: false }); + }; + render() { let { title, @@ -2059,7 +2069,7 @@ class IotCarePlanWL200 extends Component { isShowReReadRecordSave, isFooterBtnDisabled, isShowHistoryMsg, - stepIndex, + isModeLock, } = this.state; return ( @@ -2072,6 +2082,18 @@ class IotCarePlanWL200 extends Component { /> + { ModeType={ModeType} onEmit={this.switchModeCurrentFun} onEmitShowAll={this.openModeSwitch} + onModeLockOpen={this.onModeLockOpen} /> } textAlgin="center" @@ -2120,7 +2143,7 @@ class IotCarePlanWL200 extends Component { confirm={this.confirmModeSwitchBtn} /> - {ActiveModeItem.openSourceData && ( + {ActiveModeItem.openSourceData.length > 0 && ( { @@ -2274,6 +2297,7 @@ class IotCarePlanWL200 extends Component { activeModeID={activeModeID} onEmit={this.modeCurrentFun} onEmitShowAll={this.openModeSwitch} + onModeLockOpen={this.onModeLockOpen} /> )} diff --git a/src/moduleIOT/pages/iotCarePlan/components/ElectricityView/index.tsx b/src/moduleIOT/pages/iotCarePlan/components/ElectricityView/index.tsx index 4141899..d71be5f 100644 --- a/src/moduleIOT/pages/iotCarePlan/components/ElectricityView/index.tsx +++ b/src/moduleIOT/pages/iotCarePlan/components/ElectricityView/index.tsx @@ -7,13 +7,9 @@ import { useState, useEffect } from "react"; interface Props { Electricity: any; matrixElectricity: any; - facialMaskConnectStatus: any; + DeviceConnectStatus: any; } -function Index({ - Electricity, - matrixElectricity, - facialMaskConnectStatus, -}: Props) { +function Index({ Electricity, matrixElectricity, DeviceConnectStatus }: Props) { return ( @@ -62,7 +58,7 @@ function Index({ )} */} - {facialMaskConnectStatus === 1 && ( + {DeviceConnectStatus === 1 && ( 面罩电量 : diff --git a/src/moduleIOT/pages/iotCarePlan/components/Footer/index.less b/src/moduleIOT/pages/iotCarePlan/components/Footer/index.less index f62877e..c36adf7 100644 --- a/src/moduleIOT/pages/iotCarePlan/components/Footer/index.less +++ b/src/moduleIOT/pages/iotCarePlan/components/Footer/index.less @@ -8,7 +8,7 @@ height: 153rpx; background: #ffffff; box-shadow: 0rpx -3rpx 7rpx 1rpx rgba(173, 191, 207, 0.21); - padding-bottom: env(safe-area-inset-bottom); + // padding-bottom: env(safe-area-inset-bottom); box-sizing: border-box; .btn { width: 690rpx; diff --git a/src/moduleIOT/pages/iotCarePlan/components/ModeContent/FR200.tsx b/src/moduleIOT/pages/iotCarePlan/components/ModeContent/FR200.tsx index 73ae9a8..3080a07 100644 --- a/src/moduleIOT/pages/iotCarePlan/components/ModeContent/FR200.tsx +++ b/src/moduleIOT/pages/iotCarePlan/components/ModeContent/FR200.tsx @@ -15,8 +15,21 @@ function Index({ isShowNurse, ActiveModeItem, ModeStepIndex }: Props) { "630nm": "#CF231D", "830nm": "#9C1D17", }; + + let [value, setValue] = useState(""); + + const add = () => { + useEffect(() => { + setValue(value + 1); + }); + }; + return ( - {isShowNurse && } + + add + {value} + {isShowNurse && } + ); } diff --git a/src/moduleIOT/pages/iotCarePlan/components/ModeList/FR200.tsx b/src/moduleIOT/pages/iotCarePlan/components/ModeList/FR200.tsx index 98d11f5..375a443 100644 --- a/src/moduleIOT/pages/iotCarePlan/components/ModeList/FR200.tsx +++ b/src/moduleIOT/pages/iotCarePlan/components/ModeList/FR200.tsx @@ -13,6 +13,7 @@ interface Props { isPop: boolean; // 是否弹窗 onEmit: Function; // 每次点击item,回调事件和数据给父组件 onEmitShowAll: Function; // 打开弹窗按钮 + onModeLockOpen: Function; // 打开锁定弹窗 } function Index({ isShowNurse, @@ -23,6 +24,7 @@ function Index({ activeModeID, onEmit, onEmitShowAll, + onModeLockOpen, }: Props) { let BaseList = ModeList.filter((item) => item.modeClass === 1); // 基础护理 let ZoneList = ModeList.filter((item) => item.modeClass === 2); // 专区护理 @@ -31,6 +33,10 @@ function Index({ let IntelligenceList = ModeList.filter((item) => item.modeClass === 5); // 智能测肤 const onItemClick = (item) => { + if (item.lock) { + onModeLockOpen(); // 点击了锁定模式 + return; + } onEmit(item); }; diff --git a/src/moduleIOT/pages/iotCarePlan/components/ModeList/WL200.tsx b/src/moduleIOT/pages/iotCarePlan/components/ModeList/WL200.tsx index 723279a..9b3e930 100644 --- a/src/moduleIOT/pages/iotCarePlan/components/ModeList/WL200.tsx +++ b/src/moduleIOT/pages/iotCarePlan/components/ModeList/WL200.tsx @@ -13,6 +13,7 @@ interface Props { isPop: boolean; // 是否弹窗 onEmit: Function; // 每次点击item,回调事件和数据给父组件 onEmitShowAll: Function; // 打开弹窗按钮 + onModeLockOpen: Function; // 打开锁定弹窗 } function Index({ isShowNurse, @@ -23,20 +24,17 @@ function Index({ activeModeID, onEmit, onEmitShowAll, + onModeLockOpen, }: Props) { let VisorList = ModeList.filter((item) => item.modeClass === 1); // 面罩模式 let CabinList = ModeList.filter((item) => item.modeClass === 2); // 舱体模式 let YimeishList = ModeList.filter((item) => item.modeClass === 3); // 医美术后 - const yimeishClick = (item) => { - onEmit(item); - }; - - const cabinClick = (item) => { - onEmit(item); - }; - - const visorClick = (item) => { + const onItemClick = (item) => { + if (item.isLock) { + onModeLockOpen(); + return; + } onEmit(item); }; @@ -73,7 +71,7 @@ function Index({ className={classnames("mode-item", { "mode-item-active": activeModeID === item.id, })} - onClick={visorClick.bind(this, item)} + onClick={onItemClick.bind(this, item)} > { secondClockImg: null, thirdClockImg: null, }, - + // 现在选中的数据 currentInfo: { modeVideo: "", @@ -122,7 +122,6 @@ export default class InstrumentClickInUpload extends Component { }; // 获取最新一条打卡记录 getLatestClockRecord = async () => { - let { punchInInfo } = this.state; let res = await InstrumentInfo.apiClock.getLatestClockRecord(); if (res.data.code === 200) { @@ -190,7 +189,7 @@ export default class InstrumentClickInUpload extends Component { // 提交打卡 handleSubmit = async () => { - let { punchInInfo,instrumentDetail } = this.state; + let { punchInInfo, instrumentDetail } = this.state; let obj = punchInInfo; if (obj.clockImageList.length === 0) { msg("至少上传一张图片"); @@ -236,9 +235,11 @@ export default class InstrumentClickInUpload extends Component { instrumentId: instrumentDetail.id, }; // 上传护理完成的仪器ID - let instrumentRes = await InstrumentInfo.apiClock.addClockInstrument(params); - console.log(instrumentRes,'添加仪器成功'); - + let instrumentRes = await InstrumentInfo.apiClock.addClockInstrument( + params + ); + console.log(instrumentRes, "添加仪器成功"); + let res = await InstrumentInfo.apiClock.postInsertClockLog(clockParmas); if (res.data.code === 200) { msg("打卡成功"); @@ -268,10 +269,11 @@ export default class InstrumentClickInUpload extends Component { videoLoadedMetaData = async () => {}; - handleTextareaInput = (e) => { + handleTextareaInput = (e) => { const punchInInfo = this.state.punchInInfo; - this.setState({ punchInInfo: { ...punchInInfo,clockContent: e.detail.value } }); - + this.setState({ + punchInInfo: { ...punchInInfo, clockContent: e.detail.value }, + }); }; onModeLockOpen = async () => { @@ -324,23 +326,26 @@ export default class InstrumentClickInUpload extends Component { canvasId="compressImage" type="2d" > - - + + + + +