[AI Generated]: feat(Views): 新增连接设备页三态(idle/searching/found/empty)及登录跳转

This commit is contained in:
17792275749
2026-05-11 15:14:54 +08:00
parent f7e7f7c561
commit 55911b1fce
6 changed files with 439 additions and 7 deletions
@@ -1 +1,80 @@
<view class="page">connectedDevice 占位</view>
<view class="connected-device">
<!-- 三层同心圆动画占位 -->
<view class="ripple"></view>
<!-- 主标题 -->
<view class="title">
{{ status === 'idle' ? '搜索附近设备' : '搜索附近设备中...' }}
</view>
<!-- 副标题 -->
<view class="sub-title">请确保蓝牙已开启,设备处于待机状态</view>
<!-- 主按钮:idle 显示开始搜索,其他显示重新搜索 -->
<view class="search-btn" bind:tap="onStartSearch">
{{ status === 'idle' ? '开始搜索' : '重新搜索' }}
</view>
<!-- 帮助文案 -->
<view class="help">
<text class="help-text">无法配对设备?</text>
<text class="help-link" bind:tap="onOpenHelp">查看帮助</text>
</view>
<!-- 搜索完成态:头部"搜索结果 / 发现 X 台设备" -->
<block wx:if="{{ status === 'found' || status === 'empty' }}">
<view class="search-device">
<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">&nbsp;台设备</text>
</view>
</view>
</block>
<!-- 空状态:暂未搜索到设备 -->
<block wx:if="{{ status === 'empty' }}">
<view class="empty">
<view class="empty-image"></view>
<view class="empty-text">暂未搜索到可用设备,请重新搜索</view>
</view>
</block>
<!-- 找到设备:已连接卡片 + 未连接列表 -->
<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>
</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>
</view>