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