diff --git a/src/components/popup/popup-clock.tsx b/src/components/popup/popup-clock.tsx index 01f0623..4a42169 100644 --- a/src/components/popup/popup-clock.tsx +++ b/src/components/popup/popup-clock.tsx @@ -47,16 +47,7 @@ export default class PopupClock extends Component { onConfirm = () => { let { type } = this.props; - switch (type) { - case "1": // 未注册 - go("/pages/register/register"); - break; - case "2": // 登录过期 - go("/pages/login/login"); - break; - case "3": // 前端提示-关注公众号 - break; - } + this.props.confirm(); }; diff --git a/src/pages/face_report/face_report.tsx b/src/pages/face_report/face_report.tsx index e5c4cb1..420f567 100644 --- a/src/pages/face_report/face_report.tsx +++ b/src/pages/face_report/face_report.tsx @@ -1,10 +1,11 @@ import Taro from "@tarojs/taro"; -import classNamenames from "classNamenames"; - +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"; @@ -18,7 +19,9 @@ export default class Index extends Component { super(props); this.state = { name: "template模板页", - + statistics: {}, + recordList: [], + recordData: {} }; } @@ -26,10 +29,60 @@ export default class Index extends Component { 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) { + let data = {} + if (id != null) { + data['instrumentId'] = id + } + let res = await InstrumentInfo.apiNursingLog.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, '.') + if (item.id == recordId) { + this.setState({ recordData: item }) + } + }) + this.setState({ recordList: res.data.rows.filter(item => item.id != recordId) }) + } + } - async onLoad() { - this.getClockStatistics() + 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() { } @@ -39,7 +92,7 @@ export default class Index extends Component { async initData() { } render() { - let { name } = this.state; + let { name, statistics, recordList, recordData } = this.state; return ( @@ -71,7 +124,7 @@ export default class Index extends Component { {/* */} - 8 + {statistics.nursingNum} @@ -79,7 +132,7 @@ export default class Index extends Component { - 28:00 + {statistics.nursingTime} 本月护理时间 {/* */} @@ -88,55 +141,63 @@ export default class Index extends Component { {/* */} - 2024.01.15 - 在线 + {recordData.createTime} + {recordData.online == 1 ? '在线' : '离线'} - + - 光能厂美侧板 + {recordData.instrumentName} - 模式:维护修复 - 护理时间:10:00 + 模式:{recordData.modeName} + 护理时间:{recordData.nursingTime} 完成度: - - 80% + + {recordData.completionPercentage * 100}% 历史记录 - - - 2024.01.01 - 在线 - - - - - - 光能厂美侧板 - - 模式:维护修复 - 护理时间:10:00 + {recordList.map(item => ( + + + {item.createTime} + {item.online == 1 ? '在线' : '离线'} + + + + + + {item.instrumentName} + + 模式:{item.modeName} + 护理时间:{item.nursingTime} + + + + 完成度: + + {item.completionPercentage * 100}% - - - 完成度: - - 80% + ))} - {/* */} {/* */} - + {/* 2024.01.01 在线 @@ -159,8 +220,8 @@ export default class Index extends Component { - - 历史记录 + */} + {/* 历史记录 2024.01.01 @@ -183,7 +244,7 @@ export default class Index extends Component { - + */} {/* */} @@ -191,7 +252,7 @@ export default class Index extends Component { 前往打卡 跳过 - + diff --git a/src/pages/instrumentClickinUpload/index.less b/src/pages/instrumentClickinUpload/index.less index 71efa07..b99d5e6 100644 --- a/src/pages/instrumentClickinUpload/index.less +++ b/src/pages/instrumentClickinUpload/index.less @@ -209,31 +209,29 @@ page { .info1, .info2 { .block1 { - // width: 300rpx; - // height: 160rpx; flex-direction: column; display: inline-block; height: 100%; text-align: center; .block1_1 { height: 100%; - padding: 0 20rpx; flex-direction: column; + width: 134rpx; } } .info1_img { width: 140rpx; height: 140rpx; - margin-right: 10rpx; border-radius: 20rpx; overflow: hidden; + margin-left: 6rpx; image { width: 100%; height: 100%; } } .tip1 { - margin-top: 33rpx; + margin-top: 20rpx; font-size: 26rpx; font-weight: bold; color: #000000; @@ -242,20 +240,20 @@ page { font-size: 24rpx; font-weight: 400; color: #666666; - margin-top: 15rpx; + margin-top: 8rpx; } .quan1 { border-radius: 50%; border: 3rpx solid #f1f1f1; width: 30rpx; height: 30rpx; - margin-top: 21rpx; + margin-top: 15rpx; &.is-select { display: flex; background-color: #fff; border-color: #fff; align-items: center; - justify-content: center; + justify-content: center; } .quan2 { border-radius: 50%; @@ -270,6 +268,13 @@ page { } } +.modebox { + height: 160rpx; + border-radius: 30rpx; + padding: 10rpx; + box-sizing: border-box; +} + .popbox { display: flex; flex-direction: column; diff --git a/src/pages/instrumentClickinUpload/index.tsx b/src/pages/instrumentClickinUpload/index.tsx index 72d2777..e9dd58f 100644 --- a/src/pages/instrumentClickinUpload/index.tsx +++ b/src/pages/instrumentClickinUpload/index.tsx @@ -20,11 +20,13 @@ import PopupInstrumentUploadTips from "@/components/popup/popup-instrument-uploa import { InstrumentInfo } from "@/utils/Interface"; -import "./index.less"; import { contraction, getImgInfo } from "@/utils/compressImage"; import PopupAlert from "@/components/popup/popup-alert"; import { setStorageSync, getStorageSync, msg } from "@/utils/traoAPI"; +import "./index.less"; + + export default class InstrumentClickInUpload extends Component { constructor(props) { super(props); @@ -34,11 +36,11 @@ export default class InstrumentClickInUpload extends Component { month: String(new Date().getMonth() + 1).padStart(2, "0"), day: String(new Date().getDate()).padStart(2, "0"), zkmoshiindex: 0, - moshiindex: null, - buzhouindex: null, - autoplay: false, + modeIndex: null, + stepIndex: null, + autoPlay: false, scrollleft: 0, - sysinfo: Taro.getSystemInfoSync(), + sysInfo: Taro.getSystemInfoSync(), showVideoPlayBtn: true, duration: 0, @@ -87,10 +89,13 @@ export default class InstrumentClickInUpload extends Component { this.setState({ instrumentDetail }); } + const searchParams = new URLSearchParams(window.location.search); + const id = searchParams.get('id'); + setTimeout(() => { this.firstNurseInfo(); this.getLatestClockRecord(); - this.modeInfoList(); + this.modeInfoList(id); }, 10); } @@ -121,7 +126,7 @@ export default class InstrumentClickInUpload extends Component { this.setState({ punchInInfo }); }; // 获取仪器模式列表 - modeInfoList = async () => { + modeInfoList = async (id) => { let res = await InstrumentInfo.modeInfoList({ instrumentId: "84", }); @@ -287,116 +292,124 @@ export default class InstrumentClickInUpload extends Component { nurseInfo, isModeLock, isSubmit, + year, + month, + day, + modeIndex, + stepIndex, + autoPlay, + sysInfo, + clockContent, } = this.state; return ( - + - - + + - + {modeInfo.map((item, index) => { return ( - + - {item.modeName} - {item.modeDesc} + {item.modeName} + {item.modeDesc} {!item.lock && zkmoshiindex !== index && ( - + )} {!item.lock && zkmoshiindex == index && ( - - + + )} {item.lock && ( - + )} - {item.modeBanner && ( - - + {item.modeBanner && index == zkmoshiindex &&( + + )} @@ -406,32 +419,32 @@ export default class InstrumentClickInUpload extends Component { - - - - - 打卡上传 - + + + + + 打卡上传 + - + {punchInInfo.clockImageList.length > 0 && punchInInfo.clockImageList.map((item, index) => { return ( - + @@ -440,23 +453,23 @@ export default class InstrumentClickInUpload extends Component { {punchInInfo.clockImageList.length < 3 && ( )} - + {/* {tipshow && ( @@ -465,7 +478,7 @@ export default class InstrumentClickInUpload extends Component { : "请记录一下今天打卡的心得吧~"} )} */} - + {punchInInfo.clockContent.length}/100 @@ -473,16 +486,16 @@ export default class InstrumentClickInUpload extends Component { - + {!isSubmit && ( - - 提交打卡 + + 提交打卡 )} {isSubmit && ( - - 提交打卡 + + 提交打卡 )} diff --git a/src/pages/recording/recording.less b/src/pages/recording/recording.less index 0133dc2..c949161 100644 --- a/src/pages/recording/recording.less +++ b/src/pages/recording/recording.less @@ -18,7 +18,6 @@ page { position: sticky; top: 174rpx; z-index: 9; - } .tab { @@ -176,7 +175,6 @@ page { color: #999; } - // .instrument_item { // margin-top: 20rpx; // background: #ffffff; @@ -472,6 +470,28 @@ page { border-radius: 45rpx; } +.footer { + position: fixed; + z-index: 99; + bottom: 0; + width: 100%; + height: 153rpx; + box-shadow: 0rpx -3rpx 7rpx 1rpx rgba(173, 191, 207, 0.21); + background: #ffffff; +} + +.btn { + width: 690rpx; + height: 90rpx; + background: #000000; + border-radius: 45rpx; + color: #fff; + text-align: center; + line-height: 90rpx; + font-weight: bold; + font-size: 32rpx; + margin: 0 auto; +} // .empty { // display: flex; // flex-direction: column; @@ -594,7 +614,7 @@ page { font-weight: 500; color: #999999; } - .subtitle:last-child{ + .subtitle:last-child { margin-top: 10rpx; } } diff --git a/src/pages/recording/recording.tsx b/src/pages/recording/recording.tsx index 7e10dcb..9b59cc7 100644 --- a/src/pages/recording/recording.tsx +++ b/src/pages/recording/recording.tsx @@ -4,11 +4,11 @@ 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"; +import { Tab, Tabs, Dialog } from "@antmjs/vantui"; /** 自定义组件 **/ import Navbar from "../../components/navbar/navbar"; -import PopupAlert from "../../components/popup/popup-alert"; +import PopupClock from "../../components/popup/popup-clock"; /** 自定义组件 **/ import { InstrumentInfo } from '../../utils/Interface' @@ -27,15 +27,27 @@ export default class Recording extends Component { bindingInstrumentList: [], curIndex: null, clockStatistics: [], - statistics:[], - year:new Date().getFullYear(), - today: new Date() + statistics: [], + year: new Date().getFullYear(), + today: new Date(), + monthTime: [ + { month: 1, time: 0 }, + { month: 2, time: 0 }, + { month: 3, time: 0 }, + { month: 4, time: 0 }, + { month: 5, time: 0 }, + { month: 6, time: 0 }, + { month: 7, time: 0 }, + { month: 8, time: 0 }, + { month: 9, time: 0 }, + { month: 10, time: 0 }, + { month: 11, time: 0 }, + { month: 12, time: 0 }, + ], + show:true }; } - - - componentDidMount() { } componentWillUnmount() { } @@ -64,52 +76,93 @@ export default class Recording extends Component { if (id != null) { data['instrumentId'] = id } - let res = await InstrumentInfo.nursingLog.getRecord(data) + let res = await InstrumentInfo.apiNursingLog.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 }) } } + async addLog() { + let data = { + instrumentId: 57, + instrumentName: "0130验收FR100", + online: 1, + modeId: 100, + modeName: "护理记录测试", + nursingTime: "00:15:00" + } + + let res = await InstrumentInfo.apiNursingLog.addLog(data) + if (res.data.code === 200) { + } + } + /**分页获取用户的打卡记录 page size*/ - async getClockStatistics(year=this.state.year) { - let res = await InstrumentInfo.clock.getClockStatistics({year}) + async getClockStatistics(year = this.state.year) { + let res = await InstrumentInfo.apiClock.getClockStatistics({ year }) if (res.data.code === 200) { res.data.data.reverse() - res.data.data.map(item=>{ - item.isMore = false - }) + if (res.data.data.length > 0) { + res.data.data.map((item, index) => { + item.isMore = false + if (index === 0) { + item.isMore = true + } + this.state.monthTime.map(monthItem => { + if (monthItem.month == item.month) { + monthItem.time = item.clockNum + } + }) + }) + this.setState({ monthTime: this.state.monthTime }) + } else { + let monthTime = [ + { month: 1, time: 0 }, + { month: 2, time: 0 }, + { month: 3, time: 0 }, + { month: 4, time: 0 }, + { month: 5, time: 0 }, + { month: 6, time: 0 }, + { month: 7, time: 0 }, + { month: 8, time: 0 }, + { month: 9, time: 0 }, + { month: 10, time: 0 }, + { month: 11, time: 0 }, + { month: 12, time: 0 }, + ] + this.setState({ monthTime }) + } 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 }) - // } + + setShow(show: boolean){ + this.setState({show}) + } + + closeAlert(){ + this.setShow(false) } onChangeProduct(id) { this.setState({ curIndex: id }) this.getRecord(id) + // this.addLog() }; - onChangeMore(id){ - this.state.clockStatistics.map(item=>{ - if(item.id === id){ + onChangeMore(id) { + this.state.clockStatistics.map(item => { + if (item.id === id) { item.isMore = !item.isMore } }) - this.setState({ clockStatistics:this.state.clockStatistics}) + this.setState({ clockStatistics: this.state.clockStatistics }) } async onLoad() { @@ -124,9 +177,9 @@ export default class Recording extends Component { async initData() { } onChangeYear(event) { - this.setState({ year: event.detail.value}) + this.setState({ year: event.detail.value }) this.getClockStatistics(event.detail.value) - } + } onTab = async (event) => { const { current } = event.currentTarget.dataset; @@ -136,12 +189,12 @@ export default class Recording extends Component { } }; - toReport() { - go("/pages/face_report/face_report"); + toReport(id, recordId) { + go("/pages/face_report/face_report?id=" + id + "&recordId=" + recordId); } render() { - let { current, array, name, recordList, bindingInstrumentList, curIndex, clockStatistics,statistics,year,today } = this.state; + let { current, array, name, recordList, bindingInstrumentList, curIndex, clockStatistics, statistics, year, today, monthTime,show } = this.state; return ( @@ -235,11 +288,11 @@ export default class Recording extends Component { {item.createTime} {item.online ? '在线' : '离线'} - + 回看报告 @@ -283,60 +336,85 @@ export default class Recording extends Component { - - 5天 - - 1 - + { + monthTime.map(item => ( + + { + item.time > 0 && {item.time}天 + } + + {item.month} + + )) + } + {clockStatistics.map(item => ( - - - {item.year}年{item.month}月 - - {!item.isMore ? '展开更多' : '收起更多'} - - + + + {item.year}年{item.month}月 + + {!item.isMore ? '展开更多' : '收起更多'} + - - - - {item.clockNum} - 本月打卡天数 - - - {item.percentage*100}% - 超越花至用户 - - + + + + + {item.clockNum} + 本月打卡天数 + + + {item.percentage * 100}% + 超越花至用户 - { item.isMore&& + + + {item.isMore && - - - 2024.5.23 - - + + + 2024.5.23 + + + + 小紫弹智能射频仪、花至抗老射频仪PRO + 护理心得:真棒真棒真棒真棒真棒真棒真棒真棒真棒真棒 - 小紫弹智能射频仪、花至抗老射频仪PRO - 护理心得:真棒真棒真棒真棒真棒真棒真棒真棒真棒真棒 - - } - - )) + } + + )) } )} + + 前往打卡 + + + + + + ); } -} +}