diff --git a/src/components/bluetoot/connection/fr200.js b/src/components/bluetoot/connection/fr200.js index 981801f..4b997e4 100644 --- a/src/components/bluetoot/connection/fr200.js +++ b/src/components/bluetoot/connection/fr200.js @@ -63,13 +63,14 @@ export const fr200DeviceControlCommand = { * face: "01", 面部 * eyes: "02", 眼部 * - * nasolabialFold: "03", 法令纹 - * mandibularLine: "04", 下颌线 + * nasolabialFold: "03", 法令纹Pro + * mandibularLine: "04", 下颌线Pro * led: "05", led + * headLiftingPro: "09", 抬头纹Pro + * * moistureTest: "06", 水分测试 * maskPenetration: "07",面膜促渗 * essence: "08", 精华模式 - * headLiftingPro: "09", 抬头纹Pro * * neck: "0A", 颈纹 * partition: "11", 分区模式 废弃VM1001 diff --git a/src/instrument/pages/instrument/instrument.tsx b/src/instrument/pages/instrument/instrument.tsx index dc05fee..bb9d24f 100644 --- a/src/instrument/pages/instrument/instrument.tsx +++ b/src/instrument/pages/instrument/instrument.tsx @@ -347,7 +347,7 @@ class Instrument extends Component { // this.openBindingVisible(); msg("绑定成功"); setTimeout(() => { - setStorageSync("instrument_detail", JSON.stringify(channelInfo)); + setStorageSync("instrument_detail", channelInfo); this.getInstrumentIntroInfo(channelInfo.id); }, 500); } else if (code === 202) { @@ -384,6 +384,7 @@ class Instrument extends Component { Taro.setStorageSync("isScan", true); Taro.setStorageSync("serial", channelInfo.serialCode); Taro.switchTab({ url: "/pages/index/index" }); + return; // this.openBindingVisible(); } else if (res.data.code === 202) { this.changeBindBox(); @@ -414,7 +415,7 @@ class Instrument extends Component { this.setState({ isVisibleBinding: false }); msg("绑定成功"); setTimeout(() => { - setStorageSync("instrument_detail", JSON.stringify(channelInfo)); + setStorageSync("instrument_detail", channelInfo); this.getInstrumentIntroInfo(channelInfo.id); }, 500); } else if (res.data.code === 202) { @@ -444,7 +445,7 @@ class Instrument extends Component { if (data.code === 200) { msg("换绑成功"); setTimeout(() => { - setStorageSync("instrument_detail", JSON.stringify(channelInfo)); + setStorageSync("instrument_detail", channelInfo); this.getInstrumentIntroInfo(channelInfo.id); }, 500); } @@ -457,7 +458,7 @@ class Instrument extends Component { }); if (res.data.code === 200) { if (res.data.data.length > 0) { - go("/instrument/pages/instrument/intro??customBack=true&id=" + id); + go("/instrument/pages/instrument/intro?customBack=true&id=" + id); } else { Taro.switchTab({ url: "/pages/index/index" }); } diff --git a/src/instrument/pages/instrument/intro.tsx b/src/instrument/pages/instrument/intro.tsx index bc3f58b..7dc239d 100644 --- a/src/instrument/pages/instrument/intro.tsx +++ b/src/instrument/pages/instrument/intro.tsx @@ -67,6 +67,7 @@ class Intro extends Component { } componentDidMount() { let strObj = getStorageSync("instrument_detail"); + console.log("strObj", strObj); if (strObj) { let instrument = strObj; this.getInstrumentInfo(instrument.id); diff --git a/src/moduleIOT/pages/iotCarePlan/FR200.tsx b/src/moduleIOT/pages/iotCarePlan/FR200.tsx index 9ef4754..78d9547 100644 --- a/src/moduleIOT/pages/iotCarePlan/FR200.tsx +++ b/src/moduleIOT/pages/iotCarePlan/FR200.tsx @@ -67,482 +67,7 @@ import { import commandMap from "@/utils/commandMap"; import { Popup } from "@antmjs/vantui"; import { fr200BleCommand } from "@/components/bluetoot/connection/fr200"; -let datajson = { - ActiveModeItem: { - beganVideo: null, - combineData: [], - id: 154, - instrumentModel: "FR200", - instrumentType: 2, - isCabinMode: null, - isNew: 0, - lock: false, - lockCompanyTag: null, - lockCompanyTagArray: [], - lockWechatTag: null, - lockWechatTagArray: [], - modeBanner: "https://flossom.yq-h5.cn/image//statics/2024/03/14/v2-3b7111f4ac41cf4a139fba4f0cc54f21_720w_20240314175626A632.jpg", - modeClass: 1, - modeDesc: "基础班脸部", - modeName: "基础班脸部", - modeTime: "00:02:00", - modeTimeStr: "02:00", - modeType: "face", - modeVideo: "https://flossom.yq-h5.cn/image//statics/2024/03/14/497728332_nb2-1-16_20240314175725A633.mp4", - openSourceData: [], - pauseVideo: null, - preparationVideo: null, - serviceData: null, - status: 0, - }, - currentServiceData: { - createBy: null, - createTime: "2024-03-15 14:15:14", - id: 169, - modeId: 154, - remark: null, - serviceEndTime: "00:02:00", - serviceEndTimeStr: "02:00", - serviceStartTime: "00:00:00", - serviceStartTimeStr: "00:00", - startSource: "https://flossom.yq-h5.cn/image//statics/2024/03/14/v2-5363f74dedf1bb14baf92e09744e49c9_720w_20240314180057A635.gif", - startTimeArray: null, - stopSource: "https://flossom.yq-h5.cn/image//statics/2024/03/14/v2-0584e53b800e6ed28b4a228fedb8cb8d_720w_20240314180040A634.gif", - updateBy: null, - updateTime: null, - currentTime: "00:00", - }, - dataArray: [ - { - battery: 4, - commandType: "DeviceStatusSync", - deviceSyncStatusType: "onlySyncStatusToDevice", - gear: 1, - impedance: 5, - isCharging: false, - joulePerSecond: 1, - matrixBattery: 0, - nasolabialOrMandibularOutput: false, - partition: 0, - pointOutChangeSide: false, - totalWorkingMinutes: 2, - totalWorkingSeconds: 1, - workMode: "face", - workStatus: "standby", - }, - { - battery: 4, - commandType: "DeviceStatusSync", - deviceSyncStatusType: "onlySyncStatusToDevice", - gear: 1, - impedance: 211, - isCharging: false, - joulePerSecond: 1, - matrixBattery: 0, - nasolabialOrMandibularOutput: false, - partition: 0, - pointOutChangeSide: false, - totalWorkingMinutes: 2, - totalWorkingSeconds: 1, - workMode: "face", - workStatus: "standby", - }, { - battery: 4, - commandType: "DeviceStatusSync", - deviceSyncStatusType: "onlySyncStatusToDevice", - gear: 1, - impedance: 21, - isCharging: false, - joulePerSecond: 1, - matrixBattery: 0, - nasolabialOrMandibularOutput: false, - partition: 0, - pointOutChangeSide: false, - totalWorkingMinutes: 2, - totalWorkingSeconds: 1, - workMode: "face", - workStatus: "working", - }, { - battery: 4, - commandType: "DeviceStatusSync", - deviceSyncStatusType: "onlySyncStatusToDevice", - gear: 1, - impedance: 21, - isCharging: false, - joulePerSecond: 1, - matrixBattery: 0, - nasolabialOrMandibularOutput: false, - partition: 0, - pointOutChangeSide: false, - totalWorkingMinutes: 2, - totalWorkingSeconds: 1, - workMode: "face", - workStatus: "standby", - }, { - battery: 4, - commandType: "DeviceStatusSync", - deviceSyncStatusType: "onlySyncStatusToDevice", - gear: 1, - impedance: 251, - isCharging: false, - joulePerSecond: 1, - matrixBattery: 0, - nasolabialOrMandibularOutput: false, - partition: 0, - pointOutChangeSide: false, - totalWorkingMinutes: 2, - totalWorkingSeconds: 1, - workMode: "face", - workStatus: "working", - }, - { - battery: 4, - commandType: "DeviceStatusSync", - deviceSyncStatusType: "onlySyncStatusToDevice", - gear: 1, - impedance: 321, - isCharging: false, - joulePerSecond: 1, - matrixBattery: 0, - nasolabialOrMandibularOutput: false, - partition: 0, - pointOutChangeSide: false, - totalWorkingMinutes: 2, - totalWorkingSeconds: 1, - workMode: "face", - workStatus: "working", - }, - { - battery: 4, - commandType: "DeviceStatusSync", - deviceSyncStatusType: "onlySyncStatusToDevice", - gear: 1, - impedance: 271, - isCharging: false, - joulePerSecond: 1, - matrixBattery: 0, - nasolabialOrMandibularOutput: false, - partition: 0, - pointOutChangeSide: false, - totalWorkingMinutes: 2, - totalWorkingSeconds: 1, - workMode: "face", - workStatus: "working", - }, - { - battery: 4, - commandType: "DeviceStatusSync", - deviceSyncStatusType: "onlySyncStatusToDevice", - gear: 1, - impedance: 219, - isCharging: false, - joulePerSecond: 1, - matrixBattery: 0, - nasolabialOrMandibularOutput: false, - partition: 0, - pointOutChangeSide: false, - totalWorkingMinutes: 2, - totalWorkingSeconds: 1, - workMode: "face", - workStatus: "working", - }, - { - battery: 4, - commandType: "DeviceStatusSync", - deviceSyncStatusType: "onlySyncStatusToDevice", - gear: 1, - impedance: 271, - isCharging: false, - joulePerSecond: 1, - matrixBattery: 0, - nasolabialOrMandibularOutput: false, - partition: 0, - pointOutChangeSide: false, - totalWorkingMinutes: 2, - totalWorkingSeconds: 1, - workMode: "face", - workStatus: "working", - }, - { - battery: 4, - commandType: "DeviceStatusSync", - deviceSyncStatusType: "onlySyncStatusToDevice", - gear: 1, - impedance: 421, - isCharging: false, - joulePerSecond: 1, - matrixBattery: 0, - nasolabialOrMandibularOutput: false, - partition: 0, - pointOutChangeSide: false, - totalWorkingMinutes: 2, - totalWorkingSeconds: 1, - workMode: "face", - workStatus: "working", - }, - { - battery: 4, - commandType: "DeviceStatusSync", - deviceSyncStatusType: "onlySyncStatusToDevice", - gear: 1, - impedance: 251, - isCharging: false, - joulePerSecond: 1, - matrixBattery: 0, - nasolabialOrMandibularOutput: false, - partition: 0, - pointOutChangeSide: false, - totalWorkingMinutes: 2, - totalWorkingSeconds: 1, - workMode: "face", - workStatus: "working", - }, - { - battery: 4, - commandType: "DeviceStatusSync", - deviceSyncStatusType: "onlySyncStatusToDevice", - gear: 1, - impedance: 231, - isCharging: false, - joulePerSecond: 1, - matrixBattery: 0, - nasolabialOrMandibularOutput: false, - partition: 0, - pointOutChangeSide: false, - totalWorkingMinutes: 2, - totalWorkingSeconds: 1, - workMode: "face", - workStatus: "working", - }, - { - battery: 4, - commandType: "DeviceStatusSync", - deviceSyncStatusType: "onlySyncStatusToDevice", - gear: 1, - impedance: 211, - isCharging: false, - joulePerSecond: 1, - matrixBattery: 0, - nasolabialOrMandibularOutput: false, - partition: 0, - pointOutChangeSide: false, - totalWorkingMinutes: 2, - totalWorkingSeconds: 1, - workMode: "face", - workStatus: "working", - }, - { - battery: 4, - commandType: "DeviceStatusSync", - deviceSyncStatusType: "onlySyncStatusToDevice", - gear: 1, - impedance: 261, - isCharging: false, - joulePerSecond: 1, - matrixBattery: 0, - nasolabialOrMandibularOutput: false, - partition: 0, - pointOutChangeSide: false, - totalWorkingMinutes: 2, - totalWorkingSeconds: 1, - workMode: "face", - workStatus: "working", - }, - { - battery: 4, - commandType: "DeviceStatusSync", - deviceSyncStatusType: "onlySyncStatusToDevice", - gear: 1, - impedance: 261, - isCharging: false, - joulePerSecond: 1, - matrixBattery: 0, - nasolabialOrMandibularOutput: false, - partition: 0, - pointOutChangeSide: false, - totalWorkingMinutes: 2, - totalWorkingSeconds: 1, - workMode: "face", - workStatus: "working", - }, - { - battery: 4, - commandType: "DeviceStatusSync", - deviceSyncStatusType: "onlySyncStatusToDevice", - gear: 1, - impedance: 721, - isCharging: false, - joulePerSecond: 1, - matrixBattery: 0, - nasolabialOrMandibularOutput: false, - partition: 0, - pointOutChangeSide: false, - totalWorkingMinutes: 2, - totalWorkingSeconds: 1, - workMode: "face", - workStatus: "working", - }, - { - battery: 4, - commandType: "DeviceStatusSync", - deviceSyncStatusType: "onlySyncStatusToDevice", - gear: 1, - impedance: 121, - isCharging: false, - joulePerSecond: 1, - matrixBattery: 0, - nasolabialOrMandibularOutput: false, - partition: 0, - pointOutChangeSide: false, - totalWorkingMinutes: 2, - totalWorkingSeconds: 1, - workMode: "face", - workStatus: "working", - }, - { - battery: 4, - commandType: "DeviceStatusSync", - deviceSyncStatusType: "onlySyncStatusToDevice", - gear: 1, - impedance: 321, - isCharging: false, - joulePerSecond: 1, - matrixBattery: 0, - nasolabialOrMandibularOutput: false, - partition: 0, - pointOutChangeSide: false, - totalWorkingMinutes: 2, - totalWorkingSeconds: 1, - workMode: "face", - workStatus: "working", - }, - { - battery: 4, - commandType: "DeviceStatusSync", - deviceSyncStatusType: "onlySyncStatusToDevice", - gear: 1, - impedance: 221, - isCharging: false, - joulePerSecond: 1, - matrixBattery: 0, - nasolabialOrMandibularOutput: false, - partition: 0, - pointOutChangeSide: false, - totalWorkingMinutes: 2, - totalWorkingSeconds: 1, - workMode: "face", - workStatus: "working", - }, - { - battery: 4, - commandType: "DeviceStatusSync", - deviceSyncStatusType: "onlySyncStatusToDevice", - gear: 1, - impedance: 216, - isCharging: false, - joulePerSecond: 1, - matrixBattery: 0, - nasolabialOrMandibularOutput: false, - partition: 0, - pointOutChangeSide: false, - totalWorkingMinutes: 2, - totalWorkingSeconds: 1, - workMode: "face", - workStatus: "working", - }, - { - battery: 4, - commandType: "DeviceStatusSync", - deviceSyncStatusType: "onlySyncStatusToDevice", - gear: 1, - impedance: 212, - isCharging: false, - joulePerSecond: 1, - matrixBattery: 0, - nasolabialOrMandibularOutput: false, - partition: 0, - pointOutChangeSide: false, - totalWorkingMinutes: 2, - totalWorkingSeconds: 1, - workMode: "face", - workStatus: "working", - }, - { - battery: 4, - commandType: "DeviceStatusSync", - deviceSyncStatusType: "onlySyncStatusToDevice", - gear: 1, - impedance: 211, - isCharging: false, - joulePerSecond: 1, - matrixBattery: 0, - nasolabialOrMandibularOutput: false, - partition: 0, - pointOutChangeSide: false, - totalWorkingMinutes: 2, - totalWorkingSeconds: 1, - workMode: "face", - workStatus: "working", - }, - { - battery: 4, - commandType: "DeviceStatusSync", - deviceSyncStatusType: "onlySyncStatusToDevice", - gear: 1, - impedance: 721, - isCharging: false, - joulePerSecond: 1, - matrixBattery: 0, - nasolabialOrMandibularOutput: false, - partition: 0, - pointOutChangeSide: false, - totalWorkingMinutes: 2, - totalWorkingSeconds: 1, - workMode: "face", - workStatus: "working", - }, - { - battery: 4, - commandType: "DeviceStatusSync", - deviceSyncStatusType: "onlySyncStatusToDevice", - gear: 1, - impedance: 121, - isCharging: false, - joulePerSecond: 1, - matrixBattery: 0, - nasolabialOrMandibularOutput: false, - partition: 0, - pointOutChangeSide: false, - totalWorkingMinutes: 2, - totalWorkingSeconds: 1, - workMode: "face", - workStatus: "working", - }, - ], - id: "2024-03-18 15:50:39", - instrumentId: 92, - instrumentName: "lzw的FR200测试", - jsonStatus: { - battery: 4, - commandType: "DeviceStatusSync", - deviceSyncStatusType: "onlySyncStatusToDevice", - gear: 1, - impedance: 21, - isCharging: false, - joulePerSecond: 1, - matrixBattery: 0, - nasolabialOrMandibularOutput: false, - partition: 0, - pointOutChangeSide: false, - totalWorkingMinutes: 2, - totalWorkingSeconds: 1, - workMode: "face", - workStatus: "standby", - }, - modeId: 154, - modeName: "基础班脸部", - workMode: "face", -} + const deviceToolKitInstanceFR200 = new DeviceToolKitWM("FR200"); let deviceToolKitInstance = deviceToolKitInstanceFR200; @@ -618,6 +143,8 @@ class IotCarePlanFR200 extends Component { /** 护理过程 END*/ // 模式列表 + TestModeStepIndex: 0, + currentWorkModeType: 1, isModeLock: false, // 模式是否锁定 isSwitchActiveMode: false, // 是否显示弹窗切换模式 ModeList: [], @@ -712,12 +239,12 @@ class IotCarePlanFR200 extends Component { this.getInstrumentClockSummary(); this.getInstrumentClockDetail(); if (option.modeId) { - this.setState({ activeModeID: option.modeId }) + this.setState({ activeModeID: option.modeId }); } } - componentDidMount() { } + componentDidMount() {} - componentWillUnmount() { } + componentWillUnmount() {} componentDidShow() { console.log("页面显示了"); @@ -840,6 +367,7 @@ class IotCarePlanFR200 extends Component { }); }; + // 获取模式列表 GetModeList = async (id) => { let params = { instrumentId: id, @@ -848,19 +376,18 @@ class IotCarePlanFR200 extends Component { if (res.data.code === 200) { if (res.data.data.length > 0) { this.setState({ - ActiveModeItem: res.data.data[0], ModeList: res.data.data, }); - if (this.state.activeModeID != '') { - this.state.ModeList.map(item => { - if (item.id === this.state.activeModeID) { - this.setState({ - ActiveModeItem: item - }); - } - }) - } + // if (this.state.activeModeID != "") { + // this.state.ModeList.map((item) => { + // if (item.id === this.state.activeModeID) { + // this.setState({ + // ActiveModeItem: item, + // }); + // } + // }); + // } setTimeout(() => { this.modeCurrentFun(res.data.data[0]); @@ -901,7 +428,9 @@ class IotCarePlanFR200 extends Component { }, 0); } - /** 选中护理模式 */ + /** + * @name 选中/切换护理模式 + * */ modeCurrentFun = async (data, isNotCheck = false) => { let { isShowNurse } = this.state; // 护理检查改变模式,是否提示切换护理模式 @@ -931,14 +460,26 @@ class IotCarePlanFR200 extends Component { let currentTime = data.modeTimeStr; + // 根据模式,动态设置底部按钮样式 + let currentWorkModeType = 1; + if (data.modeType === "moistureTest") { + currentWorkModeType = 3; + } else if ( + data.modeType === "maskPenetration" || + data.modeType === "essence" + ) { + currentWorkModeType = 2; + } + this.setState({ ActiveModeItem: data, activeModeID: data.id, ModeID: "mode_" + data.id, currentServiceData, ModeStepIndex: 0, - currentTime, ModeType: this.ModeTypeArray[data.modeClass], + currentTime, + currentWorkModeType, }); setTimeout(() => { @@ -1059,12 +600,12 @@ class IotCarePlanFR200 extends Component { onStartNurse = async () => { this.stepNext(); - setTimeout(() => { - this.onNursingTap(); - // 倒计时弹窗: 倒计时完成后,自动开始,并判断弹窗 - let downNum = CountDownTime[this.state.ActiveModeItem.modeType] || 3; - this.showCountdownFun(downNum, () => { }); - }, 500); + setTimeout(() => { + this.onNursingTap(); + // // 倒计时弹窗: 倒计时完成后,自动开始,并判断弹窗 + // let downNum = CountDownTime[this.state.ActiveModeItem.modeType] || 3; + // this.showCountdownFun(downNum, () => {}); + }, 500); // 如果检查失败,则报错 this.onEmitErrorTips(); @@ -1084,7 +625,7 @@ class IotCarePlanFR200 extends Component { }; // 绘制能量图 - drawProwerPicture() { } + drawProwerPicture() {} /** 切换光照 */ onSwitchChange = async () => { @@ -1197,6 +738,18 @@ class IotCarePlanFR200 extends Component { case "working": //设备的运行中状态 console.log("设备状态同步 运行中状态", jsonStatus); + if (jsonStatus.workMode === "moistureTest") { + // 水分测试 + // teststatus:success + } + + // 脸部模式 + if (jsonStatus.workMode === "face") { + // impedance + // totalWorkingMinutes: 0 + // totalWorkingSeconds: 24 + } + // this.judgementWorkStatus( // MODE_WORKING_ENUM.WORKING, // jsonStatus.workMode @@ -1673,9 +1226,11 @@ class IotCarePlanFR200 extends Component { }; // 水分测试需要特殊处理 + // 水分测试准备 水分测试工作 水分测试启动 if (ActiveModeItem.modeType === "moistureTest") { sendParams.testStatus = "standby"; // 切换为准备 if (isBtnClick) { + // 水分测试启动 sendParams.testStatus = "start"; // 点击开始再开始 } } @@ -1946,7 +1501,10 @@ class IotCarePlanFR200 extends Component { /** 获取小程序本地缓存的历史记录 */ getFR200NursingHistory() { this.FR200NursingHistory = Taro.getStorageSync("FR200NursingHistory"); - console.log(this.FR200NursingHistory, '获取本地数据++++++++++++++++++++++++++++++++++++++++++'); + console.log( + this.FR200NursingHistory, + "获取本地数据++++++++++++++++++++++++++++++++++++++++++" + ); // 是否同步历史记录 let isSyncHistory = Taro.getStorageSync("isSyncHistory"); @@ -2023,6 +1581,11 @@ class IotCarePlanFR200 extends Component { } Taro.setStorageSync("FR200NursingHistory", params); console.log("更新updateFR200NursingHistory"); + + // 基础模式可在这里调用函数更新图标Echarts + // 最新一条数据jsonStatus + // 注意事项:只拿working状态 + // todo } else { this.setFR200NursingHistory(jsonStatus); } @@ -2061,29 +1624,31 @@ class IotCarePlanFR200 extends Component { todoPromise = async () => { const nowFR200NursingHistory = Taro.getStorageSync("FR200NursingHistory"); // 护理脸部 - if (nowFR200NursingHistory.workMode === 'face') { + if (nowFR200NursingHistory.workMode === "face") { // 把working=工作中的状态数据筛选出来 - let filtered = nowFR200NursingHistory.dataArray.filter(item => item.workStatus === 'working'); + let filtered = nowFR200NursingHistory.dataArray.filter( + (item) => item.workStatus === "working" + ); // 能量发数 filtered = filtered.slice(0, 360); // 脸部能量 - let faceEnergy = 0 - filtered.forEach(item => { - faceEnergy += item.joulePerSecond - }) + let faceEnergy = 0; + filtered.forEach((item) => { + faceEnergy += item.joulePerSecond; + }); // 计算平均数 // let sum = filtered.reduce((accumulator, currentValue) => accumulator + currentValue.impedance, 0); // let average = sum / filtered.length; // 最大 - let max: any = Math.max(...filtered.map(item => item.impedance)); - max = this.determineTier(max) + let max: any = Math.max(...filtered.map((item) => item.impedance)); + max = this.determineTier(max); // 最小 - let min: any = Math.min(...filtered.map(item => item.impedance)); - min = this.determineTier(min) + let min: any = Math.min(...filtered.map((item) => item.impedance)); + min = this.determineTier(min); // 平均数最大等级处于2 - let average: any = max / 2 - average = this.determineTier(average) + let average: any = max / 2; + average = this.determineTier(average); // 能量图里面的图谱每10秒为一个数组 // 创建一个空数组用于存储分组后的结果 @@ -2095,14 +1660,14 @@ class IotCarePlanFR200 extends Component { let group = filtered.slice(i, i + 10); // 找到组中最大的 name 值 - let maxName = Math.max(...group.map(obj => obj.impedance)); + let maxName = Math.max(...group.map((obj) => obj.impedance)); // 计算并存储每组的平均数 - let average:any = this.determineTier(maxName / 2); + let average: any = this.determineTier(maxName / 2); // let average = maxName / 2; - if(average >=1) { - average=average-1 - average=average *10 + if (average >= 1) { + average = average - 1; + average = average * 10; } // 将包含该组对象和平均数的对象添加到 groupedAa 数组中 groupedAa.push(average); @@ -2111,30 +1676,35 @@ class IotCarePlanFR200 extends Component { let nursingData = { // nursingTime:result, nursingData: JSON.stringify({ - faceEnergy, max, min, average, groupedAa, filtered: filtered.length, workMode: nowFR200NursingHistory.workMode - }) - } + faceEnergy, + max, + min, + average, + groupedAa, + filtered: filtered.length, + workMode: nowFR200NursingHistory.workMode, + }), + }; - return nursingData + return nursingData; } else { let GearData = this.state.GearData; // 肌肤报告 - let Allnum = 0 - GearData.forEach(e => { - Allnum = +e.forehead + let Allnum = 0; + GearData.forEach((e) => { + Allnum = +e.forehead; }); // 向下取整 Allnum = Math.floor(Allnum / 3); let nursingData = { nursingData: JSON.stringify({ - Allnum, GearData - }) - } - return nursingData + Allnum, + GearData, + }), + }; + return nursingData; } - - - } + }; // 计算挡位 determineTier = (sun) => { @@ -2149,8 +1719,8 @@ class IotCarePlanFR200 extends Component { } // 如果 sun 不在任何一档范围内,返回默认档或处理错误 - return '10'; - } + return "10"; + }; /** 提交护理记录:完成护理后自动调用,会跳转页面 */ PostNursingLogClock = async (data: any = null, isJump = true) => { // todo 建议写一个Promise异步函数,用 await 执行,在提交前处理好数据 @@ -2161,19 +1731,17 @@ class IotCarePlanFR200 extends Component { if (data) { params = data; } else { - params = { instrumentId: currentDevice.id, instrumentName: currentDevice.name, modeId: ActiveModeItem.id, modeName: ActiveModeItem.modeName, nursingTime: s_to_hms(this.elapsedTime), - }; } - let res1: any = await this.todoPromise() - console.log(res1, '查看返回数据'); - params = { ...params, ...res1 } + let res1: any = await this.todoPromise(); + console.log(res1, "查看返回数据"); + params = { ...params, ...res1 }; let res: any = await InstrumentInfo.apiNursingLog.addLog(params); console.log("PostNursingLogClock", res); if (res.data.code === 200) { @@ -2194,7 +1762,6 @@ class IotCarePlanFR200 extends Component { isShowNursingSuccess: false, }); - this.goFaceReport(res1, ActiveModeItem.id); // 跳转 }, 2000); } @@ -2352,30 +1919,36 @@ class IotCarePlanFR200 extends Component { /** 完成护理提交:跳转护理报告页 */ goFaceReport = (data, id) => { - let nursingData = JSON.parse(data.nursingData) + let nursingData = JSON.parse(data.nursingData); // 跳转前置空定时器,防止重复提交 if (currentTimeTimer) clearInterval(currentTimeTimer); - if (['face', 'eyes', 'nasolabialFold', 'mandibularLine', 'headLiftingPro'].includes(nursingData.workMode)) { + if ( + [ + "face", + "eyes", + "nasolabialFold", + "mandibularLine", + "headLiftingPro", + ].includes(nursingData.workMode) + ) { let obj = { modeName: nursingData.modeName, - data: nursingData - } + data: nursingData, + }; let report = true; go( "/recoding/pages/face_report_one/face_report_one?id=" + - id + - "&report=" + - report + "&obj=" + - JSON.stringify(obj) + id + + "&report=" + + report + + "&obj=" + + JSON.stringify(obj) ); - - } else if ('moistureTest' === nursingData.workMode) { - console.log('水分测试'); - + } else if ("moistureTest" === nursingData.workMode) { + console.log("水分测试"); } else { go("/pages/face_report/face_report?id=" + this.state.currentDevice.id); } - }; // 完成配对 @@ -2477,6 +2050,7 @@ class IotCarePlanFR200 extends Component { ModeStepIndex, currentServiceData, ActiveModeItem, + currentWorkModeType, isSwitchActiveMode, ModeID, activeModeID, @@ -2501,6 +2075,7 @@ class IotCarePlanFR200 extends Component { isRuningTest, isShowHistoryMsg, isModeLock, + TestModeStepIndex, } = this.state; return ( @@ -2646,9 +2221,9 @@ class IotCarePlanFR200 extends Component { deviceInfo={currentDevice} close={this.connectionClose} isDisconnect={!isConnectionBlutoot} - offlineChange={() => { }} + offlineChange={() => {}} pairingChange={this.pairingChange} - upgradeFun={() => { }} + upgradeFun={() => {}} /> )} @@ -2744,12 +2319,15 @@ class IotCarePlanFR200 extends Component { )} {ActiveModeItem.modeType === "moistureTest" && ( - + )}