From 932654b706b75aab47346a3d8dc04882aa7a965b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8C=83=E9=B9=8F?= Date: Thu, 27 Feb 2025 11:29:53 +0800 Subject: [PATCH] v1.2.0.33 --- api/keyboardPwd.js | 9 +++++ manifest.json | 2 +- pages/adminDetail/adminDetail.vue | 4 +- pages/adminList/adminList.vue | 4 +- pages/autoLock/autoLock.vue | 6 ++- pages/faceSetting/faceSetting.vue | 52 +++++++++++++++++++------ pages/home/home.vue | 10 ++--- pages/keyDetail/keyDetail.vue | 4 +- pages/lockInfo/lockInfo.vue | 22 +++++++++++ pages/lockSound/lockSound.vue | 7 ++++ pages/setting/setting.vue | 49 +++++++++++++++++++---- pages/uploadLockData/uploadLockData.vue | 14 ++++--- stores/bluetooth.js | 4 +- utils/request.js | 4 +- 14 files changed, 148 insertions(+), 43 deletions(-) diff --git a/api/keyboardPwd.js b/api/keyboardPwd.js index cf869c0..05786c3 100644 --- a/api/keyboardPwd.js +++ b/api/keyboardPwd.js @@ -64,3 +64,12 @@ export function getPasswordRequest(data) { data }) } + +// 检查密码是否存在 +export function checkPasswordRequest(data) { + return request({ + url: '/keyboardPwd/checkKeyboardPwd', + method: 'POST', + data + }) +} diff --git a/manifest.json b/manifest.json index 295fa45..ddc94c3 100644 --- a/manifest.json +++ b/manifest.json @@ -3,7 +3,7 @@ "appid" : "__UNI__933D519", "description" : "", "versionName" : "1.2.0", - "versionCode" : "32", + "versionCode" : "33", "transformPx" : false, /* 小程序特有相关 */ "mp-weixin" : { diff --git a/pages/adminDetail/adminDetail.vue b/pages/adminDetail/adminDetail.vue index f0bf2a0..6cd36ea 100644 --- a/pages/adminDetail/adminDetail.vue +++ b/pages/adminDetail/adminDetail.vue @@ -339,7 +339,7 @@ title: '删除中', mask: true }) - const { code } = await deleteKeyRequest({ + const { code, message } = await deleteKeyRequest({ keyId: info.value.keyId, includeUnderlings: checked.value ? 1 : 0 }) @@ -351,7 +351,7 @@ } else { uni.hideLoading() uni.showToast({ - title: 'message', + title: message, icon: 'none' }) } diff --git a/pages/adminList/adminList.vue b/pages/adminList/adminList.vue index 0704ebe..e3f795d 100644 --- a/pages/adminList/adminList.vue +++ b/pages/adminList/adminList.vue @@ -148,7 +148,7 @@ title: '删除中', mask: true }) - const { code } = await deleteKeyRequest({ + const { code, message } = await deleteKeyRequest({ keyId: deleteData.value.keyId, includeUnderlings: checked.value ? 1 : 0 }) @@ -166,7 +166,7 @@ } else { uni.hideLoading() uni.showToast({ - title: 'message', + title: message, icon: 'none' }) } diff --git a/pages/autoLock/autoLock.vue b/pages/autoLock/autoLock.vue index 5df0ec2..1e49fe2 100644 --- a/pages/autoLock/autoLock.vue +++ b/pages/autoLock/autoLock.vue @@ -31,7 +31,7 @@ @change-input="changeDuration" > - + 经过以上设定的时间,锁会自动关闭。开启或修改设置后,请先开一次锁,使时间生效。 { if (!canUpdate.value) return + const netWork = await $basic.getNetworkType() + if (!netWork) { + return + } if (pending.value) return pending.value = true uni.showLoading({ diff --git a/pages/faceSetting/faceSetting.vue b/pages/faceSetting/faceSetting.vue index 3a5d219..e404eb4 100644 --- a/pages/faceSetting/faceSetting.vue +++ b/pages/faceSetting/faceSetting.vue @@ -12,29 +12,35 @@ 感应距离 - {{ distanceColumns[0][distanceIndex].text }} + {{ distanceColumns[0][distanceIndex].text }} - {{ distanceColumns[0][distanceIndex].name }} + {{ + distanceColumns[0][distanceIndex].name + }} 防误开 - {{ enErrUnlockColumns[0][enErrUnlock].text }} + {{ + enErrUnlockColumns[0][enErrUnlock].text + }} - {{ enErrUnlockColumns[0][enErrUnlock].name }} + {{ + enErrUnlockColumns[0][enErrUnlock].name + }} @@ -42,10 +48,12 @@ class="pos-fixed bottom-[calc(env(safe-area-inset-bottom)+48rpx)] mx-3 py-5 px-3 bg-white text-sm rounded-md" > 添加和使用面容开锁时: - 1、请尽量保持单人在门前操作; - 2、请站立在门锁正前方约0.5~0.8米,面向门锁; - 3、请保持脸部无遮挡,露出五官; - 4、面容识别异常时,可触摸数字键盘任意按键,手动重启人脸识别。 + 1、请尽量保持单人在门前操作; + 2、请站立在门锁正前方约0.5~0.8米,面向门锁; + 3、请保持脸部无遮挡,露出五官; + 4、面容识别异常时,可触摸数字键盘任意按键,手动重启人脸识别。 { + if (!check.value) return + showDistance.value = true + } + + const enErrUnlockDialog = () => { + if (!check.value || distance.value === 0) return + showEnErrUnlock.value = true + } + onMounted(() => { const list = [] for (let i = 0; i <= 30; i++) { @@ -143,6 +163,10 @@ const change = async (type, value) => { if (pending.value) return + const netWork = await $basic.getNetworkType() + if (!netWork) { + return + } pending.value = true uni.showLoading({ title: '设置中' @@ -168,8 +192,9 @@ ...$bluetooth.currentLockSetting, lockSettingInfo: { ...$bluetooth.currentLockSetting.lockSettingInfo, - autoLock: check.value ? 1 : 0, - autoLockSecond: value.value + faceSwitch: check.value ? 1 : 0, + faceInductionDistance: distance.value, + faceEnErrUnlock: enErrUnlock.value } }) uni.showToast({ @@ -182,6 +207,9 @@ icon: 'none' }) } + } else if (code === -21) { + pending.value = false + uni.hideLoading() } else { pending.value = false uni.hideLoading() diff --git a/pages/home/home.vue b/pages/home/home.vue index 6e35b2c..3202af0 100644 --- a/pages/home/home.vue +++ b/pages/home/home.vue @@ -329,7 +329,7 @@ } else { uni.hideLoading() uni.showToast({ - title: 'message', + title: message, icon: 'none' }) } @@ -341,7 +341,7 @@ }) } } else { - const { code } = await deleteKeyRequest({ + const { code, message } = await deleteKeyRequest({ keyId: that.keyId }) if (code === 0) { @@ -358,7 +358,7 @@ } else { uni.hideLoading() uni.showToast({ - title: 'message', + title: message, icon: 'none' }) } @@ -373,7 +373,7 @@ mask: true }) const that = this - const { code } = await deleteKeyRequest({ + const { code, message } = await deleteKeyRequest({ keyId: that.deleteLockInfo.keyId, includeUnderlings: that.checked ? 1 : 0 }) @@ -392,7 +392,7 @@ } else { uni.hideLoading() uni.showToast({ - title: 'message', + title: message, icon: 'none' }) } diff --git a/pages/keyDetail/keyDetail.vue b/pages/keyDetail/keyDetail.vue index 361cfd1..fe5890a 100644 --- a/pages/keyDetail/keyDetail.vue +++ b/pages/keyDetail/keyDetail.vue @@ -365,7 +365,7 @@ title: '删除中', mask: true }) - const { code } = await deleteKeyRequest({ + const { code, message } = await deleteKeyRequest({ keyId: $lock.currentKeyInfo.keyId, includeUnderlings: checked.value ? 1 : 0 }) @@ -381,7 +381,7 @@ } else { uni.hideLoading() uni.showToast({ - title: 'message', + title: message, icon: 'none' }) } diff --git a/pages/lockInfo/lockInfo.vue b/pages/lockInfo/lockInfo.vue index f730cd0..a54925c 100644 --- a/pages/lockInfo/lockInfo.vue +++ b/pages/lockInfo/lockInfo.vue @@ -141,6 +141,7 @@ import { updateAdminPasswordRequest, updateLockNameRequest } from '@/api/setting' import { useBasicStore } from '@/stores/basic' import { useUserStore } from '@/stores/user' + import { checkPasswordRequest } from '@/api/keyboardPwd' const $bluetooth = useBluetoothStore() const $lock = useLockStore() @@ -204,6 +205,24 @@ }) return } + const netWork = await $basic.getNetworkType() + if (!netWork) { + return + } + + const { code: checkCode, message } = await checkPasswordRequest({ + lockId: $bluetooth.currentLockInfo.lockId, + keyboardPwd: password + }) + + if (checkCode !== 0) { + uni.showToast({ + title: message, + icon: 'none' + }) + return + } + if (pending.value) return pending.value = true @@ -248,6 +267,9 @@ icon: 'none' }) } + } else if (code === -21) { + uni.hideLoading() + pending.value = false } else { uni.hideLoading() pending.value = false diff --git a/pages/lockSound/lockSound.vue b/pages/lockSound/lockSound.vue index 50419a6..630995e 100644 --- a/pages/lockSound/lockSound.vue +++ b/pages/lockSound/lockSound.vue @@ -73,6 +73,10 @@ const update = async () => { if (!canUpdate.value) return + const netWork = await $basic.getNetworkType() + if (!netWork) { + return + } if (pending.value) return pending.value = true uni.showLoading({ @@ -111,6 +115,9 @@ icon: 'none' }) } + } else if (code === -21) { + pending.value = false + uni.hideLoading() } else { pending.value = false uni.hideLoading() diff --git a/pages/setting/setting.vue b/pages/setting/setting.vue index e6c65b4..ae37782 100644 --- a/pages/setting/setting.vue +++ b/pages/setting/setting.vue @@ -122,7 +122,7 @@ { + const { code, data } = await $bluetooth.getLockDataList({ + type: 'setting', + lockId: $bluetooth.currentLockInfo.lockName.toString(), + uid: $user.userInfo.uid.toString() + }) + $bluetooth.closeBluetoothConnection() + if (code === 0) { + const { code: resultCode } = await lockDataUploadRequest({ + lockId: $bluetooth.currentLockInfo.lockId, + uploadType: 1, + records: data.list + }) + if (resultCode === 0) { + const { code, data } = await getLockSettingRequest({ + lockId: $bluetooth.currentLockInfo.lockId + }) + if (code === 0) { + $bluetooth.updateCurrentLockSetting(data) + } + } + } + } + const toUpdateSetting = key => { $basic.routeJump({ name: 'updateSetting', @@ -285,6 +314,10 @@ } const changeSetting = async key => { + const netWork = await $basic.getNetworkType() + if (!netWork) { + return + } if (pending.value) return pending.value = true uni.showLoading({ @@ -370,7 +403,7 @@ title: '删除中', mask: true }) - const { code } = await deleteKeyRequest({ + const { code, message } = await deleteKeyRequest({ keyId: $lock.keyId, includeUnderlings: checked.value ? 1 : 0 }) @@ -386,7 +419,7 @@ } else { uni.hideLoading() uni.showToast({ - title: 'message', + title: message, icon: 'none' }) } @@ -423,7 +456,7 @@ keyId: $bluetooth.keyId.toString() }) if (resetDeviceCode === 0 || resetDeviceCode === -2) { - const { code } = await deleteLockRequest({ + const { code, message } = await deleteLockRequest({ lockId: $bluetooth.currentLockInfo.lockId }) if (code === 0) { @@ -437,7 +470,7 @@ } else { uni.hideLoading() uni.showToast({ - title: 'message', + title: message, icon: 'none' }) } @@ -449,7 +482,7 @@ }) } } else { - const { code } = await deleteKeyRequest({ + const { code, message } = await deleteKeyRequest({ keyId: $bluetooth.keyId }) if (code === 0) { @@ -463,7 +496,7 @@ } else { uni.hideLoading() uni.showToast({ - title: 'message', + title: message, icon: 'none' }) } diff --git a/pages/uploadLockData/uploadLockData.vue b/pages/uploadLockData/uploadLockData.vue index 4f70b59..e8c11ec 100644 --- a/pages/uploadLockData/uploadLockData.vue +++ b/pages/uploadLockData/uploadLockData.vue @@ -18,7 +18,7 @@ import { ref } from 'vue' import { useBluetoothStore } from '@/stores/bluetooth' import { useUserStore } from '@/stores/user' - import { lockDataUploadRequest } from '@/api/setting' + import { getLockSettingRequest, lockDataUploadRequest } from '@/api/setting' const $bluetooth = useBluetoothStore() const $user = useUserStore() @@ -56,6 +56,12 @@ pending.value = false $bluetooth.closeBluetoothConnection() if (resultCode === 0) { + const { code, data } = await getLockSettingRequest({ + lockId: $bluetooth.currentLockInfo.lockId + }) + if (code === 0) { + $bluetooth.updateCurrentLockSetting(data) + } uni.showToast({ title: '上传成功', icon: 'none' @@ -71,10 +77,6 @@ list.value = list.value.concat(data.list) if (data.size === 10) { page.value++ - } else if (data.size === 0) { - page.value = 0 - list.value = [] - progress.value++ } else { const { code: resultCode } = await lockDataUploadRequest({ lockId: $bluetooth.currentLockInfo.lockId, @@ -92,7 +94,7 @@ }) return } - page.value = 1 + page.value = 0 list.value = [] progress.value++ } diff --git a/stores/bluetooth.js b/stores/bluetooth.js index cc74c33..131f2ef 100644 --- a/stores/bluetooth.js +++ b/stores/bluetooth.js @@ -2724,7 +2724,7 @@ export const useBluetoothStore = defineStore('ble', { console.log('写入未执行', this.bluetoothStatus) this.getBluetoothStatus() return { - code: -1 + code: -21 } } @@ -2820,7 +2820,7 @@ export const useBluetoothStore = defineStore('ble', { console.log('写入未执行', this.bluetoothStatus) this.getBluetoothStatus() return { - code: -1 + code: -21 } } diff --git a/utils/request.js b/utils/request.js index ba1c446..28be732 100644 --- a/utils/request.js +++ b/utils/request.js @@ -29,13 +29,13 @@ const request = config => { const timestamp = new Date().getTime() timer = setTimeout(() => { resolve({ code: -1, message: '网络访问失败,请检查网络是否正常' }) - }, 3200) + }, 7200) uni.request({ url: URL, method, header, data, - timeout: 3000, + timeout: 7000, async success(res) { const { statusCode, data } = res if (timer) {