From afa602dff9ccfdd76f711c60a8ce388509fe689d Mon Sep 17 00:00:00 2001 From: 17792275749 <812100002@qq.com> Date: Wed, 13 May 2026 11:19:32 +0800 Subject: [PATCH] =?UTF-8?q?[AI=20Generated]:=20refactor(Views):=20?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=B5=8B=E9=87=8F=E6=8A=A5=E5=91=8A=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E7=BB=93=E6=9E=84=E4=B8=8E=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../navigation-bar/navigation-bar.json | 5 - .../navigation-bar/navigation-bar.less | 96 ------------- .../navigation-bar/navigation-bar.ts | 105 --------------- .../navigation-bar/navigation-bar.wxml | 64 --------- .../measurementReport/measurementReport.less | 127 ++++++++++++------ .../measurementReport/measurementReport.ts | 22 ++- .../measurementReport/measurementReport.wxml | 42 +++--- 7 files changed, 116 insertions(+), 345 deletions(-) delete mode 100644 miniprogram/components/navigation-bar/navigation-bar.json delete mode 100644 miniprogram/components/navigation-bar/navigation-bar.less delete mode 100644 miniprogram/components/navigation-bar/navigation-bar.ts delete mode 100644 miniprogram/components/navigation-bar/navigation-bar.wxml diff --git a/miniprogram/components/navigation-bar/navigation-bar.json b/miniprogram/components/navigation-bar/navigation-bar.json deleted file mode 100644 index 4a20f17..0000000 --- a/miniprogram/components/navigation-bar/navigation-bar.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "component": true, - "styleIsolation": "apply-shared", - "usingComponents": {} -} \ No newline at end of file diff --git a/miniprogram/components/navigation-bar/navigation-bar.less b/miniprogram/components/navigation-bar/navigation-bar.less deleted file mode 100644 index 8bd379e..0000000 --- a/miniprogram/components/navigation-bar/navigation-bar.less +++ /dev/null @@ -1,96 +0,0 @@ -.weui-navigation-bar { - --weui-FG-0:rgba(0,0,0,.9); - --height: 44px; - --left: 16px; -} -.weui-navigation-bar .android { - --height: 48px; -} - -.weui-navigation-bar { - overflow: hidden; - color: var(--weui-FG-0); - flex: none; -} - -.weui-navigation-bar__inner { - position: relative; - top: 0; - left: 0; - height: calc(var(--height) + env(safe-area-inset-top)); - display: flex; - flex-direction: row; - align-items: center; - justify-content: center; - padding-top: env(safe-area-inset-top); - width: 100%; - box-sizing: border-box; -} - -.weui-navigation-bar__left { - position: relative; - padding-left: var(--left); - display: flex; - flex-direction: row; - align-items: flex-start; - height: 100%; - box-sizing: border-box; -} - -.weui-navigation-bar__btn_goback_wrapper { - padding: 11px 18px 11px 16px; - margin: -11px -18px -11px -16px; -} - -.weui-navigation-bar__btn_goback_wrapper.weui-active { - opacity: 0.5; -} - -.weui-navigation-bar__btn_goback { - font-size: 12px; - width: 12px; - height: 24px; - -webkit-mask: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='24' viewBox='0 0 12 24'%3E %3Cpath fill-opacity='.9' fill-rule='evenodd' d='M10 19.438L8.955 20.5l-7.666-7.79a1.02 1.02 0 0 1 0-1.42L8.955 3.5 10 4.563 2.682 12 10 19.438z'/%3E%3C/svg%3E") no-repeat 50% 50%; - mask: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='24' viewBox='0 0 12 24'%3E %3Cpath fill-opacity='.9' fill-rule='evenodd' d='M10 19.438L8.955 20.5l-7.666-7.79a1.02 1.02 0 0 1 0-1.42L8.955 3.5 10 4.563 2.682 12 10 19.438z'/%3E%3C/svg%3E") no-repeat 50% 50%; - -webkit-mask-size: cover; - mask-size: cover; - background-color: var(--weui-FG-0); -} - -.weui-navigation-bar__center { - font-size: 17px; - text-align: center; - position: relative; - display: flex; - flex-direction: row; - align-items: center; - justify-content: center; - font-weight: bold; - flex: 1; - height: 100%; -} - -.weui-navigation-bar__loading { - margin-right: 4px; - align-items: center; -} - -.weui-loading { - font-size: 16px; - width: 16px; - height: 16px; - display: block; - background: transparent url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg width='80px' height='80px' viewBox='0 0 80 80' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Ctitle%3Eloading%3C/title%3E%3Cdefs%3E%3ClinearGradient x1='94.0869141%25' y1='0%25' x2='94.0869141%25' y2='90.559082%25' id='linearGradient-1'%3E%3Cstop stop-color='%23606060' stop-opacity='0' offset='0%25'%3E%3C/stop%3E%3Cstop stop-color='%23606060' stop-opacity='0.3' offset='100%25'%3E%3C/stop%3E%3C/linearGradient%3E%3ClinearGradient x1='100%25' y1='8.67370605%25' x2='100%25' y2='90.6286621%25' id='linearGradient-2'%3E%3Cstop stop-color='%23606060' offset='0%25'%3E%3C/stop%3E%3Cstop stop-color='%23606060' stop-opacity='0.3' offset='100%25'%3E%3C/stop%3E%3C/linearGradient%3E%3C/defs%3E%3Cg stroke='none' stroke-width='1' fill='none' fill-rule='evenodd' opacity='0.9'%3E%3Cg%3E%3Cpath d='M40,0 C62.09139,0 80,17.90861 80,40 C80,62.09139 62.09139,80 40,80 L40,73 C58.2253967,73 73,58.2253967 73,40 C73,21.7746033 58.2253967,7 40,7 L40,0 Z' fill='url(%23linearGradient-1)'%3E%3C/path%3E%3Cpath d='M40,0 L40,7 C21.7746033,7 7,21.7746033 7,40 C7,58.2253967 21.7746033,73 40,73 L40,80 C17.90861,80 0,62.09139 0,40 C0,17.90861 17.90861,0 40,0 Z' fill='url(%23linearGradient-2)'%3E%3C/path%3E%3Ccircle id='Oval' fill='%23606060' cx='40.5' cy='3.5' r='3.5'%3E%3C/circle%3E%3C/g%3E%3C/g%3E%3C/svg%3E%0A") no-repeat; - background-size: 100%; - margin-left: 0; - animation: loading linear infinite 1s; -} - -@keyframes loading { - from { - transform: rotate(0); - } - to { - transform: rotate(360deg); - } -} diff --git a/miniprogram/components/navigation-bar/navigation-bar.ts b/miniprogram/components/navigation-bar/navigation-bar.ts deleted file mode 100644 index 4466e8e..0000000 --- a/miniprogram/components/navigation-bar/navigation-bar.ts +++ /dev/null @@ -1,105 +0,0 @@ -Component({ - options: { - multipleSlots: true // 在组件定义时的选项中启用多slot支持 - }, - /** - * 组件的属性列表 - */ - properties: { - extClass: { - type: String, - value: '' - }, - title: { - type: String, - value: '' - }, - background: { - type: String, - value: '' - }, - color: { - type: String, - value: '' - }, - back: { - type: Boolean, - value: true - }, - loading: { - type: Boolean, - value: false - }, - homeButton: { - type: Boolean, - value: false, - }, - animated: { - // 显示隐藏的时候opacity动画效果 - type: Boolean, - value: true - }, - show: { - // 显示隐藏导航,隐藏的时候navigation-bar的高度占位还在 - type: Boolean, - value: true, - observer: '_showChange' - }, - // back为true的时候,返回的页面深度 - delta: { - type: Number, - value: 1 - }, - }, - /** - * 组件的初始数据 - */ - data: { - displayStyle: '' - }, - lifetimes: { - attached() { - const rect = wx.getMenuButtonBoundingClientRect() - wx.getSystemInfo({ - success: (res) => { - const isAndroid = res.platform === 'android' - const isDevtools = res.platform === 'devtools' - this.setData({ - ios: !isAndroid, - innerPaddingRight: `padding-right: ${res.windowWidth - rect.left}px`, - leftWidth: `width: ${res.windowWidth - rect.left }px`, - safeAreaTop: isDevtools || isAndroid ? `height: calc(var(--height) + ${res.safeArea.top}px); padding-top: ${res.safeArea.top}px` : `` - }) - } - }) - }, - }, - /** - * 组件的方法列表 - */ - methods: { - _showChange(show: boolean) { - const animated = this.data.animated - let displayStyle = '' - if (animated) { - displayStyle = `opacity: ${ - show ? '1' : '0' - };transition:opacity 0.5s;` - } else { - displayStyle = `display: ${show ? '' : 'none'}` - } - this.setData({ - displayStyle - }) - }, - back() { - const data = this.data - if (data.delta) { - wx.navigateBack({ - delta: data.delta - }) - } - this.triggerEvent('back', { delta: data.delta }, {}) - } - }, -}) diff --git a/miniprogram/components/navigation-bar/navigation-bar.wxml b/miniprogram/components/navigation-bar/navigation-bar.wxml deleted file mode 100644 index be9a663..0000000 --- a/miniprogram/components/navigation-bar/navigation-bar.wxml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {{title}} - - - - - - - - - - - - diff --git a/miniprogram/pages/measurementReport/measurementReport.less b/miniprogram/pages/measurementReport/measurementReport.less index a1ea797..60ac4e8 100644 --- a/miniprogram/pages/measurementReport/measurementReport.less +++ b/miniprogram/pages/measurementReport/measurementReport.less @@ -6,65 +6,67 @@ /* ===== 测量信息卡片 ===== */ .info-card { width: 100%; - padding: 40rpx 30rpx; + display: flex; + align-items: center; + padding: 36rpx 30rpx; margin-bottom: 24rpx; border-radius: 24rpx; box-sizing: border-box; - background-color: #FFFFFF; + //background-color: #FFFFFF; + background: linear-gradient(180deg, #D3E9FF 0%, #FCFBFD 100%); - .info-header { - display: flex; - align-items: center; + .info-avatar { + width: 90rpx; + height: 90rpx; + border-radius: 24rpx; + margin-right: 24rpx; + box-sizing: border-box; + background-color: #C6E6FF; + border: 3rpx solid #50A6FF; + } - .info-avatar { - width: 96rpx; - height: 96rpx; - border-radius: 50%; - margin-right: 24rpx; - background-color: #C6E6FF; - border: 3rpx solid #50A6FF; + .info-meta { + flex: 1; + + .info-name { + color: #333333; + height: 32rpx; + font-size: 32rpx; + font-weight: bold; + line-height: 32rpx; + margin-bottom: 20rpx; } - .info-meta { - flex: 1; - - .info-time { - color: #77849E; - font-size: 26rpx; - line-height: 34rpx; - margin-bottom: 16rpx; - } - - .info-name { - color: #333333; - font-size: 32rpx; - font-weight: 700; - line-height: 32rpx; - } + .info-time { + color: #77849E; + height: 26rpx; + font-size: 26rpx; + line-height: 26rpx; } } } - /* ===== 体重卡片 ===== */ + /* ===== 最近测量卡 ===== */ .weight-card { width: 100%; + position: relative; margin-bottom: 24rpx; padding: 2rpx 2rpx 50rpx; border-radius: 24rpx; box-sizing: border-box; background-color: #FFFFFF; - /* 卡头 */ + /* 卡头(带渐变背景) */ .card-header { width: 100%; height: 88rpx; padding-left: 30rpx; - padding-right: 30rpx; + padding-right: 10rpx; box-sizing: border-box; display: flex; align-items: center; + margin-bottom: 18rpx; justify-content: space-between; - background: linear-gradient(180deg, rgba(211, 233, 255, 0.6) 0%, rgba(252, 251, 253, 0.6) 100%); .card-header-left { display: flex; @@ -92,7 +94,7 @@ padding: 0 30rpx; box-sizing: border-box; - /* 体重主数据行 */ + /* ===== 最近测量:体重主数据行 ===== */ .weight-row { display: flex; align-items: flex-end; @@ -169,7 +171,7 @@ font-size: 28rpx; line-height: 28rpx; - .diff-arrow { + text { position: absolute; left: 0; bottom: 42rpx; @@ -253,6 +255,30 @@ } } + /* BMI 行(标签 + badge 并排) */ + .metric-label-row { + height: 30rpx; + display: flex; + align-items: center; + margin-bottom: 20rpx; + + .metric-label { + margin-bottom: 0; + } + + /* BMI 标准/偏高 badge */ + .bmi-badge { + height: 30rpx; + padding: 0 10rpx; + margin-left: 10rpx; + font-size: 18rpx; + line-height: 30rpx; + border-radius: 8rpx; + color: #FFFFFF; + background-color: #2AC79F; + } + } + .metric-value-row { display: flex; align-items: baseline; @@ -270,13 +296,21 @@ color: #252535; height: 26rpx; font-size: 26rpx; - font-weight: 500; + font-weight: bold; line-height: 26rpx; } } } } } + + .card-lianjie { + position: absolute; + right: 24rpx; + width: 32rpx; + height: 84rpx; + bottom: -55rpx; + } } /* ===== 详细数据卡 ===== */ @@ -288,12 +322,12 @@ box-sizing: border-box; background-color: #FFFFFF; - /* 卡头 */ + /* 卡头(带渐变背景) */ .card-header { width: 100%; height: 88rpx; padding-left: 30rpx; - padding-right: 30rpx; + padding-right: 50rpx; box-sizing: border-box; display: flex; align-items: center; @@ -318,16 +352,28 @@ line-height: 30rpx; } } + + .card-header-right { + display: flex; + align-items: center; + + .link-text { + color: #77849E; + height: 24rpx; + font-size: 24rpx; + line-height: 24rpx; + } + } } - /* 详细数据:三格 */ + /* ===== 详细数据:三格 ===== */ .detail-grid { display: flex; padding: 0 30rpx; justify-content: space-between; .detail-item { - width: 194rpx; + width: 195rpx; padding: 24rpx; box-sizing: border-box; border-radius: 16rpx; @@ -350,7 +396,7 @@ color: #252535; height: 44rpx; font-size: 44rpx; - font-weight: 500; + font-weight: bold; line-height: 44rpx; margin-right: 2rpx; } @@ -359,7 +405,6 @@ color: #252535; height: 26rpx; font-size: 26rpx; - font-weight: 500; line-height: 26rpx; } } diff --git a/miniprogram/pages/measurementReport/measurementReport.ts b/miniprogram/pages/measurementReport/measurementReport.ts index 8e34582..4d2b187 100644 --- a/miniprogram/pages/measurementReport/measurementReport.ts +++ b/miniprogram/pages/measurementReport/measurementReport.ts @@ -1,15 +1,11 @@ /** 测量报告数据 */ -interface ReportData { - /** 测量时间 */ - measureTime: string - /** 用户姓名 */ - userName: string +interface WeightRecord { /** 体重整数部分 */ weight: number - /** 体重小数部分,如 ".20" */ + /** 体重小数部分,含小数点,如 ".20" */ weightDecimal: string - /** 测量时间显示,如 "05-06 09:30" */ - weightDate: string + /** 测量时间显示,如 "今日 07:30" */ + date: string /** 与上次相比差值(负=减轻,正=增重) */ diff: number /** 身高(cm) */ @@ -35,13 +31,11 @@ interface ReportData { Page({ data: { // 报告数据 - report: { - measureTime: '2026-05-06 09:30', - userName: '陈万宁', + record: { weight: 68, weightDecimal: '.20', - weightDate: '05-06 09:30', - diff: -2.6, + date: '今日 07:30', + diff: -0.3, height: 176, bmi: 22.4, bmiLabel: '标准', @@ -49,7 +43,7 @@ Page({ bodyFat: 22.3, bodyFatMass: 52.1, bmr: 1652 - } as ReportData + } as WeightRecord }, onLoad(options) { diff --git a/miniprogram/pages/measurementReport/measurementReport.wxml b/miniprogram/pages/measurementReport/measurementReport.wxml index 2bbfbdc..e58b9cd 100644 --- a/miniprogram/pages/measurementReport/measurementReport.wxml +++ b/miniprogram/pages/measurementReport/measurementReport.wxml @@ -2,16 +2,14 @@ - - - - {{ report.measureTime }} - {{ report.userName }} - + + + 陈万宁 + 2026-05-06 09:30 - + @@ -26,21 +24,21 @@ - {{ report.weight }} - {{ report.weightDecimal }} + {{ record.weight }} + {{ record.weightDecimal }} kg - {{ report.weightDate }} + {{ record.date }} - {{ report.diff < 0 ? -report.diff : report.diff }} + {{ record.diff < 0 ? -record.diff : record.diff }} kg - + - {{ report.diff < 0 ? '体重较上次减轻' : '体重较上次增加' }} + {{ record.diff < 0 ? '体重较上次减轻' : '体重较上次增加' }} @@ -54,17 +52,17 @@ 身高 - {{ report.height }} + {{ record.height }} cm BMI - {{ report.bmiLabel }} + {{ record.bmiLabel }} - {{ report.bmi }} + {{ record.bmi }} @@ -72,12 +70,16 @@ 标准体重 - {{ report.stdWeight }} + {{ record.stdWeight }} kg + + + + @@ -95,21 +97,21 @@ 体脂率 - {{ report.bodyFat }} + {{ record.bodyFat }} % 体脂肪 - {{ report.bodyFatMass }} + {{ record.bodyFatMass }} kg 基础代谢 - {{ report.bmr }} + {{ record.bmr }} kcal