1. 完成猫眼设置相关功能

This commit is contained in:
范鹏 2025-02-26 19:00:14 +08:00
parent 7b34291570
commit fafb06a8b5
9 changed files with 1488 additions and 2 deletions

View File

@ -127,3 +127,12 @@ export function addNoticeRequest(data) {
data
})
}
// 更新猫眼设置
export function updateCatEyeConfigRequest(data) {
return request({
url: '/lockSetting/updateCatEyeConfig',
method: 'POST',
data
})
}

26
constant/catEyeMode.js Normal file
View File

@ -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: '自定义模式'
}
}

View File

@ -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": {

View File

@ -1,8 +1,245 @@
<template>
<view> </view>
<view>
<view class="py-3 px-4 bg-white flex items-center justify-between text-base" @click="toSelect">
<view class="item-title">猫眼工作模式</view>
<view class="flex items-center">
<view class="mr-2">
{{
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0]
? catEyeMode[
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0]?.catEyeMode - 1
].name
: ''
}}
</view>
<up-icon name="arrow-right"></up-icon>
</view>
</view>
<view class="py-3 px-4 bg-white !py-2 flex items-center justify-between text-base mt-4rpx">
<view class="item-title">自动亮屏</view>
<switch
@click="change('autoLightScreen')"
:checked="$bluetooth.currentLockSetting.lockSettingInfo.autoLightScreen === 1"
class="transform-scale-90"
:disabled="true"
color="#002ce5"
/>
</view>
<view
class="py-3 px-4 bg-white !py-2 flex items-center justify-between text-base mt-4rpx"
@click="open"
>
<view class="item-title">亮屏持续时间</view>
<view class="flex items-center">
<view class="mr-2">
{{ $bluetooth.currentLockSetting.lockSettingInfo.autoLightScreenTime }}
</view>
<up-icon name="arrow-right"></up-icon>
</view>
</view>
<view class="py-3 px-4 bg-white !py-2 flex items-center justify-between text-base mt-4rpx">
<view class="item-title">逗留警告</view>
<switch
@click="change('stayWarn')"
:checked="$bluetooth.currentLockSetting.lockSettingInfo.stayWarn === 1"
class="transform-scale-90"
:disabled="true"
color="#002ce5"
/>
</view>
<view class="py-3 px-4 bg-white !py-2 flex items-center justify-between text-base mt-4rpx">
<view class="item-title">异常警告</view>
<switch
@click="change('abnormalWarn')"
:checked="$bluetooth.currentLockSetting.lockSettingInfo.abnormalWarn === 1"
class="transform-scale-90"
:disabled="true"
color="#002ce5"
/>
</view>
</view>
</template>
<script setup></script>
<script setup>
import { computed, ref } from 'vue'
import { updateCatEyeConfigRequest } from '@/api/setting'
import { useBluetoothStore } from '@/stores/bluetooth'
import { useUserStore } from '@/stores/user'
import { useBasicStore } from '@/stores/basic'
import { catEyeMode } from '@/constant/catEyeMode'
const $bluetooth = useBluetoothStore()
const $user = useUserStore()
const $basic = useBasicStore()
const value = computed(() => {
const list = []
if ($bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0]) {
list.push($bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeMode - 1)
if ($bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeMode === 4) {
if (
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordStartTime === 0 &&
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordEndTime === 1440
) {
list.push(1)
} else {
list.push(0)
}
list.push(
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordStartTime / 256
)
list.push(
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordStartTime % 256
)
list.push(
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordEndTime / 256
)
list.push(
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordEndTime % 256
)
list.push(
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig.recordTime
? $bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordTime
: 0
)
list.push(
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.detectionDistance
? $bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.detectionDistance
: 0
)
list.push(
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.realTimeMode
)
} else {
list.push(...[0, 0, 0, 0, 0, 0, 0, 0])
}
} else {
list.push(...[0, 0, 0, 0, 0, 0, 0, 0, 0])
}
list.push($bluetooth.currentLockSetting.lockSettingInfo.autoLightScreen)
list.push($bluetooth.currentLockSetting.lockSettingInfo.autoLightScreenTime)
list.push($bluetooth.currentLockSetting.lockSettingInfo.stayWarn)
list.push($bluetooth.currentLockSetting.lockSettingInfo.abnormalWarn)
return list
})
const pending = ref(false)
const open = () => {
uni.showActionSheet({
itemList: ['10秒', '15秒', '20秒'],
success(res) {
let code
if (res.tapIndex === 0) {
code = 10
} else if (res.tapIndex === 1) {
code = 15
} else if (res.tapIndex === 2) {
code = 20
}
let array = value.value
array[10] = code
update(array, 'autoLightScreenTime', code)
}
})
}
const toSelect = () => {
$basic.routeJump({
name: 'catEyeMode',
events: {
update: data => {
update(data.value, data.type, data.params, data.back)
}
}
})
}
const change = type => {
if (type === 'autoLightScreen') {
let array = value.value
array[9] = $bluetooth.currentLockSetting.lockSettingInfo.autoLightScreen === 1 ? 0 : 1
update(array, type, array[9])
} else if (type === 'stayWarn') {
let array = value.value
array[11] = $bluetooth.currentLockSetting.lockSettingInfo.stayWarn === 1 ? 0 : 1
update(array, type, array[11])
} else if (type === 'abnormalWarn') {
let array = value.value
array[12] = $bluetooth.currentLockSetting.lockSettingInfo.abnormalWarn === 1 ? 0 : 1
update(array, type, array[12])
}
}
const update = async (array, key, params, back = false) => {
if (pending.value) return
const netWork = await $basic.getNetworkType()
if (!netWork) {
return
}
pending.value = true
uni.showLoading({
title: '更新中'
})
const featureBit = 64
const { code } = await $bluetooth.updateSetting({
keyId: $bluetooth.keyId.toString(),
uid: $user.userInfo.uid.toString(),
featureBit,
params: array,
withParams: true
})
$bluetooth.closeBluetoothConnection()
if (code === 0) {
const { code, message } = await updateCatEyeConfigRequest({
lockId: $bluetooth.currentLockInfo.lockId,
[key]: params
})
pending.value = false
uni.hideLoading()
if (code === 0) {
$bluetooth.updateCurrentLockSetting({
...$bluetooth.currentLockSetting,
lockSettingInfo: {
...$bluetooth.currentLockSetting.lockSettingInfo,
[key]: params
}
})
if (back) {
$basic.backAndToast('更新成功')
} else {
uni.showToast({
title: '更新成功',
icon: 'none'
})
}
} else {
uni.showToast({
title: message,
icon: 'none'
})
}
} else {
pending.value = false
uni.hideLoading()
uni.showToast({
title: '更新失败,请保持在锁附近',
icon: 'none'
})
}
}
</script>
<style lang="scss">
page {

View File

@ -0,0 +1,387 @@
<template>
<view>
<view
@click="updateCatEyeConfig(0)"
class="flex items-center bg-#ececec py-4 pr-2 pl-1 mx-3 my-6 rounded-2xl"
:class="[
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0] &&
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeMode === 1
? 'bg-#d9e8fd'
: 'bg-#ececec'
]"
>
<view class="w-80 h-full flex items-center justify-center">
<up-icon
v-if="
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0] &&
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeMode === 1
"
name="checkbox-mark"
color="#2a85ec"
size="40"
></up-icon>
</view>
<view class="flex-1">
<view
class="text-lg font-bold"
:class="[
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0] &&
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeMode === 1
? 'text-#2a85ec'
: 'text-black'
]"
>{{ catEyeMode[0].name }}</view
>
<view
:class="[
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0] &&
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeMode === 1
? 'text-#2a85ec'
: 'text-gray-500'
]"
>
<view class="text-sm"> 适合门口较为安全的环境</view>
<view class="text-sm">仅发生特定事件才录像并可查看实时画面</view>
<view class="text-sm">一般情况下满电可使用7-8个月</view></view
>
</view>
<view
@click.stop="updateType(0)"
class="text-gray-500 border-2 border-solid border-gray-500 py-1 px-1 text-sm rounded-3xl w-80 ml-1 text-center"
>
查看
</view>
</view>
<view
@click="updateCatEyeConfig(1)"
class="flex items-center bg-#ececec py-4 pr-2 pl-1 mx-3 my-6 rounded-2xl"
:class="[
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0] &&
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeMode === 2
? 'bg-#d9e8fd'
: 'bg-#ececec'
]"
>
<view class="w-80 h-full flex items-center justify-center">
<up-icon
v-if="
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0] &&
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeMode === 2
"
name="checkbox-mark"
color="#2a85ec"
size="40"
></up-icon>
</view>
<view class="flex-1">
<view
class="text-lg font-bold"
:class="[
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0] &&
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeMode === 2
? 'text-#2a85ec'
: 'text-black'
]"
>
{{ catEyeMode[1].name }}</view
>
<view
:class="[
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0] &&
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeMode === 2
? 'text-#2a85ec'
: 'text-gray-500'
]"
>
<view class="text-sm"> 有人逗留或发生特定事件才录像可随时查看实时画面</view>
<view class="text-sm">一般情况下满电可使用5~6个月</view></view
>
</view>
<view
@click.stop="updateType(1)"
class="text-gray-500 border-2 border-solid border-gray-500 py-1 px-1 text-sm rounded-3xl w-80 ml-1 text-center"
>
查看
</view>
</view>
<view
@click="updateCatEyeConfig(2)"
class="flex items-center bg-#ececec py-4 pr-2 pl-1 mx-3 my-6 rounded-2xl"
:class="[
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0] &&
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeMode === 3
? 'bg-#d9e8fd'
: 'bg-#ececec'
]"
>
<view class="w-80 h-full flex items-center justify-center">
<up-icon
v-if="
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0] &&
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeMode === 3
"
name="checkbox-mark"
color="#2a85ec"
size="40"
></up-icon>
</view>
<view class="flex-1">
<view
class="text-lg font-bold"
:class="[
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0] &&
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeMode === 3
? 'text-#2a85ec'
: 'text-black'
]"
>{{ catEyeMode[2].name }}</view
>
<view
:class="[
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0] &&
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeMode === 3
? 'text-#2a85ec'
: 'text-gray-500'
]"
>
<view class="text-sm"> 适合门口人员复杂较不安全的环境</view>
<view class="text-sm">有人出现就录像可随时查看实时画面</view>
<view class="text-sm">一般情况下满电可使用2~4个月</view></view
>
</view>
<view
@click.stop="updateType(2)"
class="text-gray-500 border-2 border-solid border-gray-500 py-1 px-1 text-sm rounded-3xl w-80 ml-1 text-center"
>
查看
</view>
</view>
<view
@click="updateCatEyeConfig(3)"
class="flex items-center bg-#ececec py-4 pr-2 pl-1 mx-3 my-6 rounded-2xl"
:class="[
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0] &&
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeMode === 4
? 'bg-#d9e8fd'
: 'bg-#ececec'
]"
>
<view class="w-80 h-full flex items-center justify-center">
<up-icon
v-if="
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0] &&
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeMode === 4
"
name="checkbox-mark"
color="#2a85ec"
size="40"
></up-icon>
</view>
<view class="flex-1">
<view
class="text-lg font-bold"
:class="[
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0] &&
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeMode === 4
? 'text-#2a85ec'
: 'text-black'
]"
>{{ catEyeMode[3].name }}</view
>
<view
:class="[
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0] &&
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeMode === 4
? 'text-#2a85ec'
: 'text-gray-500'
]"
>
<view class="text-sm"> 根据您家门口实际情况设置录像和实时画面功能</view>
<view class="text-sm">可使用时长由具体设置决定</view>
</view>
</view>
<view
@click.stop="toCustom"
class="text-gray-500 border-2 border-solid border-gray-500 py-1 px-1 text-sm rounded-3xl w-80 ml-1 text-center"
>
设置
</view>
</view>
<up-popup
round="32"
:show="show"
@close="show = false"
mode="bottom"
:closeOnClickOverlay="true"
:safeAreaInsetBottom="false"
bgColor="transparent"
>
<view
class="bg-white text-lg font-bold rounded-t-2xl pb-[calc(env(safe-area-inset-bottom)+20rpx)]"
>
<view class="py-3 text-center text-xl">{{ catEyeMode[type].name }}</view>
<view class="flex items-center justify-between mx-4 my-6">
<view>录像时机</view>
<view class="text-sm text-gray-500 max-w-250rpx">{{ catEyeMode[type].text1 }}</view>
</view>
<view class="flex items-center justify-between mx-4 my-6">
<view>有人出现时录像</view>
<view class="text-sm text-gray-500 max-w-250rpx">{{ catEyeMode[type].text2 }}</view>
</view>
<view class="flex items-center justify-between mx-4 my-6">
<view>人体侦测距离</view>
<view class="text-sm text-gray-500 max-w-250rpx">{{ catEyeMode[type].text3 }}</view>
</view>
<view class="flex items-center justify-between mx-4 my-6">
<view>查看实时画面</view>
<view class="text-sm text-gray-500 max-w-250rpx">{{ catEyeMode[type].text4 }}</view>
</view>
<view
@click="show = false"
class="w-686 mx-4 text-center h-88 line-height-88rpx mt-5 text-white bg-#63b8af rounded-44rpx"
>我知道了</view
>
</view>
</up-popup>
</view>
</template>
<script setup>
import { computed, getCurrentInstance, ref } from 'vue'
import { useBluetoothStore } from '@/stores/bluetooth'
import { catEyeMode } from '@/constant/catEyeMode'
import { useBasicStore } from '@/stores/basic'
const instance = getCurrentInstance().proxy
const eventChannel = instance.getOpenerEventChannel()
const $bluetooth = useBluetoothStore()
const $basic = useBasicStore()
const show = ref(false)
const value = computed(() => {
const list = []
if ($bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0]) {
list.push($bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeMode - 1)
if ($bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeMode === 4) {
if (
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordStartTime === 0 &&
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordEndTime === 1440
) {
list.push(1)
} else {
list.push(0)
}
list.push(
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordStartTime / 256
)
list.push(
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordStartTime % 256
)
list.push(
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordEndTime / 256
)
list.push(
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordEndTime % 256
)
list.push(
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig.recordTime
? $bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordTime
: 0
)
list.push(
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.detectionDistance
? $bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.detectionDistance
: 0
)
list.push(
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.realTimeMode
)
} else {
list.push(...[0, 0, 0, 0, 0, 0, 0, 0])
}
} else {
list.push(...[0, 0, 0, 0, 0, 0, 0, 0, 0])
}
list.push($bluetooth.currentLockSetting.lockSettingInfo.autoLightScreen)
list.push($bluetooth.currentLockSetting.lockSettingInfo.autoLightScreenTime)
list.push($bluetooth.currentLockSetting.lockSettingInfo.stayWarn)
list.push($bluetooth.currentLockSetting.lockSettingInfo.abnormalWarn)
return list
})
const type = ref(0)
const updateType = index => {
type.value = index
show.value = true
}
const toCustom = () => {
if (
!$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0] ||
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeMode !== 4
) {
uni.showToast({
title: '请先选择自定义模式',
icon: 'none'
})
return
}
$basic.routeJump({
name: 'customCatEye',
events: {
update: data => {
eventChannel.emit('update', data)
}
}
})
}
const updateCatEyeConfig = index => {
if (
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0] &&
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeMode === index + 1
) {
return
}
let array = value.value
array[0] = index
eventChannel.emit('update', {
value: array,
type: 'catEyeConfig',
params: [
{
catEyeMode: index + 1,
catEyeModeConfig: $bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0]
? $bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
: {
recordMode: 0,
recordStartTime: 0,
recordEndTime: 0,
recordTime: 0,
detectionDistance: 0,
realTimeMode: 0
}
}
]
})
}
</script>
<style lang="scss">
page {
background-color: $uni-bg-color-grey;
}
</style>

