fix: 优化上传锁数据逻辑,确保上传失败时重置进度和列表状态

This commit is contained in:
fanpeng 2025-07-08 16:19:19 +08:00
parent a7379fafc3
commit d3a848d75a

View File

@ -58,13 +58,12 @@
uploadType: 1, uploadType: 1,
records: data.list records: data.list
}) })
pending.value = false
$bluetooth.closeBluetoothConnection() $bluetooth.closeBluetoothConnection()
if (resultCode === 0) { if (resultCode === 0) {
const { code, data } = await getLockSettingRequest({ const { code, data } = await getLockSettingRequest({
lockId: $bluetooth.currentLockInfo.lockId lockId: $bluetooth.currentLockInfo.lockId
}) })
pending.value = false
if (code === 0) { if (code === 0) {
if (data.lockSettingInfo.catEyeConfig[0]) { if (data.lockSettingInfo.catEyeConfig[0]) {
data.lockSettingInfo.catEyeConfig[0].catEyeModeConfig.recordTime = Number( data.lockSettingInfo.catEyeConfig[0].catEyeModeConfig.recordTime = Number(
@ -82,12 +81,16 @@
icon: 'none' icon: 'none'
}) })
} else { } else {
pending.value = false
uni.hideLoading() uni.hideLoading()
uni.showToast({ uni.showToast({
title: '上传失败,请重试', title: '上传失败,请重试',
icon: 'none' icon: 'none'
}) })
} }
progress.value = 0
page.value = 0
list.value = []
return return
} }
list.value = list.value.concat(data.list) list.value = list.value.concat(data.list)
@ -114,6 +117,9 @@
title: '上传失败,请重试', title: '上传失败,请重试',
icon: 'none' icon: 'none'
}) })
progress.value = 0
page.value = 0
list.value = []
return return
} }
page.value = 0 page.value = 0
@ -125,6 +131,9 @@
pending.value = false pending.value = false
$bluetooth.closeBluetoothConnection() $bluetooth.closeBluetoothConnection()
uni.hideLoading() uni.hideLoading()
progress.value = 0
page.value = 0
list.value = []
} else { } else {
pending.value = false pending.value = false
$bluetooth.closeBluetoothConnection() $bluetooth.closeBluetoothConnection()
@ -133,6 +142,9 @@
title: '上传失败,请保持在锁附近', title: '上传失败,请保持在锁附近',
icon: 'none' icon: 'none'
}) })
progress.value = 0
page.value = 0
list.value = []
} }
} }
</script> </script>