fix(equipment): 取消配对时断开当前连接设备并清缓存
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
5b9a66afc7
commit
5a6281c9d8
@@ -155,6 +155,10 @@ Page({
|
||||
if (!res.confirm) return
|
||||
unbindDevice(item.id)
|
||||
.then(() => {
|
||||
// 取消配对的是当前连接的设备:断开连接并清缓存
|
||||
if (leFuService.isConnected && leFuService.lastRawDevice?.deviceId === item.deviceId) {
|
||||
leFuService.disconnect()
|
||||
}
|
||||
const cached = wx.getStorageSync('connectDeviceInfo') as Record<string, any> | null
|
||||
if (cached?.deviceId === item.deviceId) {
|
||||
wx.removeStorageSync('connectDeviceInfo')
|
||||
@@ -359,6 +363,10 @@ Page({
|
||||
if (!res.confirm) return
|
||||
unbindDevice()
|
||||
.then(() => {
|
||||
// 取消全部配对:断开当前连接并清缓存
|
||||
if (leFuService.isConnected) {
|
||||
leFuService.disconnect()
|
||||
}
|
||||
wx.removeStorageSync('connectDeviceInfo')
|
||||
wx.showToast({ title: '已取消全部配对', icon: 'success' })
|
||||
this.loadDevices()
|
||||
|
||||
Reference in New Issue
Block a user