View File

@ -0,0 +1,331 @@
<template>
<view class="text-base">
<view
class="py-3 px-4 bg-white flex items-center justify-between text-base"
@click="toJump('videoSlot')"
>
<view class="text-lg">录像时段</view>
<view class="flex items-center">
<view class="mr-2"> {{ duration }} </view>
<up-icon name="arrow-right"></up-icon>
</view>
</view>
<view
class="py-3 px-4 bg-white flex items-center justify-between text-base mt-4rpx"
@click="showRecordingTime = true"
>
<view>
<view class="text-lg">有人出现时录像</view>
<view class="text-sm text-gray-500">{{
recordingTimeObject.value === 0
? '有人在门口出现不录像'
: recordingTimeObject.value === 1
? '有人在门口出现立即录像'
: `有人在门口出现${recordingTimeObject.name}后开始录像`
}}</view>
<view class="text-sm text-gray-500">有人按门铃时立即录像</view>
</view>
<view class="flex items-center">
<view class="mr-2"> {{ recordingTimeObject.name }} </view>
<up-icon name="arrow-right"></up-icon>
</view>
</view>
<view
class="py-3 px-4 bg-white flex items-center justify-between text-base mt-4rpx"
@click="showDetectionDistance = true"
>
<view>
<view class="text-lg">人体侦测距离</view>
<view class="text-sm text-gray-500"
>有人出现在门口{{
detectionDistanceObject.name.match(/\d+(\.\d+)?米/)[0]
}}范围时启动录像</view
>
</view>
<view class="flex items-center">
<view class="mr-2"> {{ detectionDistanceObject.name }} </view>
<up-icon name="arrow-right"></up-icon>
</view>
</view>
<view
class="py-3 px-4 bg-white flex items-center justify-between text-base mt-4rpx"
@click="toJump('realTimePicture')"
>
<view>实时画面</view>
<view class="flex items-center">
<view class="mr-2">
{{
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.realTimeMode === 0
? '发生事件时查看'
: '实时查看'
}}
</view>
<up-icon name="arrow-right"></up-icon>
</view>
</view>
<up-picker
:show="showRecordingTime"
:columns="recordingTimeList"
keyName="name"
:itemHeight="70"
title="有人出现时录像"
:visibleItemCount="5"
:defaultIndex="[recordingTimeIndex]"
@close="showRecordingTime = false"
@cancel="showRecordingTime = false"
@confirm="select('recordTime', $event)"
></up-picker>
<up-picker
:show="showDetectionDistance"
:columns="detectionDistanceList"
title="人体侦测距离"
:itemHeight="70"
:visibleItemCount="5"
keyName="name"
:defaultIndex="[detectionDistanceIndex]"
@close="showDetectionDistance = false"
@cancel="showDetectionDistance = false"
@confirm="select('detectionDistance', $event)"
></up-picker>
</view>
</template>
<script setup>
import { computed, getCurrentInstance, ref } from 'vue'
import { useBluetoothStore } from '@/stores/bluetooth'
import { useBasicStore } from '@/stores/basic'
const instance = getCurrentInstance().proxy
const eventChannel = instance.getOpenerEventChannel()
const $bluetooth = useBluetoothStore()
const $basic = useBasicStore()
const value = computed(() => {
const list = []
if ($bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0]) {
list.push($bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeMode - 1)
if ($bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeMode === 4) {
if (
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordStartTime === 0 &&
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordEndTime === 1440
) {
list.push(1)
} else {
list.push(0)
}
list.push(
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordStartTime / 256
)
list.push(
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordStartTime % 256
)
list.push(
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordEndTime / 256
)
list.push(
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordEndTime % 256
)
list.push(
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig.recordTime
? $bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordTime
: 0
)
list.push(
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.detectionDistance
? $bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.detectionDistance
: 0
)
list.push(
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.realTimeMode
)
} else {
list.push(...[0, 0, 0, 0, 0, 0, 0, 0])
}
} else {
list.push(...[0, 0, 0, 0, 0, 0, 0, 0, 0])
}
list.push($bluetooth.currentLockSetting.lockSettingInfo.autoLightScreen)
list.push($bluetooth.currentLockSetting.lockSettingInfo.autoLightScreenTime)
list.push($bluetooth.currentLockSetting.lockSettingInfo.stayWarn)
list.push($bluetooth.currentLockSetting.lockSettingInfo.abnormalWarn)
return list
})
const showRecordingTime = ref(false)
const showDetectionDistance = ref(false)
const toJump = name => {
$basic.routeJump({
name,
events: {
update: data => {
eventChannel.emit('update', data)
}
}
})
}
const recordingTimeIndex = computed(() => {
return recordingTimeList.value[0].findIndex(
item =>
item.value ===
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig.recordTime
)
})
const detectionDistanceIndex = computed(() => {
return detectionDistanceList.value[0].findIndex(
item =>
item.value ===
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.detectionDistance
)
})
const recordingTimeList = ref([
[
{
name: '不录像',
value: 0
},
{
name: '立即录像',
value: 1
},
{
name: '5秒',
value: 5
},
{
name: '10秒',
value: 10
},
{
name: '15秒',
value: 15
},
{
name: '30秒',
value: 30
},
{
name: '60秒',
value: 60
}
]
])
const detectionDistanceList = ref([
[
{
name: '约0.8米',
value: 0
},
{
name: '约1.5米',
value: 1
},
{
name: '约3.0米',
value: 2
}
]
])
const select = (key, event) => {
let array = value.value
let data
if (key === 'recordTime') {
array[6] = recordingTimeList.value[0][event.indexs[0]].value
data = array[6]
showRecordingTime.value = false
} else if (key === 'detectionDistance') {
array[7] = detectionDistanceList.value[0][event.indexs[0]].value
data = array[7]
showDetectionDistance.value = false
}
eventChannel.emit('update', {
value: array,
type: 'catEyeConfig',
params: [
{
catEyeMode: $bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeMode,
catEyeModeConfig: {
...$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig,
[key]: data
}
}
]
})
}
const recordingTimeObject = computed(() => {
return recordingTimeList.value[0].find(
item =>
item.value ===
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig.recordTime
)
})
const detectionDistanceObject = computed(() => {
return detectionDistanceList.value[0].find(
item =>
item.value ===
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.detectionDistance
)
})
const duration = computed(() => {
if (
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordStartTime === 0 &&
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordEndTime === 0
) {
return ''
}
if (
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordStartTime === 0 &&
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordEndTime === 1440
) {
return '全天'
}
const startHour = Math.floor(
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordStartTime / 60
)
const startMinute =
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordStartTime % 60
const endHour = Math.floor(
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig.recordEndTime /
60
)
const endMinute =
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig.recordEndTime %
60
return `${startHour < 10 ? '0' + startHour : startHour}:${
startMinute < 10 ? '0' + startMinute : startMinute
}-${endHour < 10 ? '0' + endHour : endHour}:${endMinute < 10 ? '0' + endMinute : endMinute}`
})
</script>
<style lang="scss">
page {
background-color: $uni-bg-color-grey;
}
</style>

