import Taro from "@tarojs/taro"; import classnames from "classnames"; import { Component, PropsWithChildren, useEffect, useState } from "react"; import { Progress } from "@antmjs/vantui"; import { Block, View, Text, Image, Input, Button } from "@tarojs/components"; import { date, getdates, previewImage } from "../../utils/util"; /** 自定义组件 **/ import Navbar from "../../components/navbar/navbar"; import PopupAlert from "../../components/popup/popup-alert"; import { InstrumentInfo } from "../../utils/Interface"; /** 自定义组件 **/ import "./face_report.less"; export default class Index extends Component { constructor(props) { super(props); this.state = { name: "template模板页", statistics: {}, recordList: [], recordData: {}, }; } componentDidMount() {} componentWillUnmount() {} // 查询用户护理记录的当月统计信息 async getStatistics(id) { let data = {}; if (id != null) { data["instrumentId"] = id; } let res = await InstrumentInfo.apiNursingLog.getStatistics(data); if (res.data.code === 200) { this.setState({ statistics: res.data.data }); } } async getRecord(id, recordId) { console.log("id, recordId", id, recordId); let data = {}; if (id != null) { data["instrumentId"] = id; } let res = await InstrumentInfo.apiNursingLog.getRecord(data); if (res.data.code === 200) { if (recordId) { res.data.rows.map((item) => { item.nursingTime = this.getTime(item.nursingTime); item.createTime = getdates(item.createTime).replace(/-/g, "."); if (item.id == recordId) { this.setState({ recordData: item }); } }); } else { this.setState({ recordData: res.data.rows[0] }); } this.setState({ recordList: res.data.rows.filter((item) => item.id != recordId), }); } } getRouteId() { const searchParams = new URLSearchParams(window.location.search); const id = searchParams.get("id"); const recordId = searchParams.get("recordId"); this.getStatistics(id); this.getRecord(id, recordId); console.log(recordId); } getTime(time) { const hour = time.slice(0, 2); const minute = time.slice(3, 5); const second = time.slice(6, 8); if (hour > 0) { return hour + "时" + minute + "分" + second + "秒"; } else { return minute + "分" + second + "秒"; } } async onLoad() { this.getRouteId(); } componentDidShow() {} componentDidHide() {} async initData() {} GoIndex = () => { Taro.switchTab({ url: "/pages/index/index" }); }; render() { let { name, statistics, recordList, recordData } = this.state; return ( {statistics.nursingNum} 本月护理天数 {statistics.nursingTime} 本月护理时间 {/* */} {recordData.createTime} {recordData.online == 1 ? "在线" : "离线"} {recordData.instrumentName} 模式:{recordData.modeName} 护理时间:{recordData.nursingTime} 完成度: 100 ? 100 : recordData.completionPercentage * 100 } strokeWidth="12" color="linearGradient(to right, #eecda1, #ffe9c7) !important" /> {" "} {recordData.completionPercentage * 100 > 100 ? 100 : recordData.completionPercentage * 100} % 历史记录 {recordList.map((item) => ( {item.createTime} {item.online == 1 ? "在线" : "离线"} {item.instrumentName} 模式:{item.modeName} 护理时间:{item.nursingTime} 完成度: 100 ? 100 : item.completionPercentage * 100 } strokeWidth="12" color="linearGradient(to right, #eecda1, #ffe9c7) !important" /> {" "} {item.completionPercentage * 100 > 100 ? 100 : item.completionPercentage * 100} % ))} 前往打卡 跳过 ); } }