diff --git a/src/moduleIOT/pages/iotCarePlan/FR200.tsx b/src/moduleIOT/pages/iotCarePlan/FR200.tsx index 8ba0614..224e35f 100644 --- a/src/moduleIOT/pages/iotCarePlan/FR200.tsx +++ b/src/moduleIOT/pages/iotCarePlan/FR200.tsx @@ -2078,14 +2078,10 @@ class IotCarePlanFR200 extends Component { // 脸部one todoPromise = async () => { const nowFR200NursingHistory = Taro.getStorageSync("FR200NursingHistory"); - console.log(nowFR200NursingHistory,'nowFR200NursingHistory'); - // 护理脸部 if (nowFR200NursingHistory.workMode === 'face') { // 把working=工作中的状态数据筛选出来 let filtered = nowFR200NursingHistory.dataArray.filter(item => item.workStatus === 'working'); - console.log(filtered,'filtered'); - // 能量发数 filtered = filtered.slice(0, 360); // 脸部能量 @@ -2120,51 +2116,36 @@ class IotCarePlanFR200 extends Component { let maxName = Math.max(...group.map(obj => obj.impedance)); // 计算并存储每组的平均数 - let average = this.determineTier(maxName / 2); + let average:any = this.determineTier(maxName / 2); // let average = maxName / 2; - + if(average >=1) { + average=average-1 + average=average *10 + } // 将包含该组对象和平均数的对象添加到 groupedAa 数组中 - groupedAa.push({ objects: group, average: average }); + groupedAa.push(average); } - // 转换时间 - // 将分钟转换为两位数字的字符串 - // let minuteString = filtered.jsonStatus.totalWorkingMinutes.toString().padStart(2, '0'); - - // // 将秒转换为两位数字的字符串 - // let secondString = filtered.jsonStatus.totalWorkingMinutes.toString().padStart(2, '0'); - - // 拼接分钟和秒的字符串 - // let result = `${minuteString}:${secondString}`; - let result = `02:01`; - // let GearData = this.state.GearData; - // // 水分报告 - // let Allnum=0 - // GearData.forEach(e => { - // Allnum =+e.forehead - // }); - // // 向下取整 - // Allnum = Math.floor(Allnum / 3); - + let nursingData = { // nursingTime:result, - nursingData:JSON.stringify({ - faceEnergy, max, min, average, groupedAa + nursingData: JSON.stringify({ + faceEnergy, max, min, average, groupedAa, filtered: filtered.length, workMode: nowFR200NursingHistory.workMode }) } - + return nursingData } else { - let GearData = this.state.GearData; + let GearData = this.state.GearData; // 肌肤报告 - let Allnum=0 + let Allnum = 0 GearData.forEach(e => { - Allnum =+e.forehead + Allnum = +e.forehead }); // 向下取整 Allnum = Math.floor(Allnum / 3); let nursingData = { - nursingData:JSON.stringify({ - Allnum,GearData + nursingData: JSON.stringify({ + Allnum, GearData }) } return nursingData @@ -2210,7 +2191,7 @@ class IotCarePlanFR200 extends Component { } let res1: any = await this.todoPromise() console.log(res1, '查看返回数据'); - params = { ...params, ...res1 } + params = { ...params, ...res1 } let res: any = await InstrumentInfo.apiNursingLog.addLog(params); console.log("PostNursingLogClock", res); if (res.data.code === 200) { @@ -2230,7 +2211,9 @@ class IotCarePlanFR200 extends Component { this.setState({ isShowNursingSuccess: false, }); - this.goFaceReport(); // 跳转 + + + this.goFaceReport(res1, ActiveModeItem.id); // 跳转 }, 2000); } } @@ -2386,10 +2369,31 @@ 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 145ea9b..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,31 +69,20 @@ function Index() { const startColor = "#FFFF00"; // 黄色 const endColor = "#FF0000"; // 红色 - const steps = 80; // 80个颜色 + const steps = 81; // 80个颜色 const colors = generateColorArray(startColor, endColor, steps); -const xList = [...new Array(37).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 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: { @@ -90,8 +98,6 @@ const seriesData = [ axisLabel: { interval: 5, formatter: function (value, index) { - console.log(value,'查看'); - return value * 10 + 's'; }, textStyle: { @@ -170,7 +176,7 @@ const seriesData = [ // 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 e8a47d1..dc99f5e 100644 --- a/src/pages/index/index.tsx +++ b/src/pages/index/index.tsx @@ -842,10 +842,10 @@ class Index extends Component { goNursing = (item) => { // 仅开发者工具调试使用 const platform = Taro.getSystemInfoSync().platform; - setStorageSync("instrument_detail", item); - this.setState({ connectInstrument: item }); - setTimeout(() => this.goIot()); - return; + // 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 00bdd63..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; @@ -323,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/recording/recording.tsx b/src/recoding/pages/recording/recording.tsx index 246bb8c..375d6fc 100644 --- a/src/recoding/pages/recording/recording.tsx +++ b/src/recoding/pages/recording/recording.tsx @@ -290,34 +290,36 @@ export default class Recording extends Component { // 跳转到护理报告 toReport(id, recordId, item) { console.log(item, "查看类型", item.jumpType); - item.jumpType = 1; - switch (item.jumpType) { - case 1: - this.One(item); - break; - case 2: - this.two(item); - break; - case 6: - this.three(item); - break; - default: - this.AllDevice(item); + if ([1,2,3,4,5].includes(item.jumpType)) { + this.One(item); + } else if (item.jumpType === 0) { + this.two(item); + } else if (item.jumpType === 6) { + this.three(item); + } else { + 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 + report+ "&obj=" + + JSON.stringify(obj) ); }; // 打开第二种类型