diff --git a/src/moduleIOT/pages/iotCarePlan/FR200.tsx b/src/moduleIOT/pages/iotCarePlan/FR200.tsx index 5a904cb..cc34f9f 100644 --- a/src/moduleIOT/pages/iotCarePlan/FR200.tsx +++ b/src/moduleIOT/pages/iotCarePlan/FR200.tsx @@ -2,6 +2,7 @@ import Taro from "@tarojs/taro"; import dayjs from "dayjs"; import classnames from "classnames"; import { debounce } from "lodash"; + // eslint-disable-next-line import/no-named-as-default import React, { Component, @@ -66,7 +67,489 @@ 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; @@ -212,7 +695,7 @@ class IotCarePlanFR200 extends Component { pointOutChangeSide: false, // 交叉输出点 impedance: 107, // 阻抗/能量等级:1档<200 200<2档<280 280<3档<360 后面以此类推每加一档+80抗阻 }; - + // 1档 等于0<200,2档等于200<280,3档等于280<360 /** FR200模式类型:名称 */ ModeTypeArray: string[] = [ "all", @@ -227,7 +710,7 @@ class IotCarePlanFR200 extends Component { /** 基础版:脸部/眼部 */ BaseModeType: string[] = ["face", "eyes"]; - async onLoad() { + async onLoad(option) { // 保持屏幕常亮 Taro.setKeepScreenOn({ keepScreenOn: true, @@ -235,6 +718,9 @@ class IotCarePlanFR200 extends Component { this.initData(); this.getInstrumentClockSummary(); this.getInstrumentClockDetail(); + if (option.modeId) { + this.setState({ activeModeID: option.modeId }); + } } componentDidMount() {} @@ -373,6 +859,16 @@ class IotCarePlanFR200 extends Component { ModeList: res.data.data, }); + 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]); }, 100); @@ -1469,6 +1965,10 @@ class IotCarePlanFR200 extends Component { /** 获取小程序本地缓存的历史记录 */ getFR200NursingHistory() { this.FR200NursingHistory = Taro.getStorageSync("FR200NursingHistory"); + console.log( + this.FR200NursingHistory, + "获取本地数据++++++++++++++++++++++++++++++++++++++++++" + ); // 是否同步历史记录 let isSyncHistory = Taro.getStorageSync("isSyncHistory"); @@ -1572,14 +2072,114 @@ class IotCarePlanFR200 extends Component { Taro.removeStorageSync("FR200NursingHistory"); }; - todoPromise = () => { - return new Promise((resolve, reject) => { - setTimeout(() => { - resolve(); + // todoPromise = () => { + // return new Promise((resolve, reject) => { + // setTimeout(() => { + // resolve(); + // }); + // }); + // }; + // 脸部one + todoPromise = async () => { + const nowFR200NursingHistory = Taro.getStorageSync("FR200NursingHistory"); + // 护理脸部 + if (nowFR200NursingHistory.workMode === "face") { + // 把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 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 min: any = Math.min(...filtered.map((item) => item.impedance)); + min = this.determineTier(min); + // 平均数最大等级处于2 + let average: any = max / 2; + average = this.determineTier(average); + + // 能量图里面的图谱每10秒为一个数组 + // 创建一个空数组用于存储分组后的结果 + // 创建一个空数组用于存储分组后的结果 + let groupedAa: any[] = []; + // 使用循环遍历数组 aa + for (let i = 0; i < filtered.length; i += 10) { + // 提取每组的三个对象 + let group = filtered.slice(i, i + 10); + + // 找到组中最大的 name 值 + let maxName = Math.max(...group.map((obj) => obj.impedance)); + + // 计算并存储每组的平均数 + let average: any = this.determineTier(maxName / 2); + // let average = maxName / 2; + if (average >= 1) { + average = average - 1; + average = average * 10; + } + // 将包含该组对象和平均数的对象添加到 groupedAa 数组中 + groupedAa.push(average); + } + + let nursingData = { + // nursingTime:result, + nursingData: JSON.stringify({ + faceEnergy, + max, + min, + average, + groupedAa, + filtered: filtered.length, + workMode: nowFR200NursingHistory.workMode, + }), + }; + + return nursingData; + } else { + let GearData = this.state.GearData; + // 肌肤报告 + let Allnum = 0; + GearData.forEach((e) => { + Allnum = +e.forehead; + }); + // 向下取整 + Allnum = Math.floor(Allnum / 3); + let nursingData = { + nursingData: JSON.stringify({ + Allnum, + GearData, + }), + }; + return nursingData; + } }; + // 计算挡位 + determineTier = (sun) => { + // 定义每档的范围 + const tiers = [0, 200, 280, 360, 440, 520, 600, 680, 760, 840]; + + // 遍历每一档的范围,找到 sun 所属的档 + for (let i = 0; i < tiers.length; i++) { + if (sun < tiers[i + 1]) { + return i + 1; + } + } + + // 如果 sun 不在任何一档范围内,返回默认档或处理错误 + return "10"; + }; /** 提交护理记录:完成护理后自动调用,会跳转页面 */ PostNursingLogClock = async (data: any = null, isJump = true) => { // todo 建议写一个Promise异步函数,用 await 执行,在提交前处理好数据 @@ -1598,7 +2198,9 @@ class IotCarePlanFR200 extends Component { nursingTime: s_to_hms(this.elapsedTime), }; } - + 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) { @@ -1618,7 +2220,8 @@ class IotCarePlanFR200 extends Component { this.setState({ isShowNursingSuccess: false, }); - this.goFaceReport(); // 跳转 + + this.goFaceReport(res1, ActiveModeItem.id); // 跳转 }, 2000); } } @@ -1774,10 +2377,37 @@ class IotCarePlanFR200 extends Component { }; /** 完成护理提交:跳转护理报告页 */ - goFaceReport = () => { + goFaceReport = (data, id) => { + let nursingData = JSON.parse(data.nursingData); // 跳转前置空定时器,防止重复提交 if (currentTimeTimer) clearInterval(currentTimeTimer); - go("/pages/face_report/face_report?id=" + this.state.currentDevice.id); + if ( + [ + "face", + "eyes", + "nasolabialFold", + "mandibularLine", + "headLiftingPro", + ].includes(nursingData.workMode) + ) { + let obj = { + modeName: nursingData.modeName, + data: nursingData, + }; + let report = true; + go( + "/recoding/pages/face_report_one/face_report_one?id=" + + id + + "&report=" + + report + + "&obj=" + + JSON.stringify(obj) + ); + } else if ("moistureTest" === nursingData.workMode) { + console.log("水分测试"); + } else { + go("/pages/face_report/face_report?id=" + this.state.currentDevice.id); + } }; // 完成配对 diff --git a/src/moduleIOT/pages/iotCarePlan/components/Echart_face/index.tsx b/src/moduleIOT/pages/iotCarePlan/components/Echart_face/index.tsx index 49f2027..189ff3a 100644 --- a/src/moduleIOT/pages/iotCarePlan/components/Echart_face/index.tsx +++ b/src/moduleIOT/pages/iotCarePlan/components/Echart_face/index.tsx @@ -9,13 +9,32 @@ import echarts from "@/utils/echarts.min.js"; import "./index.less"; interface Props { - Electricity: any; - matrixElectricity: any; - facialMaskConnectStatus: any; + EchartsData:any } -function Index() { - +function Index({ + EchartsData + }:Props) { + let type =0 + switch(EchartsData.modeName) { + case '基础班脸部': + type=37 + break; + case '基础版眼部': + type=25 + break; + case '法令纹Pro': + type=25 + break; + case '下颌线Pro': + type=19 + break; + case '抬头纹Pro': + type=13 + break; + default: + + } const echartsRef = useRef(null); function generateColorArray(startColor, endColor, steps) { var startRGB = hexToRgb(startColor); @@ -50,49 +69,38 @@ function Index() { const startColor = "#FFFF00"; // 黄色 const endColor = "#FF0000"; // 红色 - const steps = 80; // 80个颜色 - - - const colors = generateColorArray(startColor, endColor, steps); - const xList = [...new Array(61).fill(0).map((item, key) => key)]; - const seriesData = [ - ...xList.map((item) => { - return Math.random() * 80; - }), - ]; - // let seriesData=[ - // 1,2,2,3,3,4,5,1,2,3,4,2,3,5,1,2,3,1,2,2,3,3,4,5,1,2,3,4,2,3,5,1,2,3, - // 1,2,2,3,3,4,5,1,2,3,4,2,3,5,1,2,3, - // 1,2,2,3,3,4,5,1,2,3,4,2,3,5,1,2,3 - // ,1,2,2,3,3,4,5,1,2,3,4,2,3,5,1,2,3 - // ,1,2,2,3,3,4,5,1,2,3,4,2,3,5,1,2,3 - // ,1,2,2,3,3,4,5,1,2,3,4,2,3,5,1,2,3 - // ,1,2,2,3,3,4,5,1,2,3,4,2,8,5,1,2,3, - // 1,2,2,3,3,4,5,1,2,3,4,2,3,5,1,2,3 - // ,1,2,2,3,3,4,5,1,2,3,4,2,3,5,1,2,3 - // ,1,2,2,3,3,4,5,1,2,3,4,2,3,5,1,2,3 - // ,1,2,2,3,3,4,5,1,2,3,4,2,3,5,1,2,3 - // ,1,2,2,3,3,4,5,1,2,3,4,2,3,5,1,2,3 - // ] - // console.log(seriesData,'seriesData',xList); - - const option: EChartOption = { - grid: { - // 让图表占满容器 - top: "10rpx", - left: "35rpx", - right: "28rpx", - bottom: "17rpx", - }, - xAxis: { - type: "category", - data: [...xList], - axisLabel: { - interval: 9, - formatter: function (value, index) { - return value * 6 + 's'; - }, - textStyle: { + const steps = 81; // 80个颜色 + + +const colors = generateColorArray(startColor, endColor, steps); +const xList = [...new Array(type).fill(0).map((item, key) => key)]; +let seriesData:any =[] +seriesData = EchartsData?.data?.groupedAa +// const xList = [...new Array(37).fill(0).map((item, key) => key)]; +// const seriesData = [ +// ...xList.map((item) => { +// return Math.random() * 80; +// }), +// ]; + + + const option: EChartOption ={ + grid: { + // 让图表占满容器 + top: "10rpx", + left: "45rpx", + right: "28rpx", + bottom: "17rpx", + }, + xAxis: { + type: "category", + data: [...xList], + axisLabel: { + interval: 5, + formatter: function (value, index) { + return value * 10 + 's'; + }, + textStyle: { color: '#999999', // 文字颜色 fontSize: 8 // 文字大小 }, @@ -168,7 +176,7 @@ function Index() { // isPage={false} // style自定义设置echarts宽高 // style={{ width: "100%", height: "100%" }} - style={{ width: "630rpx", height: "260rpx" }} + style={{ width: "670rpx", height: "260rpx" }} /> {/* diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx index f420f4f..c1a0dee 100644 --- a/src/pages/index/index.tsx +++ b/src/pages/index/index.tsx @@ -849,6 +849,10 @@ class Index extends Component { console.log("connectInstrument", item); // 仅开发者工具调试使用 const platform = Taro.getSystemInfoSync().platform; + // setStorageSync("instrument_detail", item); + // this.setState({ connectInstrument: item }); + // setTimeout(() => this.goIot()); + // return; if (platform === "devtools") { setStorageSync("instrument_detail", item); this.setState({ connectInstrument: item }); diff --git a/src/recoding/pages/face_report_one/face_report_one.less b/src/recoding/pages/face_report_one/face_report_one.less index f0ea911..a96cb79 100644 --- a/src/recoding/pages/face_report_one/face_report_one.less +++ b/src/recoding/pages/face_report_one/face_report_one.less @@ -23,7 +23,27 @@ page { margin-bottom: 20rpx; margin-top: 32rpx; } - +.itemStyel{ + display: inline-block; + font-size: 15rpx; + position: absolute; + top: 0rpx; + left: 94rpx; +} +.itemStyelone{ + display: inline-block; + font-size: 15rpx; + position: absolute; + top: 0rpx; + left: 142rpx; +} +.itemStyeltwo{ + display: inline-block; + font-size: 15rpx; + position: absolute; + top: 0rpx; + left: 278rpx; +} .statistic_item { flex: 1; border-right: 1rpx solid #dddddd; @@ -73,15 +93,18 @@ page { font-size: 32rpx; font-weight: bold; color: #000; + padding-left: 16rpx; // margin: 48rpx 0 34rpx; } .eacharts{ // background-color: red; // margin-top: 14px; + margin: auto; margin-bottom: 45rpx; /* margin: 52rpx 0rpx; */ width: 100%; height: 247rpx; + // margin-left: 131rpx; } .van-popup { border-radius: 30rpx; @@ -320,6 +343,7 @@ page { margin: 12rpx 0rpx; color: #181818; font-weight: 700; + position: relative; } // .desc:last-child { diff --git a/src/recoding/pages/face_report_one/face_report_one.tsx b/src/recoding/pages/face_report_one/face_report_one.tsx index 94c211c..6f41fa4 100644 --- a/src/recoding/pages/face_report_one/face_report_one.tsx +++ b/src/recoding/pages/face_report_one/face_report_one.tsx @@ -17,6 +17,7 @@ import { InstrumentInfo } from "@/utils/Interface"; // 引入ecahrts图表 // import EchartsForm from '@/moduleIOT/pages/iotCarePlan/components/Echart_face' import EchartsForm from '../../../moduleIOT/pages/iotCarePlan/components/Echart_face' +import Echarts1 from '../../../moduleIOT/pages/iotCarePlan/components/Echart' /** 自定义组件 **/ @@ -26,13 +27,19 @@ export default class Index extends Component { constructor(props) { super(props); this.state = { - face_Tyep: '基础脸部', + EchartsData:{}, reportShow: true, name: "template模板页", statistics: {}, recordList: [], + modeImage: require("@/img/face-report/face.png"), recordData: { - modeImage: require("@/img/face-report/face.png") + modeName: '基础班脸部', + filtered:111, + faceEnergy:222, + average:2222, + max:33, + min:7 }, year: new Date().getFullYear(), show: false, @@ -73,7 +80,7 @@ export default class Index extends Component { data["instrumentId"] = id; } let res = await InstrumentInfo.apiNursingLog.getStatistics(data); - + if (res.data.code === 200) { this.setState({ statistics: res.data.data }); } @@ -246,8 +253,8 @@ export default class Index extends Component { const id = searchParams.get("id"); const recordId = searchParams.get("recordId"); this.getStatistics(id); - this.getRecord(id, recordId); - console.log(recordId); + // this.getRecord(id, recordId); + // console.log(recordId); } getTime(time) { const hour = time.slice(0, 2); @@ -260,20 +267,52 @@ export default class Index extends Component { return minute + "分" + second + "秒"; } } - async onLoad(options) { - console.log(options, '查看传过来的参数'); - + onLoad(options) { + let Bool = JSON.parse(options?.report) if (!Bool) { this.setState({ reportShow: Bool }) } - + this.init(options) this.getRouteId(); - this.getClockStatistics() + // this.getClockStatistics() + } + init(options){ + let obj =JSON.parse(options.obj) + let recordData =this.state.recordData + let modeImage =this.state.modeImage + + switch(obj.modeName) { + case '基础班脸部': + modeImage =require("@/img/face-report/face.png") + break; + case '基础版眼部': + modeImage =require("@/img/face-report/eye.png") + break; + case '法令纹Pro': + modeImage =require("@/img/face-report/nasolabial_Pro.png") + break; + case '下颌线Pro': + modeImage =require("@/img/face-report/Mandibular_Pro.png") + break; + case '抬头纹Pro': + modeImage =require("@/img/face-report/Head_lift_Pro.png") + break; + default: + + } + recordData ={ + ...obj, + ...obj.data + } + this.setState({recordData,modeImage,EchartsData:{...obj}}) + + console.log(obj,'查看'); + + } - componentDidShow() { } componentDidHide() { } @@ -285,7 +324,7 @@ export default class Index extends Component { }; render() { - let { name, statistics, recordList, recordData, show, clockStatistics, punchInInfo, monthTime, reportShow, face_Tyep } = this.state; + let { name, statistics, modeImage, recordData, show, clockStatistics, punchInInfo, monthTime, reportShow,EchartsData } = this.state; return ( @@ -310,24 +349,24 @@ export default class Index extends Component { - {face_Tyep} + {recordData.modeName} - 能量发数:{recordData.modeName} + 能量发数{recordData.modeName === '下颌线Pro'?[1]:null}  :{recordData.filtered}发 - 脸部能量:≈{recordData.nursingTime} + 脸部能量{recordData.modeName === '下颌线Pro'?[2]:null}  :≈{recordData.faceEnergy}焦耳 - 平均能量等级:{recordData.nursingTime} + 平均能量等级  [3]:{recordData.average} - 最大等级:{recordData.nursingTime} + 最大等级  [4]:{recordData.max}级 最小等级  [5]:{recordData.min}级 @@ -335,9 +374,10 @@ export default class Index extends Component { - 能量等级图谱-{face_Tyep} + 能量等级图谱-{recordData.modeName} - + + {/* */} diff --git a/src/recoding/pages/moisture_test_report/moisture_test_report.tsx b/src/recoding/pages/moisture_test_report/moisture_test_report.tsx index c23639c..5203dd7 100644 --- a/src/recoding/pages/moisture_test_report/moisture_test_report.tsx +++ b/src/recoding/pages/moisture_test_report/moisture_test_report.tsx @@ -38,7 +38,8 @@ class MoistureTestReport extends Component { xinde: '', imglist: [], id: 0, - show: false + show: false, + modeId: 0 }; } @@ -71,20 +72,18 @@ class MoistureTestReport extends Component { reportData.shuifenGear.rightFace = gear } }) - this.setState({ reportData }); - setTimeout(() => { - console.log(this.state.reportData); - - }, 50); + this.setState({ reportData, modeId: option.modeId }); } async initData() { } toIndex() { Taro.reLaunch({ url: "/pages/index/index" }); } - + toNursing() { + go(`/moduleIOT/pages/iotCarePlan/FR200?modeId=${this.state.modeId}`) + } render() { - let { name, imgUrl, reportData, reportData1, isClock, xinde, imglist, id, show } = this.state + let { name, imgUrl, reportData, reportData1, isClock, xinde, imglist, id, show, modeId } = this.state const getStatusData = (level) => { var bgCssData = { @@ -288,7 +287,7 @@ class MoistureTestReport extends Component { - 继续护理 + 继续护理 主页 diff --git a/src/recoding/pages/recording/recording.less b/src/recoding/pages/recording/recording.less index 84197bb..e74e3e5 100644 --- a/src/recoding/pages/recording/recording.less +++ b/src/recoding/pages/recording/recording.less @@ -704,6 +704,10 @@ page { height: 100% !important; border-radius: 20rpx; } + .showImg:last-child{ + width: 40rpx !important; + height: 40rpx !important; + } } .info4 { position: relative; diff --git a/src/recoding/pages/recording/recording.tsx b/src/recoding/pages/recording/recording.tsx index 3da46f5..92cb3e2 100644 --- a/src/recoding/pages/recording/recording.tsx +++ b/src/recoding/pages/recording/recording.tsx @@ -1,4 +1,4 @@ -import Taro from "@tarojs/taro"; +import Taro, { setStorageSync } from "@tarojs/taro"; import classnames from "classnames"; import { Component, PropsWithChildren, useEffect, useState } from "react"; @@ -289,7 +289,11 @@ export default class Recording extends Component { }; // 跳转到护理报告 toReport(id, recordId, item) { - console.log(item, "查看类型", item.jumpType); + this.state.bindingInstrumentList.map(instrument => { + if (instrument.id == id) { + setStorageSync("instrument_detail", instrument); + } + }) switch (item.jumpType) { case 1: this.One(item); @@ -303,20 +307,27 @@ export default class Recording extends Component { default: this.AllDevice(item); } + + // let report =false // go("/pages/face_report/face_report?id=" + id + "&recordId=" + recordId+ "&report=" + report ); } // 打开第一种类型 One = async (item) => { - console.log("打开第一种类型", item); + let report = false; + let nursingData=JSON.parse(item.nursingData) + let obj ={ + modeName:item.modeName, + data:nursingData + } + console.log("打开第一种类型", item,obj); go( "/recoding/pages/face_report_one/face_report_one?id=" + - item.id + - "&recordId=" + - item.recordId + - "&report=" + - report + item.id + + "&report=" + + report+ "&obj=" + + JSON.stringify(obj) ); }; // 打开第二种类型 @@ -325,7 +336,7 @@ export default class Recording extends Component { }; // 打开第三种类型 three = async (item) => { - go(`/recoding/pages/moisture_test_report/moisture_test_report?data=${item.nursingData}&date=${item.createTime}`); + go(`/recoding/pages/moisture_test_report/moisture_test_report?data=${item.nursingData}&date=${item.createTime}&modeId=${item.modeId}`); }; // 打开其他类型 AllDevice = async (item) => {