diff --git a/src/app.config.ts b/src/app.config.ts index 6e116ca..25015c7 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -83,9 +83,9 @@ export default defineAppConfig({ root: "recoding", pages: [ "pages/recording/recording", - "pages/face_report/face_report", "pages/face_report_one/face_report_one", "pages/moisture_test_report/moisture_test_report", + "pages/face_report/face_report", ], }, { diff --git a/src/moduleIOT/pages/iotCarePlan/FR200.less b/src/moduleIOT/pages/iotCarePlan/FR200.less index ef71174..bf8caf2 100644 --- a/src/moduleIOT/pages/iotCarePlan/FR200.less +++ b/src/moduleIOT/pages/iotCarePlan/FR200.less @@ -45,3 +45,6 @@ } } } +.show { + display: none; +} diff --git a/src/moduleIOT/pages/iotCarePlan/FR200.tsx b/src/moduleIOT/pages/iotCarePlan/FR200.tsx index 86edeff..a6566dc 100644 --- a/src/moduleIOT/pages/iotCarePlan/FR200.tsx +++ b/src/moduleIOT/pages/iotCarePlan/FR200.tsx @@ -3,16 +3,15 @@ import dayjs from "dayjs"; import classnames from "classnames"; import { debounce } from "lodash"; -// eslint-disable-next-line import/no-named-as-default import React, { Component, PropsWithChildren, useEffect, useState, } from "react"; - -import Echarts from "./components/Echart/index"; -import Gears from "./components/Gears/index"; +/*** redux ***/ +import { connect } from "react-redux"; +/*** redux end ***/ import { Block, View, @@ -23,9 +22,27 @@ import { Button, } from "@tarojs/components"; -/*** redux ***/ -import { connect } from "react-redux"; -/*** redux end ***/ +import { + notifyBLECharacteristicValueChange, + sendCommand, +} from "@/utils/bluetoothWXAPI"; +import { + deviceCommandSamples, + bleCommandSamples, +} from "@/components/bluetoot/connection/wl200"; + +import { minSecToS, s_to_ms, s_to_hms, sleep, s_to_s } from "@/utils/util"; +// import { DeviceToolKit as DeviceToolKitWE100 } from "@flossom-npm/iot-translater-we100"; +import { + DeviceToolKit as DeviceToolKitWM, + TResponseFromDevice as TResponseFromDeviceWM, +} from "@flossom-npm/iot-translater"; +import commandMap from "@/utils/commandMap"; +import { Popup } from "@antmjs/vantui"; +import { fr200BleCommand } from "@/components/bluetoot/connection/fr200"; + +import { go, getStorageSync, setStorageSync, msg } from "@/utils/traoAPI"; +import { InstrumentInfo } from "@/utils/Interface"; /* 公共组件 */ import Navbar from "@/components/navbar/navbar"; @@ -45,28 +62,10 @@ import Footer from "./components/Footer/FR200"; import WaterTest from "./components/WaterTest/index"; /* 本页组件 END */ -import { go, getStorageSync, setStorageSync, msg } from "@/utils/traoAPI"; -import { InstrumentInfo } from "@/utils/Interface"; -import "./FR200.less"; - -import { - notifyBLECharacteristicValueChange, - sendCommand, -} from "@/utils/bluetoothWXAPI"; -import { - deviceCommandSamples, - bleCommandSamples, -} from "@/components/bluetoot/connection/wl200"; +import Echarts from "./components/Echart"; +import Gears from "./components/Gears"; -import { minSecToS, s_to_ms, s_to_hms, sleep, s_to_s } from "@/utils/util"; -// import { DeviceToolKit as DeviceToolKitWE100 } from "@flossom-npm/iot-translater-we100"; -import { - DeviceToolKit as DeviceToolKitWM, - TResponseFromDevice as TResponseFromDeviceWM, -} from "@flossom-npm/iot-translater"; -import commandMap from "@/utils/commandMap"; -import { Popup } from "@antmjs/vantui"; -import { fr200BleCommand } from "@/components/bluetoot/connection/fr200"; +import "./FR200.less"; const deviceToolKitInstanceFR200 = new DeviceToolKitWM("FR200"); let deviceToolKitInstance = deviceToolKitInstanceFR200; @@ -230,6 +229,8 @@ class IotCarePlanFR200 extends Component { // isFirstEntryMode: false, // 模式首次打开 isShowHistoryMsg: false, // 是否显示正在同步历史 + showEcharts: false, + echartsData: "", //传给echarts图表的数据 }; } @@ -439,6 +440,10 @@ class IotCarePlanFR200 extends Component { this.modeCurrentFun(res.data.data[0]); }, 100); } + let res1 = res.data.data.find((e) => e.id == this.state.activeModeID); + setTimeout(() => { + this.modeCurrentFun(res1); + }, 100); } else { this.setState({ ModeList: [] }); } @@ -696,6 +701,20 @@ class IotCarePlanFR200 extends Component { this.showTips("检测到您的设备没有紧贴肌肤,请紧贴肌肤后重新尝试"); }); }; + look() { + let that = this; + // this.setState({ showEcharts: !this.state.showEcharts }); + let stop = 0; + let time = setInterval(function () { + stop++; + let random = Math.random(); + that.setState({ echartsData: random }); + if (stop >= 20) { + clearInterval(time); + } + }, 1000); + } + updata() {} // 绘制能量图 drawProwerPicture() {} @@ -2215,7 +2234,7 @@ class IotCarePlanFR200 extends Component { console.log("水分测试"); } else { go( - "/recoding/pages/face_report/face_report?id=" + + "/recording/pages/face_report/face_report?id=" + this.state.currentDevice.id ); } @@ -2380,6 +2399,10 @@ class IotCarePlanFR200 extends Component { TestModeStepIndex, currentVideoSrc, currentGear, + showEcharts, + echartsData, + isShowReReadRecordConnect, + currentServiceData, } = this.state; return ( @@ -2599,16 +2622,14 @@ class IotCarePlanFR200 extends Component { onModeLockOpen={this.onModeLockOpen} /> )} + + + + + {/* {(ActiveModeItem.modeType === "face" || - ActiveModeItem.modeType === "eyes") && ( - - - - )} */} - {/* - - */} + ActiveModeItem.modeType === "eyes") && } */} {(ActiveModeItem.modeType === "maskPenetration" || ActiveModeItem.modeType === "essence") && ( diff --git a/src/moduleIOT/pages/iotCarePlan/WL200.tsx b/src/moduleIOT/pages/iotCarePlan/WL200.tsx index b54a119..e9f56c2 100644 --- a/src/moduleIOT/pages/iotCarePlan/WL200.tsx +++ b/src/moduleIOT/pages/iotCarePlan/WL200.tsx @@ -1928,10 +1928,7 @@ class IotCarePlanWL200 extends Component { goFaceReport = () => { // 跳转前置空定时器,防止重复提交 if (currentTimeTimer) clearInterval(currentTimeTimer); - go( - "/recoding/pages/face_report/face_report?id=" + - this.state.currentDevice.id - ); + go("/recording/pages/face_report/face_report?id=" + this.state.currentDevice.id); }; // 完成配对 diff --git a/src/moduleIOT/pages/iotCarePlan/components/Echart/index.less b/src/moduleIOT/pages/iotCarePlan/components/Echart/index.less index d3a6450..ddcde5f 100644 --- a/src/moduleIOT/pages/iotCarePlan/components/Echart/index.less +++ b/src/moduleIOT/pages/iotCarePlan/components/Echart/index.less @@ -1,13 +1,41 @@ .box { width: 690rpx; height: 320rpx; - margin: 28rpx auto; + margin: 28rpx auto 150rpx; background-color: #fff; border-radius: 30rpx; padding: 35rpx 25rpx 25rpx 35rpx; box-sizing: border-box; position: relative; } + +.fullscreen { + position: fixed; + top: 450rpx; + left: -450rpx; + right: 0; + bottom: 0; + width: 100vh; + height: 100vw; + z-index: 9999; + background-color: rgba(0, 0, 0, 0.5); /* 背景色 */ + transform: rotate(90deg); + // animation: rotate 0s linear; +} + +@keyframes rotate { + from { + width: 690rpx; + height: 320rpx; + transform: rotate(0deg); + } + to { + width: 100vh; + height: 100vw; + transform: rotate(0deg); + } +} + .box_background { position: absolute; top: 0; @@ -29,6 +57,7 @@ position: absolute; top: 32rpx; right: 26rpx; + z-index: 2; } .line { margin: 0 0 6rpx 35rpx; diff --git a/src/moduleIOT/pages/iotCarePlan/components/Echart/index.tsx b/src/moduleIOT/pages/iotCarePlan/components/Echart/index.tsx index cb7e993..403ab82 100644 --- a/src/moduleIOT/pages/iotCarePlan/components/Echart/index.tsx +++ b/src/moduleIOT/pages/iotCarePlan/components/Echart/index.tsx @@ -2,25 +2,23 @@ import Taro from "@tarojs/taro"; import classnames from "classnames"; import { Block, View, Image, Text, Input } from "@tarojs/components"; import { Popup, Progress, Slider } from "@antmjs/vantui"; -import { useRef } from "react"; +import { useEffect, useRef, useState, useCallback } from "react"; import Echarts, { EChartOption, EchartsHandle } from "taro-react-echarts"; import echarts from "@/utils/echarts.min.js"; import "./index.less"; interface Props { - Electricity: any; - matrixElectricity: any; - facialMaskConnectStatus: any; + data: any } -function Index() { - +function Index({ data }: Props) { + const buttonRef = useRef(null); const echartsRef = useRef(null); - const option: EChartOption = { - + const [options, setOptions] = useState({ + animation: false, grid: { // 让图表占满容器 top: "28rpx", @@ -258,14 +256,82 @@ function Index() { }, }, ], - }; + }) const level = [8, 7, 6, 5, 4, 3, 2]; - const full = () => { - let box = document.getElementById("box"); - box?.classList.add('fullscreen') - } + const [newOptions, setNewOptions] = useState(options) + const [newData, setNewData] = useState(0) + const full = useCallback(() => { + // let box = document.getElementById("box"); + // box?.classList.add('fullscreen') + + + let stop = 0 + // let time = setInterval(function () { + // stop++ + let option = JSON.parse(JSON.stringify(options)) + let num = Math.floor(Math.random() * 9) + let count = 0 + options.series.map(item => { + if (item.type === 'line') { + item.data.splice(0, 1) + item.data.push(num) + } + if (item.type === 'bar') { + count++ + item.data.splice(0, 1) + if (count <= num) { + item.data.push(1) + } else { + item.data.push(0) + } + } + }) + console.log(option); + + // 更新图表数据 + setNewOptions(option) + // if (stop > 20) { + // clearInterval(time) + // } + // }, 1000) + }, [data]) + + + useEffect(() => { + setOptions(newOptions) + }, [newOptions]); + + useEffect(() => { + setNewData(data) + }, [data]); + + useEffect(() => { + let option = JSON.parse(JSON.stringify(options)) + let num = Math.floor(newData * 9) + let count = 0 + options.series.map(item => { + if (item.type === 'line') { + item.data.splice(0, 1) + item.data.push(num) + } + if (item.type === 'bar') { + count++ + item.data.splice(0, 1) + if (count <= num) { + item.data.push(1) + } else { + item.data.push(0) + } + } + }) + console.log(option, data); + + // 更新图表数据 + setNewOptions(option) + }, [newData]) + // 当 someProp 变化时执行 // const quanping = () => { // T.setPageOrientation({ // orientation: "portrait", @@ -278,20 +344,21 @@ function Index() { // }, + return ( - + 实时能量 {level.map((item) => ( diff --git a/src/recoding/pages/face_report/face_report.tsx b/src/recoding/pages/face_report/face_report.tsx index ddcaf71..c99f9fc 100644 --- a/src/recoding/pages/face_report/face_report.tsx +++ b/src/recoding/pages/face_report/face_report.tsx @@ -1,9 +1,9 @@ import Taro from "@tarojs/taro"; import classnames from "classnames"; import { Component, PropsWithChildren, useEffect, useState } from "react"; -import { Progress } from "@antmjs/vantui"; +import { Progress , Tab, Tabs, Dialog, Popup } from "@antmjs/vantui"; import { showModal } from "@/utils/traoAPI"; -import { Tab, Tabs, Dialog, Popup } from "@antmjs/vantui"; + import { Block, View, @@ -13,11 +13,11 @@ import { Button, Textarea, } from "@tarojs/components"; -import { date, getdates, previewImage } from "@/utils/util"; +import { date, getdates, previewImage } from "../../../utils/util"; /** 自定义组件 **/ -import Navbar from "@/components/navbar/navbar"; -import { InstrumentInfo } from "@/utils/Interface"; +import Navbar from "../../../components/navbar/navbar"; +import { InstrumentInfo } from "../../../utils/Interface"; /** 自定义组件 **/ import "./face_report.less"; @@ -295,25 +295,25 @@ export default class Index extends Component { } = this.state; return ( - - - - + + + + {statistics.nursingNum} - + - 本月护理天数 + 本月护理天数 - - {statistics.nursingTime} - 本月护理时间 + + {statistics.nursingTime} + 本月护理时间 {/* */} - - - - {recordData.createTime} + + + + {recordData.createTime} { {recordData.online == 1 ? "在线" : "离线"} - + - - - {recordData.instrumentName} - - 模式:{recordData.modeName} - + + + {recordData.instrumentName} + + 模式:{recordData.modeName} + 护理时间:{recordData.nursingTime} - + 完成度: { ? 100 : recordData.completionPercentage * 100 } - strokeWidth="12" - color="linearGradient(to right, #eecda1, #ffe9c7) !important" + strokeWidth='12' + color='linearGradient(to right, #eecda1, #ffe9c7) !important' /> - + {" "} {recordData.completionPercentage * 100 > 100 ? 100 @@ -360,11 +360,11 @@ export default class Index extends Component { - 历史记录 + 历史记录 {recordList.map((item) => ( - - - {item.createTime} + + + {item.createTime} { {item.online == 1 ? "在线" : "离线"} - + - - - {item.instrumentName} - - 模式:{item.modeName} - 护理时间:{item.nursingTime} + + + {item.instrumentName} + + 模式:{item.modeName} + 护理时间:{item.nursingTime} - + 完成度: { ? 100 : item.completionPercentage * 100 } - strokeWidth="12" - color="linearGradient(to right, #eecda1, #ffe9c7) !important" + strokeWidth='12' + color='linearGradient(to right, #eecda1, #ffe9c7) !important' /> - + {" "} {item.completionPercentage * 100 > 100 ? 100 @@ -412,75 +412,75 @@ export default class Index extends Component { ))} {reportShow ? ( - - + + 前往打卡 - + 跳过 - + ) : null} this.setState({ show: false })}> - + - 今日打卡 - + 今日打卡 + 本月您已打卡 - {clockStatistics[0]?.clockNum}{" "} + {clockStatistics[0]?.clockNum}{" "} 天,超越 - + {(clockStatistics[0]?.percentage * 100).toFixed(1)}% 花至用户 - + {punchInInfo.clockImageList.map((item, index) => ( - - + + ))} {punchInInfo.clockImageList.length < 3 && ( )} - - + + - + {"(" + (punchInInfo.clockContent.length || 0) + "/120)"} - - + + 确认提交 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 5203dd7..bae9395 100644 --- a/src/recoding/pages/moisture_test_report/moisture_test_report.tsx +++ b/src/recoding/pages/moisture_test_report/moisture_test_report.tsx @@ -1,5 +1,7 @@ import { Block, View, Text, Image, Input, Button } from "@tarojs/components"; import { Component, PropsWithChildren, useEffect, useState } from "react"; +import { go } from "@/utils/traoAPI"; +import { InstrumentInfo } from "@/utils/Interface"; import "taro-ui/dist/style/components/button.scss"; // 按需引入 import Taro from "@tarojs/taro"; @@ -12,7 +14,6 @@ import { setMobile } from "@/store/features/userInfo"; import Navbar from "@/components/navbar/navbar"; import Echarts from "./Echarts/index"; import "./moisture_test_report.less"; -import { go } from "@/utils/traoAPI"; class MoistureTestReport extends Component { constructor(props) { @@ -53,7 +54,11 @@ class MoistureTestReport extends Component { componentDidHide() { } onLoad(option) { + console.log(option.data); + let data = JSON.parse(option.data) + console.log(data); + let { reportData } = this.state reportData.curDate = option.date data.GearData.map(item => { @@ -72,9 +77,20 @@ class MoistureTestReport extends Component { reportData.shuifenGear.rightFace = gear } }) + this.setState({ reportData, modeId: option.modeId }); + this.moistureTest(option.id, reportData.curDate) } async initData() { } + async moistureTest(id, curDate) { + let data = { + queryDate: curDate, + instrumentId: id + } + let res = await InstrumentInfo.fr200.moistureTest(data); + + } + toIndex() { Taro.reLaunch({ url: "/pages/index/index" }); } diff --git a/src/recoding/pages/recording/recording.tsx b/src/recoding/pages/recording/recording.tsx index 2a3587d..ebe3396 100644 --- a/src/recoding/pages/recording/recording.tsx +++ b/src/recoding/pages/recording/recording.tsx @@ -299,8 +299,8 @@ export default class Recording extends Component { setStorageSync("instrument_detail", instrument); } }) - - if ([1,2,3,4,5].includes(item.jumpType)) { + + if ([1, 2, 3, 4, 5].includes(item.jumpType)) { this.One(item); } else if (item.jumpType === 0) { this.two(item); @@ -309,26 +309,26 @@ export default class Recording extends Component { } else { this.AllDevice(item); } - + // let report =false - // go("/pages/face_report/face_report?id=" + id + "&recordId=" + recordId+ "&report=" + report ); + // go("/recording/pages/face_report/face_report?id=" + id + "&recordId=" + recordId+ "&report=" + report ); } // 打开第一种类型 One = async (item) => { - + let report = false; - let nursingData=JSON.parse(item.nursingData) - let obj ={ - modeName:item.modeName, - data:nursingData + let nursingData = JSON.parse(item.nursingData) + let obj = { + modeName: item.modeName, + data: nursingData } - console.log("打开第一种类型", item,obj); + console.log("打开第一种类型", item, obj); go( "/recoding/pages/face_report_one/face_report_one?id=" + - item.id + - "&report=" + - report+ "&obj=" + - JSON.stringify(obj) + item.id + + "&report=" + + report + "&obj=" + + JSON.stringify(obj) ); }; // 打开第二种类型 @@ -337,7 +337,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}&modeId=${item.modeId}`); + go(`/recoding/pages/moisture_test_report/moisture_test_report?data=${item.nursingData}&date=${item.createTime}&modeId=${item.modeId}&id=${item.instrumentId}`); }; // 打开其他类型 AllDevice = async (item) => { diff --git a/src/utils/Interface.js b/src/utils/Interface.js index 185b282..8000548 100644 --- a/src/utils/Interface.js +++ b/src/utils/Interface.js @@ -415,6 +415,15 @@ export const InstrumentInfo = { }); }, }, + fr200:{ + // 查询用户FR200水分报告护理记录 + moistureTest: (data) => { + return Ajax({ + url: "/nursingLog/record/fr200/moistureTest" + paramsToUrlQueryString(data), + method: "get", + }); + }, + } }; //localhost:9204/instrument/getInstrumentInfoBySerial