From 62d2afa966346396bff49036d798ccb47eccd15e Mon Sep 17 00:00:00 2001 From: rongweikang <1174906669@qq.com> Date: Wed, 20 Mar 2024 15:02:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=A0=B7=E5=BC=8F=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/recoding/pages/recording/recording.less | 3 - src/recoding/pages/recording/recording.tsx | 220 +++++++++++--------- 2 files changed, 127 insertions(+), 96 deletions(-) diff --git a/src/recoding/pages/recording/recording.less b/src/recoding/pages/recording/recording.less index 84197bb..97997b0 100644 --- a/src/recoding/pages/recording/recording.less +++ b/src/recoding/pages/recording/recording.less @@ -16,7 +16,6 @@ page { color: #666; padding: 0 32rpx; position: sticky; - top: 174rpx; z-index: 9; } @@ -74,8 +73,6 @@ page { background: #f8f8f8; padding-top: 25rpx; padding-bottom: 29rpx; - position: sticky; - top: 286rpx; z-index: 9; } diff --git a/src/recoding/pages/recording/recording.tsx b/src/recoding/pages/recording/recording.tsx index 676d707..8a42d8f 100644 --- a/src/recoding/pages/recording/recording.tsx +++ b/src/recoding/pages/recording/recording.tsx @@ -61,6 +61,8 @@ export default class Recording extends Component { clockImageList: [], clockContent: "", }, + navigationBarHeight: '', + statusBarHeight: '' }; } @@ -267,13 +269,16 @@ export default class Recording extends Component { this.getLatestClockRecord(); this.getClockStatistics(); this.DayTime(); + this.setStatusBar(); + } componentDidShow() { } componentDidHide() { } - async initData() { } + async initData() { + } // 选择年份 onChangeYear(event) { this.setState({ year: event.detail.value }); @@ -407,6 +412,25 @@ export default class Recording extends Component { delta: 1, }); } + + setStatusBar() { + + Taro.getSystemInfoAsync({ + success: (res) => { + const statusBarHeight = res.statusBarHeight || 0; + // 获取微信胶囊的位置信息 width,height,top,right,left,bottom + const custom = Taro.getMenuButtonBoundingClientRect(); + // 导航栏高度(标题栏高度) = 胶囊高度 + (顶部距离 - 状态栏高度) * 2 + const navigationBarHeight = + custom.height + (custom.top - statusBarHeight) * 2; + this.setState({ + statusBarHeight, + navigationBarHeight, + }); + }, + }); + } + render() { let { current, @@ -424,12 +448,19 @@ export default class Recording extends Component { monthTime, show, punchInInfo, + navigationBarHeight, + statusBarHeight } = this.state; - + const statusBarHeightRpx = statusBarHeight * 2; + const navigationBarHeightRpx = navigationBarHeight * 2; + const height = statusBarHeightRpx + navigationBarHeightRpx return ( - - + + { {current === 0 && ( - + { onClick={this.onChangeProduct.bind(this, item.id)} > - {item.name} + {item.name} ))} @@ -480,17 +514,17 @@ export default class Recording extends Component { {current === 0 && recordList.length === 0 && ( - + - 暂无数据 + 暂无数据 )} {current === 0 && ( - + {/* @@ -517,12 +551,12 @@ export default class Recording extends Component { */} - + {recordList.map((item: any, index: any) => ( - - - - {item.createTime} + + + + {item.createTime} { {item.instrumentType === 2 && ( { > 回看报告 )} - + - - {item.instrumentName} - - 模式:{item.modeName} - + + {item.instrumentName} + + 模式:{item.modeName} + 护理时间:{item.nursingTime} @@ -571,7 +605,7 @@ export default class Recording extends Component { )} {current === 1 && ( - + {/* { > 暂无数据 */} - - - - 年度打卡统计 + + + + 年度打卡统计 - + {year}年 - + {monthTime.map((item) => ( - + {item.time > 0 && ( - {item.time}天 + {item.time}天 )} - {item.month} + {item.month} ))} - - + + {clockStatistics.map((item) => ( - - - + + + {item.year}年{item.month}月 { item.month )} > - + {" "} {!item.isMore ? "展开更多" : "收起更多"} @@ -642,51 +676,51 @@ export default class Recording extends Component { ? "rotate(180deg)" : "rotate(0deg)", }} - className="more_icon" + className='more_icon' src={require("@/img/arrow-down.png")} - mode="widthFix" + mode='widthFix' > - - - - {item.clockNum} - 本月打卡天数 + + + + {item.clockNum} + 本月打卡天数 - - + + {(item.percentage * 100).toFixed(2)}% - 超越花至用户 + 超越花至用户 - + {item.isMore && item.detail && ( {item.detail.map((obj) => ( - - - + + + {obj.updateTime} - + {obj.clockImg.map((img) => ( ))} - + {/* 小紫弹智能射频仪、花至抗老射频仪PRO{" "} */} {obj.instrumentName === null ? "" : obj.instrumentName} - + {obj.clockContent} @@ -701,8 +735,8 @@ export default class Recording extends Component { )} {!clockShow && ViewAddInstrument === "true" && ( - - + + 前往打卡 {/* @@ -712,64 +746,64 @@ export default class Recording extends Component { )} 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)"} - - + + 确认提交