86 lines
3.4 KiB
Plaintext
86 lines
3.4 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>
|
|
|
|
<!-- 设备配置弹窗 -->
|
|
<view class="config-modal" wx:if="{{showConfigModal}}">
|
|
<view class="modal-mask" bindtap="handleCancelConfig"></view>
|
|
<view class="modal-content">
|
|
<view class="modal-header">
|
|
<text class="modal-title">配置设备</text>
|
|
</view>
|
|
|
|
<view class="modal-body">
|
|
<view class="config-item">
|
|
<text class="config-label">设备名称</text>
|
|
<input class="config-input" placeholder="给设备起个名字" value="{{configForm.name}}" bindinput="onConfigInput" data-field="name" />
|
|
</view>
|
|
|
|
<view class="config-item">
|
|
<text class="config-label">设备编号 (SN)</text>
|
|
<input class="config-input" placeholder="设备唯一标识" value="{{configForm.serialNumber}}" bindinput="onConfigInput" data-field="serialNumber" />
|
|
</view>
|
|
|
|
<view class="config-item">
|
|
<text class="config-label">产品ID</text>
|
|
<input class="config-input" type="number" placeholder="岩安测控 产品ID" value="{{configForm.productId}}" bindinput="onConfigInput" data-field="productId" />
|
|
</view>
|
|
|
|
<view class="config-item">
|
|
<text class="config-label">产品密钥</text>
|
|
<input class="config-input" placeholder="用于 MQTT 认证" value="{{configForm.productSecret}}" bindinput="onConfigInput" data-field="productSecret" />
|
|
</view>
|
|
|
|
<view class="config-item">
|
|
<text class="config-label">BLE 服务 UUID (可选)</text>
|
|
<input class="config-input" placeholder="用于过滤扫描结果" value="{{configForm.serviceUUID}}" bindinput="onConfigInput" data-field="serviceUUID" />
|
|
</view>
|
|
</view>
|
|
|
|
<view class="modal-footer">
|
|
<button class="btn-cancel" bindtap="handleCancelConfig">取消</button>
|
|
<button class="btn-confirm" bindtap="handleConfirmConfig" loading="{{configuring}}">确认保存</button>
|
|
</view>
|
|
</view>
|
|
</view> |