View File

@ -0,0 +1,192 @@
<template>
<view>
<view
@click="select(0)"
class="flex items-center bg-#ececec py-4 pr-2 pl-1 mx-3 my-6 rounded-2xl"
:class="[
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.realTimeMode === 0
? 'bg-#d9e8fd'
: 'bg-#ececec'
]"
>
<view class="w-80 h-full flex items-center justify-center">
<up-icon
v-if="
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.realTimeMode === 0
"
name="checkbox-mark"
color="#2a85ec"
size="40"
></up-icon>
</view>
<view class="flex-1">
<view
class="text-lg font-bold"
:class="[
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.realTimeMode === 0
? 'text-#2a85ec'
: 'text-black'
]"
>发生事件时查看</view
>
<view
:class="[
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.realTimeMode === 0
? 'text-#2a85ec'
: 'text-gray-500'
]"
>
<view class="text-sm">
仅当门锁发生事件或有人按门铃时才能在门锁首页查看实时画面</view
></view
>
</view>
</view>
<view
@click="select(1)"
class="flex items-center bg-#ececec py-4 pr-2 pl-1 mx-3 my-6 rounded-2xl"
:class="[
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.realTimeMode === 1
? 'bg-#d9e8fd'
: 'bg-#ececec'
]"
>
<view class="w-80 h-full flex items-center justify-center">
<up-icon
v-if="
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.realTimeMode === 1
"
name="checkbox-mark"
color="#2a85ec"
size="40"
></up-icon>
</view>
<view class="flex-1">
<view
class="text-lg font-bold"
:class="[
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.realTimeMode === 1
? 'text-#2a85ec'
: 'text-black'
]"
>
实时查看</view
>
<view
:class="[
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.realTimeMode === 1
? 'text-#2a85ec'
: 'text-gray-500'
]"
>
<view class="text-sm">
指定时问内无论门锁是否发生安全事件或有人按门铃都能在门锁首页随时查看实时画面电池续航时问将会缩短</view
>
</view>
</view>
</view>
</view>
</template>
<script setup>
import { computed, getCurrentInstance } from 'vue'
import { useBluetoothStore } from '@/stores/bluetooth'
const instance = getCurrentInstance().proxy
const eventChannel = instance.getOpenerEventChannel()
const $bluetooth = useBluetoothStore()
const value = computed(() => {
const list = []
if ($bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0]) {
list.push($bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeMode - 1)
if ($bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeMode === 4) {
if (
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordStartTime === 0 &&
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordEndTime === 1440
) {
list.push(1)
} else {
list.push(0)
}
list.push(
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordStartTime / 256
)
list.push(
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordStartTime % 256
)
list.push(
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordEndTime / 256
)
list.push(
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordEndTime % 256
)
list.push(
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig.recordTime
? $bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordTime
: 0
)
list.push(
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.detectionDistance
? $bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.detectionDistance
: 0
)
list.push(
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.realTimeMode
)
} else {
list.push(...[0, 0, 0, 0, 0, 0, 0, 0])
}
} else {
list.push(...[0, 0, 0, 0, 0, 0, 0, 0, 0])
}
list.push($bluetooth.currentLockSetting.lockSettingInfo.autoLightScreen)
list.push($bluetooth.currentLockSetting.lockSettingInfo.autoLightScreenTime)
list.push($bluetooth.currentLockSetting.lockSettingInfo.stayWarn)
list.push($bluetooth.currentLockSetting.lockSettingInfo.abnormalWarn)
return list
})
const select = data => {
let array = value.value
array[8] = data
eventChannel.emit('update', {
value: array,
type: 'catEyeConfig',
params: [
{
catEyeMode: $bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeMode,
catEyeModeConfig: {
...$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig,
realTimeMode: data
}
}
]
})
}
</script>
<style lang="scss">
page {
background-color: $uni-bg-color-grey;
}
</style>

