1. 修复重置提示显示后立即消失bug

2. 添加连接设备失败重试逻辑
3. 设置页显示超级管理员可用时间
This commit is contained in:
范鹏 2024-09-06 09:46:08 +08:00
parent 47cac685ab
commit 452d7e5ffe
5 changed files with 10 additions and 16 deletions

View File

@ -185,7 +185,7 @@
authUid: that.userInfo.uid.toString(), authUid: that.userInfo.uid.toString(),
keyId: that.keyId.toString() keyId: that.keyId.toString()
}) })
if(resetDeviceCode === 0) { if(resetDeviceCode === 0 || resetDeviceCode === -2) {
const { code, message } = await deleteLockRequest({ const { code, message } = await deleteLockRequest({
lockId: that.currentLockInfo.lockId lockId: that.currentLockInfo.lockId
}) })
@ -213,8 +213,6 @@
title: '删除失败,请保持在锁附近', title: '删除失败,请保持在锁附近',
icon: 'none' icon: 'none'
}) })
} else {
uni.hideLoading()
} }
} else { } else {
const { code } = await deleteKeyRequest({ const { code } = await deleteKeyRequest({

View File

@ -106,8 +106,6 @@ export default {
title: '删除失败,请保持在锁附近', title: '删除失败,请保持在锁附近',
icon: 'none' icon: 'none'
}) })
} else {
uni.hideLoading()
} }
} }
} }

View File

@ -151,8 +151,6 @@ export default {
title: '删除失败,请保持在锁附近', title: '删除失败,请保持在锁附近',
icon: 'none' icon: 'none'
}) })
} else {
uni.hideLoading()
} }
} }
} }
@ -211,8 +209,6 @@ export default {
title: '重置密码失败,请保持在锁附近', title: '重置密码失败,请保持在锁附近',
icon: 'none' icon: 'none'
}) })
} else {
uni.hideLoading()
} }
} }
} }

View File

@ -38,7 +38,7 @@
</view> </view>
</view> </view>
</view> </view>
<view class="view" v-if="currentLockInfo.userType !== 110301"> <view class="view">
<view v-if="currentLockInfo.keyType === 4"> <view v-if="currentLockInfo.keyType === 4">
<view class="view-button"> <view class="view-button">
<view>有效期</view> <view>有效期</view>
@ -204,7 +204,7 @@ export default {
authUid: that.userInfo.uid.toString(), authUid: that.userInfo.uid.toString(),
keyId: that.keyId.toString() keyId: that.keyId.toString()
}) })
if(resetDeviceCode === 0) { if(resetDeviceCode === 0 || resetDeviceCode === -2) {
const { code, message } = await deleteLockRequest({ const { code, message } = await deleteLockRequest({
lockId: that.currentLockInfo.lockId lockId: that.currentLockInfo.lockId
}) })
@ -216,7 +216,6 @@ export default {
}) })
that.getLockList(that.lockSearch) that.getLockList(that.lockSearch)
that.backAndToast('删除成功', 2) that.backAndToast('删除成功', 2)
uni.navigateBack()
} else { } else {
uni.hideLoading() uni.hideLoading()
uni.showToast({ uni.showToast({
@ -230,8 +229,6 @@ export default {
title: '删除失败,请保持在锁附近', title: '删除失败,请保持在锁附近',
icon: 'none' icon: 'none'
}) })
} else {
uni.hideLoading()
} }
} else { } else {
const { code } = await deleteKeyRequest({ const { code } = await deleteKeyRequest({

View File

@ -609,7 +609,7 @@ export const useBluetoothStore = defineStore('ble', {
}) })
}, },
// 连接蓝牙设备+获取设备服务+获取设备特征值 // 连接蓝牙设备+获取设备服务+获取设备特征值
connectBluetoothDevice() { connectBluetoothDevice(number = 0) {
const that = this const that = this
return new Promise((resolve) => { return new Promise((resolve) => {
if(that.bluetoothStatus !== 0) { if(that.bluetoothStatus !== 0) {
@ -681,11 +681,15 @@ export const useBluetoothStore = defineStore('ble', {
} }
}) })
}, },
fail(res) { async fail(res) {
if(res.errno === 1509007) { if(res.errno === 1509007) {
resolve(true) resolve(true)
return return
} }
if(res.errno === 1509001 && number < 1) {
// 重新连接
resolve(await that.connectBluetoothDevice(number + 1))
}
uni.showToast({ uni.showToast({
title: '连接失败,请靠近设备并保持设备处于唤醒状态', title: '连接失败,请靠近设备并保持设备处于唤醒状态',
icon: 'none' icon: 'none'
@ -781,6 +785,7 @@ export const useBluetoothStore = defineStore('ble', {
uni.stopBluetoothDevicesDiscovery() uni.stopBluetoothDevicesDiscovery()
clearTimeout(timer2) clearTimeout(timer2)
clearInterval(timer1) clearInterval(timer1)
uni.hideLoading()
uni.showToast({ uni.showToast({
title: '锁已被重置,请重新绑定', title: '锁已被重置,请重新绑定',
icon: 'none' icon: 'none'