fix(device): 修复设备切换连接订阅累积与自动重连,连接后更新缓存

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
17792275749
2026-08-24 17:06:27 +08:00
co-authored by Claude Sonnet 4.6
parent 6ffda3f3f3
commit f750d15150
4 changed files with 120 additions and 25 deletions
+30 -11
View File
@@ -1,9 +1,9 @@
<view class="equipment">
<!-- 运维模式提示行 -->
<!-- <view class="ops-bar">-->
<!-- <view class="ops-mode">当前为:运维模式</view>-->
<!-- <view class="ops-btn ops-btn&#45;&#45;blue" bind:tap="onCloseOps">关闭运维模式</view>-->
<!-- </view>-->
<view class="ops-bar">
<view class="ops-mode">当前为:运维模式</view>
<view class="ops-btn ops-btn--blue" bind:tap="onCloseOps">关闭运维模式</view>
</view>
<!-- 顶部卡片(渐变背景 + 设备图片占位) -->
<view class="top-banner">
@@ -22,17 +22,26 @@
</view>
<!-- 设备列表 -->
<!-- <view class="device">
<scroll-view class="scrollView" scroll-y>
<view class="scrollViewContent">
</view>
</scroll-view>
</view> -->
<block wx:if="{{ devices && devices.length }}">
<block wx:for="{{ devices }}" wx:key="id">
<view class="device-card">
<view class="device-top">
<view class="device-icon"></view>
<view class="device-icon">
<image src="/images/device/{{ item.name }}.png"/>
</view>
<view class="device-info">
<view class="device-info_">
<view class="device-name">{{ item.name }}</view>
<view class="device-unpair" bind:tap="onTapUnpair">取消配对</view>
</view>
<view class="device-status">
<view class="device-status" bind:tap="onTapStatus" data-item="{{ item }}">
<view class="device-status_ {{item.status ? 'connected' : ''}}">
<view class="status-dot"></view>
<view class="status-text">{{ item.status ? '已连接' : '未连接' }}</view>
@@ -53,12 +62,22 @@
</view>
<view class="device-actions">
<view class="device-action-btn">
<view>
<image src="/images/equipment/wifi.png"/>
<block wx:if="{{item.status}}">
<view class="device-action-btn">
<view>
<image src="/images/equipment/wifi.png"/>
</view>
<view>设备WIFI</view>
</view>
<view>设备WIFI</view>
</view>
</block>
<block wx:else>
<view class="device-action-btn" bind:tap="onTapStatus" data-item="{{ item }}">
<view>
<image src="/images/equipment/bluetooth.png"/>
</view>
<view>设备连接</view>
</view>
</block>
<view class="device-action-btn" bind:tap="onTapUser">
<view>
<image src="/images/equipment/users.png"/>