Merge branch 'fanpeng' into 'develop'

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

See merge request StarlockTeam/wx-starlock!27
This commit is contained in:
范鹏 2025-02-27 03:36:45 +00:00
commit f0ec2e369e
23 changed files with 1636 additions and 45 deletions

View File

@ -64,3 +64,12 @@ export function getPasswordRequest(data) {
data
})
}
// 检查密码是否存在
export function checkPasswordRequest(data) {
return request({
url: '/keyboardPwd/checkKeyboardPwd',
method: 'POST',
data
})
}

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

@ -3,7 +3,7 @@
"appid" : "__UNI__933D519",
"description" : "",
"versionName" : "1.2.0",
"versionCode" : "32",
"versionCode" : "33",
"transformPx" : false,
/* */
"mp-weixin" : {

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

@ -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'
})
}

View File

@ -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'
})
}

View File

@ -31,7 +31,7 @@
@change-input="changeDuration"
></LockInput>
</view>
<view class="m-4 text-sm">
<view class="m-4 text-sm" v-if="check">
经过以上设定的时间锁会自动关闭开启或修改设置后请先开一次锁使时间生效
</view>
<view
@ -123,6 +123,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({

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

@ -12,29 +12,35 @@
</view>
<view
class="py-3 px-4 bg-white !py-2 flex items-center justify-between text-base mt-1"
@click="showDistance = true"
@click="distanceDialog"
v-if="distance !== null"
>
<view class="max-w-500">
<view>感应距离</view>
<view class="text-xs">{{ distanceColumns[0][distanceIndex].text }}</view>
<view class="text-xs mt-1 text-gray-500">{{ distanceColumns[0][distanceIndex].text }}</view>
</view>
<view class="flex items-center">
<view class="mr-2">{{ distanceColumns[0][distanceIndex].name }}</view>
<view class="mr-2" :class="[check ? '' : 'text-gray-500']">{{
distanceColumns[0][distanceIndex].name
}}</view>
<up-icon name="arrow-right"></up-icon>
</view>
</view>
<view
@click="showEnErrUnlock = true"
@click="enErrUnlockDialog"
class="py-3 px-4 bg-white !py-2 flex items-center justify-between text-base mt-1"
v-if="enErrUnlock !== null"
>
<view class="max-w-500">
<view>防误开</view>
<view class="text-xs">{{ enErrUnlockColumns[0][enErrUnlock].text }}</view>
<view class="text-xs mt-1 text-gray-500">{{
enErrUnlockColumns[0][enErrUnlock].text
}}</view>
</view>
<view class="flex items-center">
<view class="mr-2">{{ enErrUnlockColumns[0][enErrUnlock].name }}</view>
<view class="mr-2" :class="[check && distance !== 0 ? '' : 'text-gray-500']">{{
enErrUnlockColumns[0][enErrUnlock].name
}}</view>
<up-icon name="arrow-right"></up-icon>
</view>
</view>
@ -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"
>
<view class="text-base font-bold mb-3">添加和使用面容开锁时</view>
<view>1请尽量保持单人在门前操作</view>
<view>2请站立在门锁正前方约0.50.8面向门锁</view>
<view>3请保持脸部无遮挡露出五官</view>
<view>4面容识别异常时可触摸数字键盘任意按键手动重启人脸识别</view>
<view class="text-gray-500">1请尽量保持单人在门前操作</view>
<view class="text-gray-500">2请站立在门锁正前方约0.50.8面向门锁</view>
<view class="text-gray-500">3请保持脸部无遮挡露出五官</view>
<view class="text-gray-500"
>4面容识别异常时可触摸数字键盘任意按键手动重启人脸识别</view
>
</view>
<up-picker
:show="showDistance"
@ -79,9 +87,11 @@
import { useBluetoothStore } from '@/stores/bluetooth'
import { updateLockSettingRequest } from '@/api/setting'
import { useUserStore } from '@/stores/user'
import { useBasicStore } from '@/stores/basic'
const $bluetooth = useBluetoothStore()
const $user = useUserStore()
const $basic = useBasicStore()
const showDistance = ref(false)
const showEnErrUnlock = ref(false)
@ -104,6 +114,16 @@
const enErrUnlockColumns = ref([])
const distanceDialog = () => {
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()

View File

@ -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'
})
}

View File

@ -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'
})
}

View File

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

View File

@ -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()

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

@ -122,7 +122,7 @@
</view>
<view
v-if="
$bluetooth.currentLockSetting.lockFeature.isSupportCatEye !== 1 &&
$bluetooth.currentLockSetting.lockFeature.isSupportCatEye === 1 &&
$bluetooth.currentLockSetting.lockBasicInfo.keyRight === 1
"
class="py-3 px-4 bg-white flex items-center justify-between text-base mt-4rpx"
@ -236,7 +236,11 @@
import { useLockStore } from '@/stores/lock'
import { deleteKeyRequest } from '@/api/key'
import { useBasicStore } from '@/stores/basic'
import { getLockSettingRequest, updateLockSettingRequest } from '@/api/setting'
import {
getLockSettingRequest,
lockDataUploadRequest,
updateLockSettingRequest
} from '@/api/setting'
const $user = useUserStore()
const $bluetooth = useBluetoothStore()
@ -268,8 +272,33 @@
icon: 'none'
})
}
await asyncSetting()
})
const asyncSetting = async () => {
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'
})
}

View File

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

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

View File

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

View File

@ -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) {