From fafb06a8b5b63700230e546459430d553b2c3c3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8C=83=E9=B9=8F?= Date: Wed, 26 Feb 2025 19:00:14 +0800 Subject: [PATCH 1/2] =?UTF-8?q?1.=20=E5=AE=8C=E6=88=90=E7=8C=AB=E7=9C=BC?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E7=9B=B8=E5=85=B3=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/setting.js | 9 + constant/catEyeMode.js | 26 ++ pages.json | 28 ++ pages/catEye/catEye.vue | 241 +++++++++++++- pages/catEyeMode/catEyeMode.vue | 387 ++++++++++++++++++++++ pages/customCatEye/customCatEye.vue | 331 ++++++++++++++++++ pages/realTimePicture/realTimePicture.vue | 192 +++++++++++ pages/videoSlot/videoSlot.vue | 256 ++++++++++++++ stores/basic.js | 20 ++ 9 files changed, 1488 insertions(+), 2 deletions(-) create mode 100644 constant/catEyeMode.js create mode 100644 pages/catEyeMode/catEyeMode.vue create mode 100644 pages/customCatEye/customCatEye.vue create mode 100644 pages/realTimePicture/realTimePicture.vue create mode 100644 pages/videoSlot/videoSlot.vue diff --git a/api/setting.js b/api/setting.js index d172262..cd1f0a9 100644 --- a/api/setting.js +++ b/api/setting.js @@ -127,3 +127,12 @@ export function addNoticeRequest(data) { data }) } + +// 更新猫眼设置 +export function updateCatEyeConfigRequest(data) { + return request({ + url: '/lockSetting/updateCatEyeConfig', + method: 'POST', + data + }) +} diff --git a/constant/catEyeMode.js b/constant/catEyeMode.js new file mode 100644 index 0000000..ef6758e --- /dev/null +++ b/constant/catEyeMode.js @@ -0,0 +1,26 @@ +export const catEyeMode = { + 0: { + name: '省电模式', + text1: '有人按门铃或发生异常事件时', + text2: '不录像', + text3: '/', + text4: '有人按门铃或发生异常事件时' + }, + 1: { + name: '逗留抓拍模式', + text1: '有人出现、按门铃或发生异常事件时', + text2: '逗留达到10秒', + text3: '约1.5米', + text4: '随时' + }, + 2: { + name: '实时监控模式', + text1: '有人出现、按门铃或发生异常事件时', + text2: '立即录像', + text3: '约1.5米', + text4: '随时' + }, + 3: { + name: '自定义模式' + } +} diff --git a/pages.json b/pages.json index f689b07..b0d5986 100644 --- a/pages.json +++ b/pages.json @@ -484,6 +484,34 @@ "navigationBarTitleText": "指纹列表", "disableScroll": true } + }, + { + "path": "pages/catEyeMode/catEyeMode", + "style": { + "navigationBarTitleText": "猫眼工作模式", + "disableScroll": true + } + }, + { + "path": "pages/customCatEye/customCatEye", + "style": { + "navigationBarTitleText": "自定义模式", + "disableScroll": true + } + }, + { + "path": "pages/realTimePicture/realTimePicture", + "style": { + "navigationBarTitleText": "实时画面", + "disableScroll": true + } + }, + { + "path": "pages/videoSlot/videoSlot", + "style": { + "navigationBarTitleText": "录像时段", + "disableScroll": true + } } ], "globalStyle": { diff --git a/pages/catEye/catEye.vue b/pages/catEye/catEye.vue index 16c4023..1845169 100644 --- a/pages/catEye/catEye.vue +++ b/pages/catEye/catEye.vue @@ -1,8 +1,245 @@ - + diff --git a/pages/customCatEye/customCatEye.vue b/pages/customCatEye/customCatEye.vue new file mode 100644 index 0000000..0a222d1 --- /dev/null +++ b/pages/customCatEye/customCatEye.vue @@ -0,0 +1,331 @@ + + + + + diff --git a/pages/realTimePicture/realTimePicture.vue b/pages/realTimePicture/realTimePicture.vue new file mode 100644 index 0000000..783d46a --- /dev/null +++ b/pages/realTimePicture/realTimePicture.vue @@ -0,0 +1,192 @@ + + + + + diff --git a/pages/videoSlot/videoSlot.vue b/pages/videoSlot/videoSlot.vue new file mode 100644 index 0000000..0561ac9 --- /dev/null +++ b/pages/videoSlot/videoSlot.vue @@ -0,0 +1,256 @@ + + + + + diff --git a/stores/basic.js b/stores/basic.js index b89cfb8..8ee3321 100644 --- a/stores/basic.js +++ b/stores/basic.js @@ -356,6 +356,26 @@ const pages = [ name: 'coercionFingerprint', path: '/pages/coercionFingerprint/coercionFingerprint', tabBar: false + }, + { + name: 'catEyeMode', + path: '/pages/catEyeMode/catEyeMode', + tabBar: false + }, + { + name: 'customCatEye', + path: '/pages/customCatEye/customCatEye', + tabBar: false + }, + { + name: 'realTimePicture', + path: '/pages/realTimePicture/realTimePicture', + tabBar: false + }, + { + name: 'videoSlot', + path: '/pages/videoSlot/videoSlot', + tabBar: false } ] 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 2/2] 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) {