Compare commits
2
Commits
c0bc61621b
...
d5b1bfb31a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d5b1bfb31a | ||
|
|
322440b9c7 |
@@ -39,6 +39,8 @@ let connectCleanup: {
|
||||
/** 一次性防重入标记 */
|
||||
let modalLocked = false
|
||||
let autoConnectTried = false
|
||||
/** 进入页面时是否已连接(返回时恢复被扫描打断的连接) */
|
||||
let enteredConnected = false
|
||||
|
||||
Page({
|
||||
data: {
|
||||
@@ -46,6 +48,10 @@ Page({
|
||||
deviceList: [] as DeviceItem[],
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
enteredConnected = leFuService.isConnected
|
||||
},
|
||||
|
||||
onShow() {
|
||||
// 从其他页面返回时同步连接状态
|
||||
if (leFuService.isConnected) {
|
||||
@@ -67,6 +73,10 @@ Page({
|
||||
leFuService.stopScan()
|
||||
this._clearSubscriptions()
|
||||
this._clearConnectCleanup()
|
||||
// 进入前已连接、扫描打断连接后返回:恢复原连接
|
||||
if (enteredConnected) {
|
||||
leFuService.autoConnect()
|
||||
}
|
||||
},
|
||||
|
||||
/** 点击「开始 / 重新搜索」 */
|
||||
|
||||
@@ -24,10 +24,10 @@
|
||||
</view>
|
||||
|
||||
<!-- 帮助文案 -->
|
||||
<view class="help">
|
||||
<!-- <view class="help">
|
||||
<view class="help-text">找不到设备?</view>
|
||||
<view class="help-link" bind:tap="onOpenHelp">检查附近设备权限</view>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<!-- 搜索结果模块:found / empty 时整体显示 -->
|
||||
<block wx:if="{{ status === 'found' || status === 'empty' }}">
|
||||
@@ -76,7 +76,7 @@
|
||||
<view class="card-btn-primary" data-index="{{ index }}" catch:tap="onConnect">连接</view>
|
||||
</block>
|
||||
</view>
|
||||
<view class="device-card-bottom">deviceId:{{ item.deviceId }}</view>
|
||||
<!-- <view class="device-card-bottom">deviceId:{{ item.deviceId }}</view> -->
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
|
||||
Reference in New Issue
Block a user