[AI Generated]: feat(device): 设备列表添加 scroll-view 支持滚动,优化布局结构
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
0a05fde0ba
commit
14ec4fe177
@@ -2,152 +2,158 @@
|
|||||||
.equipment {
|
.equipment {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
padding: 30rpx 30rpx 0;
|
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
background-color: #F7F8FA;
|
background-color: #F7F8FA;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
/* 副标题:已配对设备 */
|
/* 副标题:已配对设备 */
|
||||||
.section-title {
|
.section-title {
|
||||||
color: #808080;
|
color: #808080;
|
||||||
height: 28rpx;
|
height: 80rpx;
|
||||||
font-size: 26rpx;
|
font-size: 26rpx;
|
||||||
line-height: 28rpx;
|
line-height: 28rpx;
|
||||||
padding: 0 30rpx;
|
padding: 0 30rpx;
|
||||||
margin-bottom: 20rpx;
|
line-height: 80rpx;
|
||||||
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 卡片列表 */
|
/* 卡片列表(scroll-view) */
|
||||||
.device-list {
|
.device-list {
|
||||||
|
flex: 1;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
|
|
||||||
.device-card {
|
.scroll-view-content {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background-color: #FFFFFF;
|
padding: 0 30rpx;
|
||||||
border-radius: 16rpx;
|
|
||||||
padding: 30rpx;
|
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
margin-bottom: 24rpx;
|
|
||||||
|
|
||||||
&:last-child {
|
.device-card {
|
||||||
margin-bottom: 0;
|
background-color: #FFFFFF;
|
||||||
}
|
border-radius: 16rpx;
|
||||||
|
padding: 30rpx;
|
||||||
/* 上半:图标 + 设备名 + 状态 */
|
|
||||||
.card-top {
|
|
||||||
width: 100%;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
.card-icon {
|
|
||||||
width: 90rpx;
|
|
||||||
height: 90rpx;
|
|
||||||
border-radius: 24rpx;
|
|
||||||
margin-right: 24rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-info {
|
|
||||||
flex: 1;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
|
|
||||||
.card-name {
|
|
||||||
color: #252535;
|
|
||||||
height: 32rpx;
|
|
||||||
font-size: 32rpx;
|
|
||||||
font-weight: bold;
|
|
||||||
line-height: 32rpx;
|
|
||||||
margin-bottom: 16rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-status {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
.card-dot {
|
|
||||||
width: 12rpx;
|
|
||||||
height: 12rpx;
|
|
||||||
border-radius: 50%;
|
|
||||||
margin-right: 14rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-dot-on {
|
|
||||||
background-color: #2AC79F;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-dot-off {
|
|
||||||
background-color: #F24439;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-status-text {
|
|
||||||
height: 28rpx;
|
|
||||||
font-size: 28rpx;
|
|
||||||
font-weight: 500;
|
|
||||||
line-height: 28rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-status-on {
|
|
||||||
color: #2AC79F;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-status-off {
|
|
||||||
color: #F24439;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 分隔线 */
|
|
||||||
.card-divider {
|
|
||||||
width: 100%;
|
|
||||||
height: 2rpx;
|
|
||||||
background-color: #EAECF1;
|
|
||||||
border-radius: 1rpx;
|
|
||||||
margin: 30rpx 0 30rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 操作按钮区:单/双形态共用 */
|
|
||||||
.card-actions {
|
|
||||||
width: 100%;
|
|
||||||
padding: 0 24rpx;
|
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
display: flex;
|
// margin: 0 30rpx 24rpx;
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
/* 单按钮:已连接态 */
|
&:last-child {
|
||||||
&.card-actions-single {
|
margin-bottom: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
.btn-ghost-full {
|
/* 上半:图标 + 设备名 + 状态 */
|
||||||
width: 100%;
|
.card-top {
|
||||||
height: 82rpx;
|
width: 100%;
|
||||||
line-height: 78rpx;
|
display: flex;
|
||||||
text-align: center;
|
align-items: center;
|
||||||
color: #77849E;
|
|
||||||
font-size: 28rpx;
|
.card-icon {
|
||||||
background-color: #FFFFFF;
|
width: 90rpx;
|
||||||
border: 2rpx solid #E6E6EA;
|
height: 90rpx;
|
||||||
border-radius: 39rpx;
|
border-radius: 24rpx;
|
||||||
box-sizing: border-box;
|
margin-right: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-info {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
.card-name {
|
||||||
|
color: #252535;
|
||||||
|
height: 32rpx;
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
line-height: 32rpx;
|
||||||
|
margin-bottom: 16rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-status {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.card-dot {
|
||||||
|
width: 12rpx;
|
||||||
|
height: 12rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
margin-right: 14rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-dot-on {
|
||||||
|
background-color: #2AC79F;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-dot-off {
|
||||||
|
background-color: #F24439;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-status-text {
|
||||||
|
height: 28rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
line-height: 28rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-status-on {
|
||||||
|
color: #2AC79F;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-status-off {
|
||||||
|
color: #F24439;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 双按钮:未连接态 */
|
/* 分隔线 */
|
||||||
&.card-actions-double {
|
.card-divider {
|
||||||
justify-content: space-between;
|
width: 100%;
|
||||||
|
height: 2rpx;
|
||||||
|
background-color: #EAECF1;
|
||||||
|
border-radius: 1rpx;
|
||||||
|
margin: 30rpx 0 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
.btn-ghost-half {
|
/* 操作按钮区:单/双形态共用 */
|
||||||
width: 280rpx;
|
.card-actions {
|
||||||
height: 82rpx;
|
width: 100%;
|
||||||
line-height: 78rpx;
|
padding: 0 24rpx;
|
||||||
text-align: center;
|
box-sizing: border-box;
|
||||||
color: #77849E;
|
display: flex;
|
||||||
font-size: 28rpx;
|
align-items: center;
|
||||||
background-color: #FFFFFF;
|
|
||||||
border: 2rpx solid #E6E6EA;
|
/* 单按钮:已连接态 */
|
||||||
border-radius: 39rpx;
|
&.card-actions-single {
|
||||||
box-sizing: border-box;
|
|
||||||
|
.btn-ghost-full {
|
||||||
|
width: 100%;
|
||||||
|
height: 82rpx;
|
||||||
|
line-height: 78rpx;
|
||||||
|
text-align: center;
|
||||||
|
color: #77849E;
|
||||||
|
font-size: 28rpx;
|
||||||
|
background-color: #FFFFFF;
|
||||||
|
border: 2rpx solid #E6E6EA;
|
||||||
|
border-radius: 39rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 双按钮:未连接态 */
|
||||||
|
&.card-actions-double {
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
|
.btn-ghost-half {
|
||||||
|
width: 280rpx;
|
||||||
|
height: 82rpx;
|
||||||
|
line-height: 78rpx;
|
||||||
|
text-align: center;
|
||||||
|
color: #77849E;
|
||||||
|
font-size: 28rpx;
|
||||||
|
background-color: #FFFFFF;
|
||||||
|
border: 2rpx solid #E6E6EA;
|
||||||
|
border-radius: 39rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -163,7 +169,8 @@
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
background-color: #1385FA;
|
background-color: #1385FA;
|
||||||
border-radius: 44rpx;
|
border-radius: 44rpx;
|
||||||
margin: 40rpx auto 0;
|
margin: 40rpx auto;
|
||||||
|
flex-shrink: 0;
|
||||||
|
|
||||||
.add-btn-icon {
|
.add-btn-icon {
|
||||||
color: #FFFFFF;
|
color: #FFFFFF;
|
||||||
|
|||||||
@@ -5,49 +5,53 @@
|
|||||||
|
|
||||||
<!-- 设备卡片列表 -->
|
<!-- 设备卡片列表 -->
|
||||||
<view class="device-list">
|
<view class="device-list">
|
||||||
<block wx:for="{{ deviceList }}" wx:key="id">
|
<scroll-view class="scrollView" scroll-y>
|
||||||
<view class="device-card">
|
<view class="scroll-view-content">
|
||||||
|
<block wx:for="{{ deviceList }}" wx:key="id">
|
||||||
|
<view class="device-card">
|
||||||
|
|
||||||
<!-- 上半:图标 + 设备信息 + 状态(色点 + 文字) -->
|
<!-- 上半:图标 + 设备信息 + 状态(色点 + 文字) -->
|
||||||
<view class="card-top">
|
<view class="card-top">
|
||||||
<image class="card-icon" src="/images/device/{{ item.scaleDeviceName }}.png" mode="aspectFit"></image>
|
<image class="card-icon" src="/images/device/{{ item.scaleDeviceName }}.png" mode="aspectFit"></image>
|
||||||
<view class="card-info">
|
<view class="card-info">
|
||||||
<view class="card-name">{{ item.scaleDeviceName }}</view>
|
<view class="card-name">{{ item.scaleDeviceName }}</view>
|
||||||
<view class="card-status">
|
<view class="card-status">
|
||||||
<!-- 已连接:绿点 + "已连接" -->
|
<!-- 已连接:绿点 + "已连接" -->
|
||||||
<block wx:if="{{ item.connected }}">
|
<block wx:if="{{ item.connected }}">
|
||||||
<view class="card-dot card-dot-on"></view>
|
<view class="card-dot card-dot-on"></view>
|
||||||
<text class="card-status-text card-status-on">已连接</text>
|
<text class="card-status-text card-status-on">已连接</text>
|
||||||
</block>
|
</block>
|
||||||
<!-- 未连接:红点 + "未连接" -->
|
<!-- 未连接:红点 + "未连接" -->
|
||||||
<block wx:else>
|
<block wx:else>
|
||||||
<view class="card-dot card-dot-off"></view>
|
<view class="card-dot card-dot-off"></view>
|
||||||
<text class="card-status-text card-status-off">未连接</text>
|
<text class="card-status-text card-status-off">未连接</text>
|
||||||
</block>
|
</block>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<!-- 分隔线 -->
|
<!-- 分隔线 -->
|
||||||
<view class="card-divider"></view>
|
<view class="card-divider"></view>
|
||||||
|
|
||||||
|
<!-- 下半:操作按钮(单/双形态) -->
|
||||||
|
<block wx:if="{{ item.connected }}">
|
||||||
|
<!-- 已连接:单按钮居中 -->
|
||||||
|
<view class="card-actions card-actions-single">
|
||||||
|
<view class="btn-ghost-full" bind:tap="onTapMember">成员管理</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
<block wx:else>
|
||||||
|
<!-- 未连接:双按钮 连接 / 成员管理 -->
|
||||||
|
<view class="card-actions card-actions-double">
|
||||||
|
<view class="btn-ghost-half" data-connect-device-info="{{ item.connectDeviceInfo }}" bind:tap="onTapConnect">连接</view>
|
||||||
|
<view class="btn-ghost-half" bind:tap="onTapMember">成员管理</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
|
||||||
<!-- 下半:操作按钮(单/双形态) -->
|
|
||||||
<block wx:if="{{ item.connected }}">
|
|
||||||
<!-- 已连接:单按钮居中 -->
|
|
||||||
<view class="card-actions card-actions-single">
|
|
||||||
<view class="btn-ghost-full" bind:tap="onTapMember">成员管理</view>
|
|
||||||
</view>
|
</view>
|
||||||
</block>
|
</block>
|
||||||
<block wx:else>
|
|
||||||
<!-- 未连接:双按钮 连接 / 成员管理 -->
|
|
||||||
<view class="card-actions card-actions-double">
|
|
||||||
<view class="btn-ghost-half" data-connect-device-info="{{ item.connectDeviceInfo }}" bind:tap="onTapConnect">连接</view>
|
|
||||||
<view class="btn-ghost-half" bind:tap="onTapMember">成员管理</view>
|
|
||||||
</view>
|
|
||||||
</block>
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</block>
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 底部「添加设备」主按钮 -->
|
<!-- 底部「添加设备」主按钮 -->
|
||||||
|
|||||||
Reference in New Issue
Block a user