85 lines
2.4 KiB
Plaintext
85 lines
2.4 KiB
Plaintext
<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>
|
|
|
|
<!-- 搜索结果模块: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="count-text">发现</text>
|
|
<text class="count-num">{{ status === 'found' ? (deviceList.length + (connectedDevice ? 1 : 0)) : 0 }}</text>
|
|
<text class="count-text"> 台设备</text>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- 空状态 -->
|
|
<view wx:if="{{ status === 'empty' }}" class="empty">
|
|
<view class="empty-image"></view>
|
|
<view class="empty-text">暂未搜索到可用设备,请重新搜索</view>
|
|
</view>
|
|
|
|
<!-- 找到设备:已连接卡片 + 未连接列表 -->
|
|
<block wx:if="{{ status === 'found' }}">
|
|
|
|
<!-- 已连接卡片 -->
|
|
<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>
|
|
|
|
</block>
|
|
|
|
</view>
|
|
|
|
</view>
|