[AI Generated]: refactor(Views): 重构连接设备页搜索结果区为统一模块容器
This commit is contained in:
@@ -22,59 +22,63 @@
|
||||
<text class="help-link" bind:tap="onOpenHelp">查看帮助</text>
|
||||
</view>
|
||||
|
||||
<!-- 搜索完成态:头部"搜索结果 / 发现 X 台设备" -->
|
||||
<block wx:if="{{ status === 'found' || status === 'empty' }}">
|
||||
<view class="search-device">
|
||||
<!-- 搜索结果模块:found / empty 时整体显示 -->
|
||||
<view
|
||||
wx:if="{{ status === 'found' || status === 'empty' }}"
|
||||
class="search-device"
|
||||
>
|
||||
|
||||
<!-- 头部:标题 + 计数 -->
|
||||
<view class="search-device-header">
|
||||
<text class="search-device-title">搜索结果</text>
|
||||
<view class="search-device-count">
|
||||
<text class="resultHeader__countText">发现</text>
|
||||
<text class="resultHeader__countNum">{{ status === 'found' ? (deviceList.length + (connectedDevice ? 1 : 0)) : 0 }}</text>
|
||||
<text class="resultHeader__countText"> 台设备</text>
|
||||
<text class="count-text">发现</text>
|
||||
<text class="count-num">{{ status === 'found' ? (deviceList.length + (connectedDevice ? 1 : 0)) : 0 }}</text>
|
||||
<text class="count-text"> 台设备</text>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!-- 空状态:暂未搜索到设备 -->
|
||||
<block wx:if="{{ status === 'empty' }}">
|
||||
<view class="empty">
|
||||
<!-- 空状态 -->
|
||||
<view wx:if="{{ status === 'empty' }}" class="empty">
|
||||
<view class="empty-image"></view>
|
||||
<view class="empty-text">暂未搜索到可用设备,请重新搜索</view>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!-- 找到设备:已连接卡片 + 未连接列表 -->
|
||||
<block wx:if="{{ status === 'found' }}">
|
||||
<!-- 找到设备:已连接卡片 + 未连接列表 -->
|
||||
<block wx:if="{{ status === 'found' }}">
|
||||
|
||||
<!-- 已连接卡片 -->
|
||||
<view wx:if="{{ connectedDevice }}" class="connectedCard">
|
||||
<view class="deviceCard__icon"></view>
|
||||
<view class="connectedCard__info">
|
||||
<view class="connectedCard__name">{{ connectedDevice.name }}</view>
|
||||
<view class="connectedCard__status">
|
||||
<view class="connectedCard__dot"></view>
|
||||
<text class="connectedCard__statusText">已连接</text>
|
||||
<!-- 已连接卡片 -->
|
||||
<view wx:if="{{ connectedDevice }}" class="connected-card">
|
||||
<view class="card-icon"></view>
|
||||
<view class="card-info">
|
||||
<view class="card-name">{{ connectedDevice.name }}</view>
|
||||
<view class="card-status">
|
||||
<view class="card-dot"></view>
|
||||
<text class="card-status-text">已连接</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="card-btn-danger" bind:tap="onDisconnect">断开连接</view>
|
||||
</view>
|
||||
|
||||
<!-- 未连接列表 -->
|
||||
<view class="device-list">
|
||||
<view
|
||||
wx:for="{{ deviceList }}"
|
||||
wx:key="id"
|
||||
class="device-card"
|
||||
>
|
||||
<view class="card-icon"></view>
|
||||
<view class="card-name">{{ item.name }}</view>
|
||||
<view
|
||||
class="card-btn-primary"
|
||||
data-id="{{ item.id }}"
|
||||
bind:tap="onConnect"
|
||||
>连接</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="connectedCard__btn" bind:tap="onDisconnect">断开连接</view>
|
||||
</view>
|
||||
|
||||
<!-- 未连接列表 -->
|
||||
<view class="deviceList">
|
||||
<view
|
||||
wx:for="{{ deviceList }}"
|
||||
wx:key="id"
|
||||
class="deviceCard"
|
||||
>
|
||||
<view class="deviceCard__icon"></view>
|
||||
<view class="deviceCard__name">{{ item.name }}</view>
|
||||
<view
|
||||
class="deviceCard__btn"
|
||||
data-id="{{ item.id }}"
|
||||
bind:tap="onConnect"
|
||||
>连接</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
</block>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
Reference in New Issue
Block a user