Compare commits

..
2 Commits
Author SHA1 Message Date
17792275749andClaude Opus 4.7 d5b1bfb31a chore(connectedDevice): 隐藏帮助文案与 deviceId 调试信息
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-09-01 12:42:01 +08:00
17792275749andClaude Opus 4.7 322440b9c7 fix(connectedDevice): 返回时恢复被扫描打断的连接
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-09-01 12:41:58 +08:00
2 changed files with 13 additions and 3 deletions
@@ -39,6 +39,8 @@ let connectCleanup: {
/** 一次性防重入标记 */ /** 一次性防重入标记 */
let modalLocked = false let modalLocked = false
let autoConnectTried = false let autoConnectTried = false
/** 进入页面时是否已连接(返回时恢复被扫描打断的连接) */
let enteredConnected = false
Page({ Page({
data: { data: {
@@ -46,6 +48,10 @@ Page({
deviceList: [] as DeviceItem[], deviceList: [] as DeviceItem[],
}, },
onLoad() {
enteredConnected = leFuService.isConnected
},
onShow() { onShow() {
// 从其他页面返回时同步连接状态 // 从其他页面返回时同步连接状态
if (leFuService.isConnected) { if (leFuService.isConnected) {
@@ -67,6 +73,10 @@ Page({
leFuService.stopScan() leFuService.stopScan()
this._clearSubscriptions() this._clearSubscriptions()
this._clearConnectCleanup() this._clearConnectCleanup()
// 进入前已连接、扫描打断连接后返回:恢复原连接
if (enteredConnected) {
leFuService.autoConnect()
}
}, },
/** 点击「开始 / 重新搜索」 */ /** 点击「开始 / 重新搜索」 */
@@ -24,10 +24,10 @@
</view> </view>
<!-- 帮助文案 --> <!-- 帮助文案 -->
<view class="help"> <!-- <view class="help">
<view class="help-text">找不到设备?</view> <view class="help-text">找不到设备?</view>
<view class="help-link" bind:tap="onOpenHelp">检查附近设备权限</view> <view class="help-link" bind:tap="onOpenHelp">检查附近设备权限</view>
</view> </view> -->
<!-- 搜索结果模块:found / empty 时整体显示 --> <!-- 搜索结果模块:found / empty 时整体显示 -->
<block wx:if="{{ status === 'found' || status === 'empty' }}"> <block wx:if="{{ status === 'found' || status === 'empty' }}">
@@ -76,7 +76,7 @@
<view class="card-btn-primary" data-index="{{ index }}" catch:tap="onConnect">连接</view> <view class="card-btn-primary" data-index="{{ index }}" catch:tap="onConnect">连接</view>
</block> </block>
</view> </view>
<view class="device-card-bottom">deviceId{{ item.deviceId }}</view> <!-- <view class="device-card-bottom">deviceId{{ item.deviceId }}</view> -->
</view> </view>
</block> </block>
</view> </view>