feat(data,my): 实现数据页与我的页界面,新增选择成员抽屉组件

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
17792275749
2026-08-17 15:48:07 +08:00
co-authored by Claude Sonnet 4.6
parent 6ad51b00b1
commit 0c8285f390
13 changed files with 1098 additions and 7 deletions
+2 -1
View File
@@ -1,5 +1,6 @@
{
"usingComponents": {},
"navigationBarTitleText": "black" ,
"navigationBarTitleText": "历史数据",
"navigationBarTextStyle": "black",
"navigationBarBackgroundColor": "#FFFFFF"
}
+304 -1
View File
@@ -1 +1,304 @@
/* pages/data/data.wxss */
.scrollViewContent {
width: 100%;
padding: 24rpx 30rpx;
box-sizing: border-box;
.data-card {
width: 100%;
overflow: hidden;
zoom: 1;
position: relative;
padding: 40rpx 30rpx 30rpx;
box-sizing: border-box;
border-radius: 24rpx;
margin-bottom: 30rpx;
background-color: #FFFFFF;
&::before {
content: "";
position: absolute;
top: 2rpx;
left: 2rpx;
right: 2rpx;
height: 88rpx;
background: linear-gradient(180deg, #D3E9FF 0%, #FCFBFD 100%);
}
/* 用户信息行 */
.userInfo {
position: relative;
z-index: 2;
width: 100%;
display: flex;
align-items: center;
margin-bottom: 30rpx;
/* 头像色块(展示姓名首字) */
.avatar {
width: 90rpx;
height: 90rpx;
margin-right: 24rpx;
border-radius: 18rpx;
color: #FFFFFF;
font-size: 36rpx;
font-weight: bold;
line-height: 90rpx;
text-align: center;
background-color: #1385FA;
}
/* 姓名 + meta */
.info {
flex: 1;
.info-name-row {
height: 40rpx;
display: flex;
align-items: center;
margin-bottom: 10rpx;
.info-name {
color: #252535;
height: 40rpx;
font-size: 30rpx;
font-weight: bold;
line-height: 40rpx;
margin-right: 20rpx;
}
/* 本人 badge */
.badge-self {
color: #1385FA;
height: 40rpx;
padding: 0 18rpx;
font-size: 24rpx;
line-height: 40rpx;
border-radius: 8rpx;
background-color: rgba(19, 133, 250, 0.2);
}
}
.info-meta {
height: 26rpx;
display: flex;
align-items: center;
.meta-text {
color: #808080;
height: 26rpx;
font-size: 24rpx;
line-height: 26rpx;
}
.meta-divider {
color: #CCCCCC;
font-size: 24rpx;
line-height: 26rpx;
margin: 0 12rpx;
}
}
}
/* 切换用户按钮 */
.btn {
color: #1385FA;
width: 120rpx;
height: 48rpx;
font-size: 24rpx;
font-weight: 500;
line-height: 48rpx;
border-radius: 8rpx;
text-align: center;
border: 2rpx solid #1385FA;
}
}
.card-divider {
position: relative;
z-index: 2;
width: calc(100% + 60rpx);
left: -30rpx;
height: 1rpx;
margin-bottom: 30rpx;
border-bottom: 2rpx dashed #EAECF1;
&::before {
content: "";
position: absolute;
left: -15rpx;
top: 0;
bottom: 0;
margin: auto;
width: 30rpx;
height: 30rpx;
background-color: #F5F7FB;
border-radius: 50%;
}
&::after {
content: "";
position: absolute;
right: -15rpx;
top: 0;
bottom: 0;
margin: auto;
width: 30rpx;
height: 30rpx;
background-color: #F5F7FB;
border-radius: 50%;
}
}
/* 时间范围 Tab */
.nav {
width: 100%;
height: 72rpx;
padding: 4rpx;
box-sizing: border-box;
display: flex;
flex-wrap: nowrap;
background-color: #E8EBF2;
border-radius: 16rpx;
margin-bottom: 24rpx;
>view {
flex: 1;
height: 64rpx;
border-radius: 16rpx;
font-size: 28rpx;
color: #808080;
line-height: 64rpx;
text-align: center;
&.active {
color: #FFFFFF;
font-weight: bold;
background-color: #1385FA;
}
}
}
/* 统计摘要 4 格 */
.summary {
width: 100%;
display: flex;
flex-wrap: nowrap;
justify-content: space-between;
padding: 24rpx 0;
background-color: #F3F4F6;
border-radius: 16rpx;
.summary-item {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
.summary-label {
color: #808080;
height: 24rpx;
font-size: 24rpx;
line-height: 24rpx;
margin-bottom: 20rpx;
}
.summary-value {
color: #252535;
height: 32rpx;
font-size: 32rpx;
font-weight: bold;
line-height: 32rpx;
text {
color: #808080;
font-size: 24rpx;
font-weight: normal;
margin-left: 4rpx;
}
}
/* 体重下降(利好) */
.value-down {
color: #2AC79F;
}
/* 体重上升(警示) */
.value-up {
color: #FF4D4F;
}
}
}
}
/* 历史记录列表 */
.data-list {
width: 100%;
.list {
width: 100%;
margin-bottom: 30rpx;
>view:first-of-type {
color: #808080;
width: 100%;
height: 24rpx;
font-size: 24rpx;
line-height: 24rpx;
margin-bottom: 20rpx;
}
>view:last-of-type {
width: 100%;
height: 96rpx;
display: flex;
justify-content: space-between;
padding-left: 30rpx;
padding-right: 50rpx;
box-sizing: border-box;
flex-wrap: nowrap;
border-radius: 16rpx;
background-color: #FFFFFF;
>view {
color: #808080;
font-size: 26rpx;
height: 96rpx;
line-height: 96rpx;
text {
color: #252535;
font-weight: bold;
}
}
}
}
}
/* ===== 空态 ===== */
.empty-state {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
padding-top: 160rpx;
.empty-icon {
width: 193rpx;
height: 138rpx;
margin-bottom: 40rpx;
image {
width: 100%;
height: 100%;
}
}
.empty-text {
color: #808080;
height: 30rpx;
font-size: 30rpx;
line-height: 30rpx;
}
}
}
+92 -2
View File
@@ -1,2 +1,92 @@
<!--pages/data/data.wxml-->
<text>pages/data/data.wxml</text>
<scroll-view
class="scrollView"
scroll-y
refresher-enabled
refresher-triggered="{{ refresherTriggered }}"
bind:refresherrefresh="onRefresh"
bind:scrolltolower="onScrollToLower"
>
<view class="scrollViewContent">
<!-- 数据卡(用户信息 + 时间 Tab + 统计) -->
<view class="data-card">
<!-- 用户信息 -->
<view class="userInfo">
<view class="avatar">张</view>
<view class="info">
<view class="info-name-row">
<view class="info-name">张晓敏</view>
<view class="badge-self">本人</view>
</view>
<view class="info-meta">
<view class="meta-text">男·36岁</view>
<view class="meta-divider">|</view>
<view class="meta-text">170cm</view>
</view>
</view>
<view class="btn" bind:tap="onTapSwitchMember">切换用户</view>
</view>
<view class="card-divider"></view>
<!-- 时间范围 Tab -->
<view class="nav">
<view class="active">近7日</view>
<view>近30日</view>
<view>近90日</view>
</view>
<!-- 统计摘要(4格) -->
<view class="summary">
<view class="summary-item">
<view class="summary-label">最高体重</view>
<view class="summary-value">89.6<text>kg</text></view>
</view>
<view class="summary-item">
<view class="summary-label">最低体重</view>
<view class="summary-value">89.6<text>kg</text></view>
</view>
<view class="summary-item">
<view class="summary-label">平均体重</view>
<view class="summary-value">89.6<text>kg</text></view>
</view>
<view class="summary-item">
<view class="summary-label">体重变化</view>
<view class="summary-value {{ stats.weightChange < 0 ? 'value-down' : 'value-up' }}">
{{ stats.weightChange > 0 ? '+' : '' }}{{ stats.weightChange }}<text>kg</text>
</view>
</view>
</view>
</view>
<!-- 有数据:记录列表 -->
<block wx:if="{{ records.length }}">
<view class="data-list">
<block wx:for="{{ records }}" wx:key="recordId">
<view class="list" bind:tap="onTapRecord" data-record-id="{{ item.recordId }}">
<view>{{ item.examTime }}</view>
<view class="arrow">
<view>体重:<text>{{ item.weight }}kg</text></view>
<view>BMI<text>{{ item.bmi }}</text></view>
<view>体脂率:<text>{{ item.fatRate }}%</text></view>
</view>
</view>
</block>
</view>
</block>
<!-- 无数据:占位 -->
<block wx:else>
<empty-data />
</block>
</view>
</scroll-view>
<!-- <select-member-drawer
show="{{ showSelectDrawer }}"
source="history"
exclude-user-id="{{ userInfo.userId }}"
bind:select="onSelectMember"
bind:close="onCloseDrawer"
/> -->
+2
View File
@@ -27,6 +27,7 @@
color: #1A3F68;
height: 48rpx;
font-size: 48rpx;
font-weight: bolder;
line-height: 48rpx;
margin-bottom: 24rpx;
}
@@ -35,6 +36,7 @@
color: #446D99;
height: 26rpx;
font-size: 26rpx;
font-weight: bolder;
line-height: 26rpx;
}
}
+131 -1
View File
@@ -1 +1,131 @@
/* pages/my/my.wxss */
.my {
width: 100%;
height: 100%;
.header {
width: 100%;
height: 320rpx;
margin-bottom: 26rpx;
.bg {
width: 100%;
height: 100%;
}
.user {
position: absolute;
top: 185rpx;
left: 40rpx;
right: 40rpx;
width: 100%;
display: flex;
box-sizing: border-box;
.userAvatar {
width: 120rpx;
height: 120rpx;
margin-right: 30rpx;
border-radius: 24rpx;
color: #FFFFFF;
font-size: 48rpx;
font-weight: bold;
line-height: 110rpx;
text-align: center;
box-sizing: border-box;
border: 5rpx solid #ffffff;
background-color: #1385FA;
}
.userInfo {
flex: 1;
display: flex;
flex-flow: column;
justify-content: center;
overflow: hidden;
.userName {
color: #252536;
height: 40rpx;
font-weight: bold;
font-size: 40rpx;
line-height: 40rpx;
margin-bottom: 22rpx;
}
.userSex {
height: 28rpx;
display: flex;
align-items: center;
.meta-text {
color: #77849E;
height: 28rpx;
font-size: 28rpx;
line-height: 28rpx;
}
.meta-divider {
color: #B6B6B6;
height: 28rpx;
font-size: 28rpx;
line-height: 28rpx;
margin: 0 12rpx;
}
}
}
}
}
.page-container {
width: 100%;
box-sizing: border-box;
.list {
width: 100%;
padding: 0 30rpx;
border-radius: 16rpx;
box-sizing: border-box;
background-color: #ffffff;
margin-bottom: 750rpx;
.list-item {
width: 100%;
height: 110rpx;
display: flex;
flex-wrap: nowrap;
align-items: center;
border-bottom: 2rpx solid #EAECF1;
&:last-of-type {
border-bottom: none;
}
> view:nth-of-type(1) {
width: 44rpx;
height: 44rpx;
margin-right: 22rpx;
}
> view:nth-of-type(2) {
flex: 1;
height: 32rpx;
color: #394356;
font-weight: bold;
font-size: 32rpx;
line-height: 32rpx;
}
}
}
.exitBtn {
color: #252535;
width: 100%;
height: 110rpx;
font-size: 32rpx;
text-align: center;
line-height: 110rpx;
border-radius: 24rpx;
background-color: #FFFFFF;
}
}
}
+40 -2
View File
@@ -1,2 +1,40 @@
<!--pages/my/my.wxml-->
<text>pages/my/my.wxml</text>
<view class="my">
<view class="header">
<view class="bg">
<image src="/images/my/bg.png" mode="aspectFit" />
</view>
<view class="user">
<view class="userAvatar">张</view>
<view class="userInfo">
<view class="userName">陈沐辰</view>
<view class="userSex">
<text class="meta-text">男·36岁</text>
<text class="meta-divider">|</text>
<text class="meta-text">172cm</text>
</view>
</view>
</view>
</view>
<view class="page-container">
<view class="list">
<view class="list-item">
<view>
<image src="/images/my/individual.png" mode="aspectFit" />
</view>
<view>个人信息</view>
<view class="arrow"></view>
</view>
<view class="list-item">
<view>
<image src="/images/my/help.png" mode="aspectFit" />
</view>
<view>帮助中心</view>
<view class="arrow"></view>
</view>
</view>
<view class="exitBtn">退出登录</view>
</view>
</view>