View File

@ -0,0 +1,256 @@
<template>
<view>
<view
@click="isAllDay = 1"
class="flex items-center bg-#ececec py-4 pr-2 pl-1 mx-3 my-6 rounded-2xl"
:class="[isAllDay === 1 ? 'bg-#d9e8fd' : 'bg-#ececec']"
>
<view class="w-80 h-full flex items-center justify-center">
<up-icon v-if="isAllDay === 1" name="checkbox-mark" color="#2a85ec" size="40"></up-icon>
</view>
<view class="flex-1">
<view class="text-lg font-bold" :class="[isAllDay === 1 ? 'text-#2a85ec' : 'text-black']"
>全天</view
>
</view>
</view>
<view
@click="isAllDay = 0"
class="py-4 pr-2 pl-1 mx-3 my-6 rounded-2xl"
:class="[isAllDay === 0 ? 'bg-#d9e8fd' : 'bg-#ececec']"
>
<view class="flex items-center">
<view class="w-80 h-full flex items-center justify-center">
<up-icon v-if="isAllDay === 0" name="checkbox-mark" color="#2a85ec" size="40"></up-icon>
</view>
<view class="flex-1">
<view class="text-lg font-bold" :class="[isAllDay === 0 ? 'text-#2a85ec' : 'text-black']">
自定义时间</view
>
</view></view
>
<view
class="mt-2 text-#2a85ec mx-4 border-t-1 border-t-solid border-t-#2a85ec"
v-if="isAllDay === 0"
>
<view class="flex items-center mt-2" @click="showStartTime = true">
<view>开始时间</view>
<view class="ml-a mr-2"
>{{ columns[0][startIndex[0]] }}:{{ columns[1][startIndex[1]] }}</view
>
<up-icon name="arrow-right" color="#2a85ec"></up-icon>
</view>
<view class="flex items-center mt-1" @click="showEndTime = true">
<view>结束时间</view>
<view class="ml-a mr-2">{{ columns[0][endIndex[0]] }}:{{ columns[1][endIndex[1]] }}</view>
<up-icon name="arrow-right" color="#2a85ec"></up-icon>
</view>
</view>
</view>
<up-picker
:show="showStartTime"
:columns="columns"
title="开始时间"
mode="time"
:defaultIndex="startIndex"
:itemHeight="70"
:visibleItemCount="5"
@close="showStartTime = false"
@cancel="showStartTime = false"
@confirm="confirmTime('start', $event)"
></up-picker>
<up-picker
:show="showEndTime"
:columns="columns"
title="结束时间"
mode="time"
:defaultIndex="endIndex"
:itemHeight="70"
:visibleItemCount="5"
@close="showEndTime = false"
@cancel="showEndTime = false"
@confirm="confirmTime('end', $event)"
></up-picker>
<view
@click="confirm"
class="mt-10 w-686 mx-4 h-88 line-height-88rpx text-center bg-#63b8af text-white rounded-3xl"
>确定
</view>
</view>
</template>
<script setup>
import { computed, getCurrentInstance, onMounted, ref } from 'vue'
import { useBluetoothStore } from '@/stores/bluetooth'
const instance = getCurrentInstance().proxy
const eventChannel = instance.getOpenerEventChannel()
const $bluetooth = useBluetoothStore()
const isAllDay = ref(0)
const startIndex = ref([0, 0])
const endIndex = ref([0, 0])
const columns = ref([[], []])
const showStartTime = ref(false)
const showEndTime = ref(false)
const value = computed(() => {
const list = []
if ($bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0]) {
list.push($bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeMode - 1)
if ($bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeMode === 4) {
if (
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordStartTime === 0 &&
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordEndTime === 1440
) {
list.push(1)
} else {
list.push(0)
}
list.push(
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordStartTime / 256
)
list.push(
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordStartTime % 256
)
list.push(
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordEndTime / 256
)
list.push(
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordEndTime % 256
)
list.push(
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig.recordTime
? $bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordTime
: 0
)
list.push(
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.detectionDistance
? $bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.detectionDistance
: 0
)
list.push(
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.realTimeMode
)
} else {
list.push(...[0, 0, 0, 0, 0, 0, 0, 0])
}
} else {
list.push(...[0, 0, 0, 0, 0, 0, 0, 0, 0])
}
list.push($bluetooth.currentLockSetting.lockSettingInfo.autoLightScreen)
list.push($bluetooth.currentLockSetting.lockSettingInfo.autoLightScreenTime)
list.push($bluetooth.currentLockSetting.lockSettingInfo.stayWarn)
list.push($bluetooth.currentLockSetting.lockSettingInfo.abnormalWarn)
return list
})
const confirm = () => {
if (isAllDay.value === 0) {
if (
startIndex.value[0] * 60 + startIndex.value[1] >=
endIndex.value[0] * 60 + endIndex.value[1]
) {
uni.showToast({
title: '结束时间要大于开始时间',
icon: 'none'
})
return
}
}
let array = value.value
const recordStartTime =
isAllDay.value === 1 ? 0 : startIndex.value[0] * 60 + startIndex.value[1]
const recordEndTime = isAllDay.value === 1 ? 1440 : endIndex.value[0] * 60 + endIndex.value[1]
if (isAllDay.value === 1) {
array[1] = 1
array[2] = 0
array[3] = 0
array[4] = 0
array[5] = 0
} else {
array[1] = 0
array[2] = recordStartTime / 256
array[3] = recordStartTime % 256
array[4] = recordEndTime / 256
array[5] = recordEndTime % 256
}
eventChannel.emit('update', {
value: array,
type: 'catEyeConfig',
params: [
{
catEyeMode: $bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeMode,
catEyeModeConfig: {
...$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig,
recordStartTime,
recordEndTime
}
}
],
back: true
})
}
onMounted(() => {
columns.value = [
Array.from({ length: 24 }, (v, k) => (k < 10 ? '0' + k : k)),
Array.from({ length: 60 }, (v, k) => (k < 10 ? '0' + k : k))
]
isAllDay.value =
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordStartTime === 0 &&
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordEndTime === 1440
? 1
: 0
if (isAllDay.value === 0) {
startIndex.value = [
Math.floor(
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordStartTime / 60
),
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordStartTime % 60
]
endIndex.value = [
Math.floor(
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordEndTime / 60
),
$bluetooth.currentLockSetting.lockSettingInfo.catEyeConfig[0].catEyeModeConfig
.recordEndTime % 60
]
}
})
const confirmTime = (type, event) => {
if (type === 'start') {
startIndex.value = event.indexs
showStartTime.value = false
} else {
endIndex.value = event.indexs
showEndTime.value = false
}
}
</script>
<style lang="scss">
page {
background-color: $uni-bg-color-grey;
}
</style>

View File

@ -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
}
]