feat:【开锁页-设置-上传数据问题1】

https://www.tapd.cn/tapd_fe/69273997/bug/detail/1169273997001004065
This commit is contained in:
Liuyf 2025-03-06 19:05:48 +08:00
parent 093b9a8241
commit b844a1afe6
2 changed files with 23 additions and 4 deletions

View File

@ -2,7 +2,7 @@
<view>
<view class="mx-4 pt-5 text-base">
<view class="text-sm">
<view> 本操作将上传锁内数据到服务器过程可能需要几分钟请耐心等待 </view>
<view> 本操作将上传锁内数据到服务器过程可能需要几分钟请耐心等待</view>
</view>
<view
@click="asyncData"
@ -19,9 +19,11 @@
import { useBluetoothStore } from '@/stores/bluetooth'
import { useUserStore } from '@/stores/user'
import { getLockSettingRequest, lockDataUploadRequest } from '@/api/setting'
import { useBasicStore } from '@/stores/basic'
const $bluetooth = useBluetoothStore()
const $user = useUserStore()
const $basic = useBasicStore()
const progress = ref(0)
const page = ref(0)
@ -34,6 +36,10 @@
const asyncData = async (flag = false) => {
if (pending.value && !flag) return
const netWork = await $basic.getNetworkType()
if (!netWork) {
return
}
pending.value = true
uni.showLoading({
title: `上传中${progress.value}/7`
@ -45,6 +51,7 @@
uid: $user.userInfo.uid.toString(),
countReq: 10
})
console.log('code value :', code)
if (code === 0) {
if (typeList[progress.value] === 'setting') {
const { code: resultCode } = await lockDataUploadRequest({
@ -61,8 +68,12 @@
})
if (code === 0) {
if (data.lockSettingInfo.catEyeConfig[0]) {
data.lockSettingInfo.catEyeConfig[0].catEyeModeConfig.recordTime =Number(data.lockSettingInfo.catEyeConfig[0].catEyeModeConfig.recordTime)
data.lockSettingInfo.catEyeConfig[0].catEyeModeConfig.detectionDistance = Number(data.lockSettingInfo.catEyeConfig[0].catEyeModeConfig.detectionDistance)
data.lockSettingInfo.catEyeConfig[0].catEyeModeConfig.recordTime = Number(
data.lockSettingInfo.catEyeConfig[0].catEyeModeConfig.recordTime
)
data.lockSettingInfo.catEyeConfig[0].catEyeModeConfig.detectionDistance = Number(
data.lockSettingInfo.catEyeConfig[0].catEyeModeConfig.detectionDistance
)
}
$bluetooth.updateCurrentLockSetting(data)
}
@ -103,6 +114,14 @@
progress.value++
}
await asyncData(true)
} else if (code === -21 || code === -4) {
pending.value = false
$bluetooth.closeBluetoothConnection()
uni.hideLoading()
uni.showToast({
title: '蓝牙未打开或在访问附近设备权限未开启',
icon: 'none'
})
} else {
pending.value = false
$bluetooth.closeBluetoothConnection()

View File

@ -3030,7 +3030,7 @@ export const useBluetoothStore = defineStore('ble', {
console.log('写入未执行', this.bluetoothStatus)
this.getBluetoothStatus()
return {
code: -1
code: -21
}
}