46 lines
1.6 KiB
Plaintext
46 lines
1.6 KiB
Plaintext
<!-- 扫描设备页面 -->
|
|
<view class="container">
|
|
<!-- 扫描状态 -->
|
|
<view class="scan-status card">
|
|
<view class="status-icon">
|
|
<image class="ble-icon" src="/assets/images/ble-scan.png" mode="aspectFit"></image>
|
|
<view class="scan-animation {{scanning ? 'scanning' : ''}}"></view>
|
|
</view>
|
|
<text class="status-text">{{statusText}}</text>
|
|
<text class="status-hint">{{statusHint}}</text>
|
|
</view>
|
|
|
|
<!-- 扫描结果列表 -->
|
|
<view class="device-list" wx:if="{{scannedDevices.length > 0}}">
|
|
<view class="list-header">
|
|
<text>发现设备 ({{scannedDevices.length}})</text>
|
|
<text class="hint">点击连接,名称可选填</text>
|
|
</view>
|
|
|
|
<view class="scanned-item" wx:for="{{scannedDevices}}" wx:key="deviceId" bindtap="handleSelectDevice" data-index="{{index}}">
|
|
<view class="item-main">
|
|
<text class="item-name">{{item.name || '未知设备'}}</text>
|
|
<text class="item-id">{{item.deviceId}}</text>
|
|
</view>
|
|
<view class="item-rssi">
|
|
<text>{{item.RSSI}} dBm</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- 空状态 -->
|
|
<view class="empty" wx:elif="{{!scanning}}">
|
|
<text class="empty-text">未发现设备</text>
|
|
<text class="empty-hint">请确保设备已开机且在附近</text>
|
|
</view>
|
|
|
|
<!-- 底部按钮 -->
|
|
<view class="btn-group">
|
|
<button class="btn-scan" bindtap="handleScan" loading="{{scanning}}" disabled="{{scanning}}">
|
|
{{scanning ? '扫描中...' : '开始扫描'}}
|
|
</button>
|
|
<button class="btn-stop" wx:if="{{scanning}}" bindtap="handleStopScan">停止</button>
|
|
</view>
|
|
</view>
|
|
|