[AI Generated]: feat(Views): 新增设备管理页已配对设备列表及添加设备按钮
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"pages": [
|
||||
"pages/connectedWifi/connectedWifi",
|
||||
"pages/equipment/equipment",
|
||||
"pages/login/login",
|
||||
"pages/searchDevice/searchDevice",
|
||||
"pages/connectedDevice/connectedDevice",
|
||||
"pages/connectedWifi/connectedWifi",
|
||||
"pages/supplementPersonal/supplementPersonal",
|
||||
"pages/home/home",
|
||||
"pages/equipment/equipment",
|
||||
"pages/data/data",
|
||||
"pages/my/my"
|
||||
],
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
{
|
||||
"navigationBarTitleText": "设备管理",
|
||||
"usingComponents": {}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,185 @@
|
||||
/* 设备管理页 —— 已配对设备列表 + 添加设备主按钮 */
|
||||
.equipment {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: 30rpx 30rpx 0;
|
||||
box-sizing: border-box;
|
||||
background-color: #F7F8FA;
|
||||
|
||||
/* 副标题:已配对设备 */
|
||||
.section-title {
|
||||
color: #808080;
|
||||
height: 28rpx;
|
||||
font-size: 26rpx;
|
||||
line-height: 28rpx;
|
||||
padding: 0 30rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
/* 卡片列表 */
|
||||
.device-list {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.device-card {
|
||||
width: 100%;
|
||||
background-color: #FFFFFF;
|
||||
border-radius: 16rpx;
|
||||
padding: 30rpx;
|
||||
box-sizing: border-box;
|
||||
margin-bottom: 24rpx;
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
/* 上半:图标 + 设备名 + 状态 */
|
||||
.card-top {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.card-icon {
|
||||
width: 90rpx;
|
||||
height: 90rpx;
|
||||
border-radius: 24rpx;
|
||||
background-color: rgba(19, 133, 250, 0.1);
|
||||
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: 500;
|
||||
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;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
/* 单按钮:已连接态 */
|
||||
&.card-actions-single {
|
||||
justify-content: center;
|
||||
|
||||
.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 底部「添加设备」主按钮 */
|
||||
.add-btn {
|
||||
width: 580rpx;
|
||||
height: 88rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: #1385FA;
|
||||
border-radius: 44rpx;
|
||||
margin: 40rpx auto 0;
|
||||
|
||||
.add-btn-icon {
|
||||
width: 34rpx;
|
||||
height: 34rpx;
|
||||
border-radius: 50%;
|
||||
background-color: rgba(255, 255, 255, 0.3);
|
||||
margin-right: 16rpx;
|
||||
}
|
||||
|
||||
.add-btn-text {
|
||||
color: #FFFFFF;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
line-height: 32rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,38 @@
|
||||
Page({
|
||||
data: {},
|
||||
/** 已配对设备模型 */
|
||||
interface DeviceItem {
|
||||
/** 设备唯一 id */
|
||||
id: string
|
||||
/** 设备名称 */
|
||||
name: string
|
||||
/** 是否已连接 */
|
||||
connected: boolean
|
||||
}
|
||||
|
||||
onLoad() {},
|
||||
Page({
|
||||
data: {
|
||||
/* 已配对设备 mock 列表(后续接入真实接口时替换) */
|
||||
deviceList: [
|
||||
{ id: 'd1', name: '智能体重秤 Pro', connected: true },
|
||||
{ id: 'd2', name: '体重秤 Basic', connected: false },
|
||||
] as DeviceItem[],
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
/* 页面进入时无副作用,设备列表后续接入真实接口 */
|
||||
},
|
||||
|
||||
/* 点击「连接」:未连接卡片才会出现 —— 暂留空,待跳转逻辑接入 */
|
||||
onTapConnect() {
|
||||
// TODO: 跳转设备搜索/绑定流程
|
||||
},
|
||||
|
||||
/* 点击「成员管理」:暂留空,待成员管理页接入 */
|
||||
onTapMember() {
|
||||
// TODO: 跳转成员管理页
|
||||
},
|
||||
|
||||
/* 点击「添加设备」:暂留空,待跳转逻辑接入 */
|
||||
onTapAdd() {
|
||||
// TODO: 跳转设备搜索页
|
||||
},
|
||||
})
|
||||
|
||||
@@ -1,3 +1,59 @@
|
||||
<view class="container">
|
||||
<text>设备</text>
|
||||
<view class="equipment">
|
||||
|
||||
<!-- 副标题:已配对设备 -->
|
||||
<view class="section-title">已配对设备</view>
|
||||
|
||||
<!-- 设备卡片列表 -->
|
||||
<view class="device-list">
|
||||
<block wx:for="{{ deviceList }}" wx:key="id">
|
||||
<view class="device-card">
|
||||
|
||||
<!-- 上半:图标 + 设备名 + 状态(色点 + 文字) -->
|
||||
<view class="card-top">
|
||||
<view class="card-icon"></view>
|
||||
<view class="card-info">
|
||||
<view class="card-name">{{ item.name }}</view>
|
||||
<view class="card-status">
|
||||
<!-- 已连接:绿点 + "已连接" -->
|
||||
<block wx:if="{{ item.connected }}">
|
||||
<view class="card-dot card-dot-on"></view>
|
||||
<text class="card-status-text card-status-on">已连接</text>
|
||||
</block>
|
||||
<!-- 未连接:红点 + "未连接" -->
|
||||
<block wx:else>
|
||||
<view class="card-dot card-dot-off"></view>
|
||||
<text class="card-status-text card-status-off">未连接</text>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 分隔线 -->
|
||||
<view class="card-divider"></view>
|
||||
|
||||
<!-- 下半:操作按钮(单/双形态) -->
|
||||
<block wx:if="{{ item.connected }}">
|
||||
<!-- 已连接:单按钮居中 -->
|
||||
<view class="card-actions card-actions-single">
|
||||
<view class="btn-ghost-full" data-id="{{ item.id }}" bind:tap="onTapMember">成员管理</view>
|
||||
</view>
|
||||
</block>
|
||||
<block wx:else>
|
||||
<!-- 未连接:双按钮 连接 / 成员管理 -->
|
||||
<view class="card-actions card-actions-double">
|
||||
<view class="btn-ghost-half" data-id="{{ item.id }}" bind:tap="onTapConnect">连接</view>
|
||||
<view class="btn-ghost-half" data-id="{{ item.id }}" bind:tap="onTapMember">成员管理</view>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
|
||||
<!-- 底部「添加设备」主按钮 -->
|
||||
<view class="add-btn" bind:tap="onTapAdd">
|
||||
<view class="add-btn-icon"></view>
|
||||
<text class="add-btn-text">添加设备</text>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
.container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
}
|
||||
Reference in New Issue
Block a user