diff --git a/src/pages/recording/recording.less b/src/pages/recording/recording.less index 05b752c..0133dc2 100644 --- a/src/pages/recording/recording.less +++ b/src/pages/recording/recording.less @@ -16,7 +16,7 @@ page { color: #666; padding: 0 32rpx; position: sticky; - top: 176rpx; + top: 174rpx; z-index: 9; } @@ -176,6 +176,7 @@ page { color: #999; } + // .instrument_item { // margin-top: 20rpx; // background: #ffffff; @@ -207,10 +208,10 @@ page { // text-align: center; // } -// .tag_active { -// background: #f8f8f8; -// color: #999; -// } +.tag_active { + background: #f8f8f8; + color: #999; +} // .report_btn { // font-size: 26rpx; @@ -527,8 +528,6 @@ page { .top-left { display: flex; .date { - width: 131rpx; - height: 22rpx; font-size: 28rpx; font-weight: bold; color: #000000; @@ -574,25 +573,29 @@ page { margin-right: 38rpx; } .bottom-right { - padding: 4rpx 0 3rpx; + display: flex; + flex-flow: column; + justify-content: space-between; + height: 140rpx; .title { font-size: 28rpx; font-family: PingFang SC; font-weight: bold; color: #000000; - margin-bottom: 10rpx; } .subtitle-box { display: flex; flex-flow: column; justify-content: space-between; - height: 65rpx; + // height: 65rpx; .subtitle { font-size: 24rpx; font-family: PingFang SC; font-weight: 500; color: #999999; - margin-top: 11rpx; + } + .subtitle:last-child{ + margin-top: 10rpx; } } } diff --git a/src/pages/recording/recording.tsx b/src/pages/recording/recording.tsx index 7c5c936..7e10dcb 100644 --- a/src/pages/recording/recording.tsx +++ b/src/pages/recording/recording.tsx @@ -3,7 +3,7 @@ import classnames from "classnames"; import { Component, PropsWithChildren, useEffect, useState } from "react"; import { Block, View, Text, Image, Input, Button, ScrollView, Picker } from "@tarojs/components"; - +import { go } from "@/utils/traoAPI"; import { Tab, Tabs } from "@antmjs/vantui"; /** 自定义组件 **/ @@ -11,6 +11,9 @@ import Navbar from "../../components/navbar/navbar"; import PopupAlert from "../../components/popup/popup-alert"; /** 自定义组件 **/ +import { InstrumentInfo } from '../../utils/Interface' +import { date, getdates, previewImage } from "../../utils/util"; + import "./recording.less"; export default class Recording extends Component { @@ -20,30 +23,125 @@ export default class Recording extends Component { name: "护理历程", current: 0, array: [1, 2, 3, 4, 5], + recordList: [], + bindingInstrumentList: [], + curIndex: null, + clockStatistics: [], + statistics:[], + year:new Date().getFullYear(), + today: new Date() }; } - async onLoad() { } + + + componentDidMount() { } componentWillUnmount() { } + 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 getBindingInstrumentList() { + let res = await InstrumentInfo.bindingInstrumentList() + if (res.data.code === 200) { + this.setState({ bindingInstrumentList: res.data.data }) + } + } + + async getRecord(id) { + let data = {} + if (id != null) { + data['instrumentId'] = id + } + let res = await InstrumentInfo.nursingLog.getRecord(data) + if (res.data.code === 200) { + res.data.rows.map(item => { + item.nursingTime = this.getTime(item.nursingTime) + item.createTime = getdates(item.createTime).replace(/-/g, '.') + }) + this.setState({ recordList: res.data.rows }) + } + } + + /**分页获取用户的打卡记录 page size*/ + async getClockStatistics(year=this.state.year) { + let res = await InstrumentInfo.clock.getClockStatistics({year}) + if (res.data.code === 200) { + res.data.data.reverse() + res.data.data.map(item=>{ + item.isMore = false + }) + this.setState({ clockStatistics: res.data.data }) + } + } + // 查询用户护理记录的当月统计信息 + async getStatistics(id) { + let data = {} + if (id != null) { + data['instrumentId'] = id + } + let res = await InstrumentInfo.nursingLog.getStatistics(data) + // if (res.data.code === 200) { + + // this.setState({ statistics: res.data.rows }) + // } + } + + onChangeProduct(id) { + this.setState({ curIndex: id }) + this.getRecord(id) + }; + + onChangeMore(id){ + this.state.clockStatistics.map(item=>{ + if(item.id === id){ + item.isMore = !item.isMore + } + }) + this.setState({ clockStatistics:this.state.clockStatistics}) + } + + async onLoad() { + this.getRecord(null) + this.getBindingInstrumentList() + } + componentDidShow() { } componentDidHide() { } async initData() { } - onChangeYear() { } + onChangeYear(event) { + this.setState({ year: event.detail.value}) + this.getClockStatistics(event.detail.value) + } onTab = async (event) => { const { current } = event.currentTarget.dataset; - console.log("current", current); this.setState({ current }); + if (current === 1) { + this.getClockStatistics() + } }; + toReport() { + go("/pages/face_report/face_report"); + } + render() { - let { current, array, name } = this.state; + let { current, array, name, recordList, bindingInstrumentList, curIndex, clockStatistics,statistics,year,today } = this.state; return ( @@ -68,16 +166,24 @@ export default class Recording extends Component { {current === 0 && - 全部 - - - - 画质抗老射频仪 + 全部 + {bindingInstrumentList.map((item: any, index: any) => ( + + + 画质抗老射频仪 + + ))} } {current === 0 && @@ -94,7 +200,7 @@ export default class Recording extends Component { )} {current === 0 && ( - + {/* @@ -122,38 +228,42 @@ export default class Recording extends Component { */} - - {array.map((item: any, index: any) => ( - - - - 2024.1.31 - 在线 - - - 回看报告 - + + {recordList.map((item: any, index: any) => ( + + + + {item.createTime} + {item.online ? '在线' : '离线'} + + + 回看报告 + + - - - - - 小紫单智能射频仪 - - 模式:基础场景版 - 护理时间:15分00秒 + + + + {item.instrumentName} + + 模式:{item.modeName} + 护理时间:{item.nursingTime} + - - ))} + ))} + )} {current === 1 && ( - + {/* { 年度打卡统计 - + - 2024年 + {year}年 @@ -182,39 +292,47 @@ export default class Recording extends Component { - - - 2024年1月 - - 展开更多 - - - - - - - 10 - 本月打卡天数 - - - 80% - 超越花至用户 + {clockStatistics.map(item => ( + + + {item.year}年{item.month}月 + + {!item.isMore ? '展开更多' : '收起更多'} + + + + + + + {item.clockNum} + 本月打卡天数 + + + {item.percentage*100}% + 超越花至用户 + + + + { item.isMore&& + + + + 2024.5.23 + + + + 小紫弹智能射频仪、花至抗老射频仪PRO + 护理心得:真棒真棒真棒真棒真棒真棒真棒真棒真棒真棒 + + + } - - - - - 2024.5.23 - - - - 小紫弹智能射频仪、花至抗老射频仪PRO - 护理心得:真棒真棒真棒真棒真棒真棒真棒真棒真棒真棒 - - + )) + } + )}