From a73c550bbbee62a06422379a6ef1247025f6f725 Mon Sep 17 00:00:00 2001 From: fanpeng <438123081@qq.com> Date: Mon, 7 Jul 2025 10:00:44 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=80=82=E9=85=8D=E8=85=BE=E8=AE=AF?= =?UTF-8?q?=E4=BA=91=E9=94=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/main/lockDetail.vue | 99 +++++++++++++++++++++++++++++++---- pages/p2p/authorizeWechat.vue | 41 --------------- 2 files changed, 88 insertions(+), 52 deletions(-) diff --git a/pages/main/lockDetail.vue b/pages/main/lockDetail.vue index 3cc70b9..f68c6be 100644 --- a/pages/main/lockDetail.vue +++ b/pages/main/lockDetail.vue @@ -78,7 +78,10 @@ @@ -91,7 +94,8 @@ 监控 @@ -217,7 +229,10 @@ 门锁记录 @@ -240,7 +255,11 @@ - + 设置 + 删除 + { + const netWork = await $basic.getNetworkType() + if (!netWork) { + return + } + + const message = '删除锁后,所有信息都会一起删除,确定删除锁吗?' + + uni.showModal({ + title: '提示', + content: message, + async success(res) { + if (res.confirm) { + uni.showLoading({ + title: '删除中' + }) + const { code: resetDeviceCode } = await $bluetooth.resetDevice({ + name: $bluetooth.currentLockInfo.name, + authUid: $user.userInfo.uid.toString(), + keyId: $bluetooth.keyId.toString() + }) + if (resetDeviceCode === 0 || resetDeviceCode === -2) { + const { code, message } = await deleteLockRequest({ + lockId: $bluetooth.currentLockInfo.lockId + }) + if (code === 0) { + uni.hideLoading() + $lock.updateLockSearch({ + ...$lock.lockSearch, + pageNo: 1 + }) + $lock.getLockList($lock.lockSearch) + $basic.backAndToast('删除成功', 1) + } else { + uni.hideLoading() + uni.showToast({ + title: message, + icon: 'none' + }) + } + } else if (resetDeviceCode === -1) { + uni.hideLoading() + uni.showToast({ + title: '删除失败,请保持在锁附近', + icon: 'none' + }) + } + } + } + }) + }