From 44659a6ae48668e954a9b08ebf84b27313a3efcd Mon Sep 17 00:00:00 2001 From: 17792275749 <812100002@qq.com> Date: Wed, 10 Jun 2026 17:16:22 +0800 Subject: [PATCH] =?UTF-8?q?feat(selectMemberDrawer):=20=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=96=B0=E5=A2=9E=E6=9C=AC=E4=BA=BA/?= =?UTF-8?q?=E5=91=98=E5=B7=A5/=E5=AE=B6=E5=BA=AD=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=A0=87=E7=AD=BE=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - ExistingMember 补充 dataType/relationType 字段 - API 映射层透传 dataType 与 relationType - member-type 区域按类型展示对应颜色标签 Co-Authored-By: Claude Opus 4.7 --- .../selectMemberDrawer.less | 401 +++++++++--------- .../selectMemberDrawer/selectMemberDrawer.ts | 8 + .../selectMemberDrawer.wxml | 109 ++--- 3 files changed, 274 insertions(+), 244 deletions(-) diff --git a/miniprogram/components/selectMemberDrawer/selectMemberDrawer.less b/miniprogram/components/selectMemberDrawer/selectMemberDrawer.less index 18dbc7e..976f2cd 100644 --- a/miniprogram/components/selectMemberDrawer/selectMemberDrawer.less +++ b/miniprogram/components/selectMemberDrawer/selectMemberDrawer.less @@ -1,248 +1,263 @@ /* 遮罩层 */ .drawer-mask { - position: fixed; - top: 0; - left: 0; - width: 100%; - height: 100%; - background-color: rgba(37, 37, 53, 0.6); - z-index: 100; - opacity: 0; - transition: opacity 0.3s ease; + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-color: rgba(37, 37, 53, 0.6); + z-index: 100; + opacity: 0; + transition: opacity 0.3s ease; - &--visible { - opacity: 1; - } + &--visible { + opacity: 1; + } } /* 抽屉面板 */ .drawer-panel { - position: fixed; - bottom: 0; - left: 0; - width: 100%; - /* 最大高度约 75% 屏幕 */ - height: 85vh; - background-color: #FFFFFF; - border-radius: 24rpx 24rpx 0 0; - z-index: 101; - display: flex; - flex-direction: column; - transform: translateY(100%); - transition: transform 0.3s ease; + position: fixed; + bottom: 0; + left: 0; + width: 100%; + /* 最大高度约 75% 屏幕 */ + height: 85vh; + background-color: #FFFFFF; + border-radius: 24rpx 24rpx 0 0; + z-index: 101; + display: flex; + flex-direction: column; + transform: translateY(100%); + transition: transform 0.3s ease; - &--visible { - transform: translateY(0); - } + &--visible { + transform: translateY(0); + } } /* 拖拽把手 */ .drawer-handle { - width: 72rpx; - height: 6rpx; - background-color: #77849E; - border-radius: 3rpx; - margin: 32rpx auto 40rpx; + width: 72rpx; + height: 6rpx; + background-color: #77849E; + border-radius: 3rpx; + margin: 32rpx auto 40rpx; } /* 标题栏 */ .drawer-header { - width: 100%; - height: 32rpx; - padding: 0 30rpx; - box-sizing: border-box; - display: flex; - align-items: center; - justify-content: space-between; - - .drawer-title { - color: #252535; - height: 32rpx; - font-size: 32rpx; - font-weight: 700; - line-height: 32rpx; - } - - /* 关闭按钮 */ - .drawer-close { - width: 32rpx; + width: 100%; height: 32rpx; + padding: 0 30rpx; + box-sizing: border-box; display: flex; align-items: center; - justify-content: center; + justify-content: space-between; - .drawer-close-icon { - width: 28rpx; - height: 28rpx; - position: relative; + .drawer-title { + color: #252535; + height: 32rpx; + font-size: 32rpx; + font-weight: 700; + line-height: 32rpx; + } - &::before, - &::after { - content: ''; - position: absolute; - top: 50%; - left: 50%; - width: 100%; - height: 3rpx; - background-color: #252535; - border-radius: 2rpx; - } + /* 关闭按钮 */ - &::before { - transform: translate(-50%, -50%) rotate(45deg); - } + .drawer-close { + width: 32rpx; + height: 32rpx; + display: flex; + align-items: center; + justify-content: center; - &::after { - transform: translate(-50%, -50%) rotate(-45deg); - } + .drawer-close-icon { + width: 28rpx; + height: 28rpx; + position: relative; + + &::before, + &::after { + content: ''; + position: absolute; + top: 50%; + left: 50%; + width: 100%; + height: 3rpx; + background-color: #252535; + border-radius: 2rpx; + } + + &::before { + transform: translate(-50%, -50%) rotate(45deg); + } + + &::after { + transform: translate(-50%, -50%) rotate(-45deg); + } + } } - } } /* 顶部分隔线 */ .drawer-divider { - width: 690rpx; - height: 2rpx; - background-color: #EAEDF1; - margin: 39rpx 30rpx 0; - flex-shrink: 0; + width: 690rpx; + height: 2rpx; + background-color: #EAEDF1; + margin: 39rpx 30rpx 0; + flex-shrink: 0; } /* 用户滚动列表 */ .drawer-list { - flex: 1; - overflow: hidden; - padding-bottom: env(safe-area-inset-bottom); + flex: 1; + overflow: hidden; + padding-bottom: env(safe-area-inset-bottom); } /* 用户行 */ .member-item { - width: 100%; - height: 90rpx; - padding: 0 30rpx; - box-sizing: border-box; - display: flex; - flex-direction: row; - align-items: center; - margin-top: 24rpx; - - /* 有图片头像 */ - .member-avatar { - width: 90rpx; + width: 100%; height: 90rpx; - border-radius: 24rpx; - flex-shrink: 0; - - &--selected { - border: 3rpx solid #50A6FF; - } - } - - /* 纯色占位头像 */ - .member-avatar-placeholder { - width: 90rpx; - height: 90rpx; - border-radius: 24rpx; - flex-shrink: 0; - - /* 男:蓝色 */ - &--male { - background-color: #C6E6FF; - } - - /* 女:粉色 */ - &--female { - background-color: #FFD5E3; - } - - /* 选中男 */ - &--selected-male { - border: 3rpx solid #50A6FF; - width: 96rpx; - height: 96rpx; - margin: -3rpx 0 0 -3rpx; - } - - /* 选中女 */ - &--selected-female { - border: 3rpx solid #FF8FB5; - width: 96rpx; - height: 96rpx; - margin: -3rpx 0 0 -3rpx; - } - } - - /* 姓名 + 副标题 */ - .member-info { - flex: 1; - height: 78rpx; + padding: 0 30rpx; + box-sizing: border-box; display: flex; - flex-direction: column; - justify-content: space-between; - margin-left: 23rpx; + flex-direction: row; + align-items: center; + margin-top: 24rpx; - .member-name { - color: #333333; - font-size: 32rpx; - font-weight: 500; - line-height: 32rpx; - white-space: nowrap; + /* 有图片头像 */ + + .member-avatar { + width: 90rpx; + height: 90rpx; + border-radius: 24rpx; + flex-shrink: 0; + + &--selected { + border: 3rpx solid #50A6FF; + } } - .member-sub { - color: #77849E; - font-size: 26rpx; - line-height: 34rpx; - white-space: nowrap; + /* 纯色占位头像 */ + + .member-avatar-placeholder { + width: 90rpx; + height: 90rpx; + border-radius: 24rpx; + flex-shrink: 0; + + /* 男:蓝色 */ + + &--male { + background-color: #C6E6FF; + } + + /* 女:粉色 */ + + &--female { + background-color: #FFD5E3; + } + + /* 选中男 */ + + &--selected-male { + border: 3rpx solid #50A6FF; + width: 96rpx; + height: 96rpx; + margin: -3rpx 0 0 -3rpx; + } + + /* 选中女 */ + + &--selected-female { + border: 3rpx solid #FF8FB5; + width: 96rpx; + height: 96rpx; + margin: -3rpx 0 0 -3rpx; + } } - } - /* 竖向分隔线 */ - .member-divider { - width: 2rpx; - height: 24rpx; - background-color: #EAEDF1; - border-radius: 1rpx; - margin-left: 17rpx; - flex-shrink: 0; - } + /* 姓名 + 副标题 */ - /* 身高 */ - .member-height { - color: #77849E; - font-size: 26rpx; - line-height: 34rpx; - white-space: nowrap; - margin-left: 19rpx; - width: 76rpx; - flex-shrink: 0; - } + .member-info { + flex: 1; + height: 78rpx; + display: flex; + flex-direction: column; + justify-content: space-between; + margin-left: 23rpx; + + .member-name { + color: #333333; + font-size: 32rpx; + font-weight: 500; + line-height: 32rpx; + white-space: nowrap; + } + + .member-sub { + color: #77849E; + font-size: 26rpx; + line-height: 34rpx; + white-space: nowrap; + } + } + + .member-type { + height: 40rpx; + flex-shrink: 0; + + .member-type-tag { + height: 40rpx; + padding: 0 14rpx; + font-size: 22rpx; + line-height: 40rpx; + border-radius: 6rpx; + } + + .member-type-tag--self { + color: #1385FA; + background-color: rgba(19, 133, 250, 0.12); + } + + .member-type-tag--employee { + color: #10B981; + background-color: rgba(16, 185, 129, 0.12); + } + + .member-type-tag--family { + color: #F59E0B; + background-color: rgba(245, 158, 11, 0.12); + } + } } /* 行间水平分隔线 */ .member-separator { - width: 690rpx; - height: 2rpx; - background-color: #EAEDF1; - margin: 24rpx 30rpx 0; + width: 690rpx; + height: 2rpx; + background-color: #EAEDF1; + margin: 24rpx 30rpx 0; } /* 空态占位 */ .drawer-empty { - display: flex; - flex-direction: column; - align-items: center; - padding-top: 80rpx; + display: flex; + flex-direction: column; + align-items: center; + padding-top: 80rpx; - .drawer-empty-icon { - width: 193rpx; - height: 138rpx; - margin-bottom: 30rpx; - } + .drawer-empty-icon { + width: 193rpx; + height: 138rpx; + margin-bottom: 30rpx; + } - .drawer-empty-text { - color: #808080; - font-size: 28rpx; - line-height: 28rpx; - } + .drawer-empty-text { + color: #808080; + font-size: 28rpx; + line-height: 28rpx; + } } diff --git a/miniprogram/components/selectMemberDrawer/selectMemberDrawer.ts b/miniprogram/components/selectMemberDrawer/selectMemberDrawer.ts index c6d2461..82cffdc 100644 --- a/miniprogram/components/selectMemberDrawer/selectMemberDrawer.ts +++ b/miniprogram/components/selectMemberDrawer/selectMemberDrawer.ts @@ -11,6 +11,8 @@ interface AddMemberApiItem { weight: number idCard: string | null avatar: string | null + dataType?: number + relationType?: number | string | null } /** GET /weighingScale/v3/select/history/user 返回的单条结构 */ @@ -23,6 +25,7 @@ interface HistoryApiItem { birthday: string avatar: string | null relationType: number | string | null + dataType?: number } /** 抽屉内部用户项(含回填所需全量字段) */ @@ -41,6 +44,8 @@ interface ExistingMember { sex?: number birthday?: string relationType?: number | string | null + /** 0=员工 1=家庭成员 */ + dataType?: number } /** @@ -136,6 +141,7 @@ Component({ sex: item.sex, birthday: item.birthday, relationType: item.relationType, + dataType: item.dataType, })) this.setData({ members }) }) @@ -155,6 +161,8 @@ Component({ weight: item.weight, idCard: item.idCard ?? '', avatar: item.avatar ?? '', + relationType: item.relationType, + dataType: item.dataType, })) this.setData({ members }) }) diff --git a/miniprogram/components/selectMemberDrawer/selectMemberDrawer.wxml b/miniprogram/components/selectMemberDrawer/selectMemberDrawer.wxml index 2a93ae9..cfe1365 100644 --- a/miniprogram/components/selectMemberDrawer/selectMemberDrawer.wxml +++ b/miniprogram/components/selectMemberDrawer/selectMemberDrawer.wxml @@ -1,63 +1,70 @@ - - + + - - + + - - + + - - - 选择已有用户 - - - - - - - - - - - - - - - - - - - - - - - - {{ item.name }} - {{ item.gender }}·{{ item.age }}岁 + + + 选择已有用户 + + + - - + + - - {{ item.height }}cm - + + + + + + + + + + + + - - + + + {{ item.name }} + {{ item.gender }}·{{ item.age }}岁 丨 {{ item.height }}cm + + + + + 本人 + + + 员工 + + + 家庭用户 + + + + + + + + - - - - - - - 暂无可选用户 - - - + + + + + 暂无可选用户 + + +