2024-08-26 20:04:22 +08:00
|
|
|
|
<template>
|
2025-02-18 18:35:24 +08:00
|
|
|
|
<view v-if="requestFinished" class="pb-100rpx">
|
|
|
|
|
|
<view
|
|
|
|
|
|
class="py-3 px-4 bg-white flex items-center justify-between text-base"
|
|
|
|
|
|
@click="toJump('lockInfo')"
|
|
|
|
|
|
>
|
|
|
|
|
|
<view class="item-title">基本信息</view>
|
2025-03-05 18:51:12 +08:00
|
|
|
|
<view>
|
|
|
|
|
|
<up-icon name="arrow-right"></up-icon>
|
|
|
|
|
|
</view>
|
2025-02-18 18:35:24 +08:00
|
|
|
|
</view>
|
2025-02-21 10:08:06 +08:00
|
|
|
|
<view class="mt-2.5"></view>
|
2025-02-18 18:35:24 +08:00
|
|
|
|
<view
|
2025-02-21 10:08:06 +08:00
|
|
|
|
class="py-3 px-4 bg-white flex items-center justify-between text-base mb-4rpx"
|
|
|
|
|
|
v-if="$bluetooth.currentLockSetting.lockFeature.autoLock === 1"
|
2025-02-20 15:50:28 +08:00
|
|
|
|
@click="toJump('autoLock')"
|
2025-02-18 18:35:24 +08:00
|
|
|
|
>
|
|
|
|
|
|
<view class="item-title">自动闭锁</view>
|
|
|
|
|
|
<view class="flex items-center">
|
|
|
|
|
|
<view class="mr-2 max-w-400">
|
|
|
|
|
|
{{
|
|
|
|
|
|
$bluetooth.currentLockSetting.lockSettingInfo.autoLock === 1
|
|
|
|
|
|
? $bluetooth.currentLockSetting.lockSettingInfo.autoLockSecond + 's'
|
|
|
|
|
|
: '已关闭'
|
|
|
|
|
|
}}
|
2024-08-26 20:04:22 +08:00
|
|
|
|
</view>
|
2025-02-18 18:35:24 +08:00
|
|
|
|
<up-icon name="arrow-right"></up-icon>
|
2024-08-26 20:04:22 +08:00
|
|
|
|
</view>
|
2025-02-18 18:35:24 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
<view
|
2025-02-21 10:08:06 +08:00
|
|
|
|
v-if="
|
2025-02-22 10:45:33 +08:00
|
|
|
|
$bluetooth.currentLockSetting.lockFeature.lockSound === 1 &&
|
2025-02-21 10:08:06 +08:00
|
|
|
|
$bluetooth.currentLockSetting.lockBasicInfo.keyRight === 1
|
|
|
|
|
|
"
|
|
|
|
|
|
class="py-3 px-4 bg-white flex items-center justify-between text-base mb-4rpx"
|
2025-02-20 15:50:28 +08:00
|
|
|
|
@click="toJump('lockSound')"
|
2025-02-18 18:35:24 +08:00
|
|
|
|
>
|
|
|
|
|
|
<view class="item-title">锁声音</view>
|
|
|
|
|
|
<view class="flex items-center">
|
|
|
|
|
|
<view class="mr-2 max-w-400">
|
|
|
|
|
|
{{
|
|
|
|
|
|
$bluetooth.currentLockSetting.lockSettingInfo.lockSound === 1
|
|
|
|
|
|
? volumeList[$bluetooth.currentLockSetting.lockSettingInfo.lockSoundVolume - 1]
|
|
|
|
|
|
: '已关闭'
|
|
|
|
|
|
}}
|
2024-08-26 20:04:22 +08:00
|
|
|
|
</view>
|
2025-02-18 18:35:24 +08:00
|
|
|
|
<up-icon name="arrow-right"></up-icon>
|
2024-08-26 20:04:22 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
2025-02-18 18:35:24 +08:00
|
|
|
|
<view
|
2025-02-21 10:08:06 +08:00
|
|
|
|
v-if="
|
|
|
|
|
|
$bluetooth.currentLockSetting.lockFeature.antiPrySwitch === 1 &&
|
|
|
|
|
|
$bluetooth.currentLockSetting.lockBasicInfo.keyRight === 1
|
|
|
|
|
|
"
|
|
|
|
|
|
class="py-3 px-4 bg-white flex items-center justify-between text-base"
|
2025-02-20 15:50:28 +08:00
|
|
|
|
@click="toUpdateSetting('antiPrySwitch')"
|
2025-02-18 18:35:24 +08:00
|
|
|
|
>
|
|
|
|
|
|
<view class="item-title">防撬报警</view>
|
|
|
|
|
|
<view class="flex items-center">
|
|
|
|
|
|
<view class="mr-2 max-w-400">
|
|
|
|
|
|
{{
|
|
|
|
|
|
$bluetooth.currentLockSetting.lockSettingInfo.antiPrySwitch === 1 ? '已开启' : '已关闭'
|
|
|
|
|
|
}}
|
2024-08-26 20:04:22 +08:00
|
|
|
|
</view>
|
2025-02-18 18:35:24 +08:00
|
|
|
|
<up-icon name="arrow-right"></up-icon>
|
2024-08-26 20:04:22 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
2025-02-21 10:08:06 +08:00
|
|
|
|
<view class="mt-2.5"></view>
|
2025-03-03 11:41:11 +08:00
|
|
|
|
<view
|
|
|
|
|
|
v-if="
|
2025-03-03 11:52:11 +08:00
|
|
|
|
$bluetooth.currentLockSetting.lockFeature.passageMode === 1 &&
|
2025-03-03 11:41:11 +08:00
|
|
|
|
$bluetooth.currentLockSetting.lockBasicInfo.keyRight === 1
|
|
|
|
|
|
"
|
|
|
|
|
|
class="py-3 px-4 bg-white flex items-center justify-between text-base mb-4rpx"
|
|
|
|
|
|
@click="$basic.routeJump({ name: 'passageMode' })"
|
|
|
|
|
|
>
|
|
|
|
|
|
<view class="item-title">常开模式</view>
|
|
|
|
|
|
<view class="flex items-center">
|
|
|
|
|
|
<view class="mr-2 max-w-400">
|
|
|
|
|
|
{{
|
|
|
|
|
|
$bluetooth.currentLockSetting.lockSettingInfo.passageMode === 1 ? '已开启' : '已关闭'
|
|
|
|
|
|
}}
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<up-icon name="arrow-right"></up-icon>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
2025-02-18 18:35:24 +08:00
|
|
|
|
<view
|
2025-02-21 10:08:06 +08:00
|
|
|
|
v-if="
|
|
|
|
|
|
$bluetooth.currentLockSetting.lockFeature.remoteUnlock === 1 &&
|
|
|
|
|
|
$bluetooth.currentLockSetting.lockBasicInfo.keyRight === 1
|
|
|
|
|
|
"
|
|
|
|
|
|
class="py-3 px-4 bg-white flex items-center justify-between text-base mb-4rpx"
|
2025-02-20 15:50:28 +08:00
|
|
|
|
@click="toUpdateSetting('remoteUnlock')"
|
2025-02-18 18:35:24 +08:00
|
|
|
|
>
|
|
|
|
|
|
<view class="item-title">远程开锁</view>
|
|
|
|
|
|
<view class="flex items-center">
|
|
|
|
|
|
<view class="mr-2 max-w-400">
|
|
|
|
|
|
{{
|
|
|
|
|
|
$bluetooth.currentLockSetting.lockSettingInfo.remoteUnlock === 1 ? '已开启' : '已关闭'
|
|
|
|
|
|
}}
|
2024-09-05 16:45:38 +08:00
|
|
|
|
</view>
|
2025-02-18 18:35:24 +08:00
|
|
|
|
<up-icon name="arrow-right"></up-icon>
|
2024-09-05 16:45:38 +08:00
|
|
|
|
</view>
|
2025-02-18 18:35:24 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
<view
|
2025-02-21 10:08:06 +08:00
|
|
|
|
v-if="
|
|
|
|
|
|
$bluetooth.currentLockSetting.lockFeature.resetSwitch === 1 &&
|
|
|
|
|
|
$bluetooth.currentLockSetting.lockBasicInfo.isLockOwner === 1
|
|
|
|
|
|
"
|
|
|
|
|
|
class="py-3 px-4 bg-white flex items-center justify-between text-base"
|
2025-02-20 15:50:28 +08:00
|
|
|
|
@click="toUpdateSetting('resetSwitch')"
|
2025-02-18 18:35:24 +08:00
|
|
|
|
>
|
|
|
|
|
|
<view class="item-title">重置键</view>
|
|
|
|
|
|
<view class="flex items-center">
|
|
|
|
|
|
<view class="mr-2 max-w-400">
|
|
|
|
|
|
{{
|
|
|
|
|
|
$bluetooth.currentLockSetting.lockSettingInfo.resetSwitch === 1 ? '已开启' : '已关闭'
|
|
|
|
|
|
}}
|
2024-09-03 17:48:26 +08:00
|
|
|
|
</view>
|
2025-02-18 18:35:24 +08:00
|
|
|
|
<up-icon name="arrow-right"></up-icon>
|
2024-09-03 17:48:26 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
2025-02-21 10:08:06 +08:00
|
|
|
|
<view class="mt-2.5"></view>
|
2025-02-18 18:35:24 +08:00
|
|
|
|
<view
|
2025-02-21 10:08:06 +08:00
|
|
|
|
v-if="
|
|
|
|
|
|
$bluetooth.currentLockSetting.lockFeature.d3Face === 1 &&
|
|
|
|
|
|
$bluetooth.currentLockSetting.lockBasicInfo.keyRight === 1
|
|
|
|
|
|
"
|
|
|
|
|
|
class="py-3 px-4 bg-white flex items-center justify-between text-base"
|
2025-02-20 15:50:28 +08:00
|
|
|
|
@click="toJump('faceSetting')"
|
2025-02-18 18:35:24 +08:00
|
|
|
|
>
|
|
|
|
|
|
<view class="item-title">面容开锁</view>
|
2025-03-05 18:51:12 +08:00
|
|
|
|
<view>
|
|
|
|
|
|
<up-icon name="arrow-right"></up-icon>
|
|
|
|
|
|
</view>
|
2025-02-18 18:35:24 +08:00
|
|
|
|
</view>
|
2025-02-25 15:07:52 +08:00
|
|
|
|
<view
|
|
|
|
|
|
v-if="$bluetooth.currentLockSetting.lockBasicInfo.keyRight === 1"
|
|
|
|
|
|
class="py-3 px-4 bg-white flex items-center justify-between text-base mt-4rpx"
|
|
|
|
|
|
@click="toJump('messageReminder')"
|
|
|
|
|
|
>
|
|
|
|
|
|
<view class="item-title">消息提醒</view>
|
2025-03-05 18:51:12 +08:00
|
|
|
|
<view>
|
|
|
|
|
|
<up-icon name="arrow-right"></up-icon>
|
|
|
|
|
|
</view>
|
2025-02-25 15:07:52 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
<view
|
|
|
|
|
|
v-if="
|
2025-02-27 11:29:53 +08:00
|
|
|
|
$bluetooth.currentLockSetting.lockFeature.isSupportCatEye === 1 &&
|
2025-02-25 15:07:52 +08:00
|
|
|
|
$bluetooth.currentLockSetting.lockBasicInfo.keyRight === 1
|
|
|
|
|
|
"
|
|
|
|
|
|
class="py-3 px-4 bg-white flex items-center justify-between text-base mt-4rpx"
|
|
|
|
|
|
@click="toJump('catEye')"
|
|
|
|
|
|
>
|
|
|
|
|
|
<view class="item-title">猫眼设置</view>
|
2025-03-05 18:51:12 +08:00
|
|
|
|
<view>
|
|
|
|
|
|
<up-icon name="arrow-right"></up-icon>
|
|
|
|
|
|
</view>
|
2025-02-25 15:07:52 +08:00
|
|
|
|
</view>
|
2025-02-22 15:41:05 +08:00
|
|
|
|
<view
|
|
|
|
|
|
v-if="
|
|
|
|
|
|
$bluetooth.currentLockSetting.lockFeature.openDirection === 1 &&
|
|
|
|
|
|
$bluetooth.currentLockSetting.lockBasicInfo.keyRight === 1
|
|
|
|
|
|
"
|
|
|
|
|
|
class="py-3 px-4 bg-white flex items-center justify-between text-base mt-4rpx"
|
|
|
|
|
|
@click="toJump('openDirection')"
|
|
|
|
|
|
>
|
|
|
|
|
|
<view class="item-title">开门方向设置</view>
|
2025-03-05 18:51:12 +08:00
|
|
|
|
<view>
|
|
|
|
|
|
<up-icon name="arrow-right"></up-icon>
|
|
|
|
|
|
</view>
|
2025-02-22 15:41:05 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
<view
|
|
|
|
|
|
v-if="
|
|
|
|
|
|
$bluetooth.currentLockSetting.lockFeature.motorTorsion === 1 &&
|
|
|
|
|
|
$bluetooth.currentLockSetting.lockBasicInfo.keyRight === 1
|
|
|
|
|
|
"
|
|
|
|
|
|
class="py-3 px-4 bg-white flex items-center justify-between text-base mt-4rpx"
|
|
|
|
|
|
@click="toJump('motorTorsion')"
|
|
|
|
|
|
>
|
|
|
|
|
|
<view class="item-title">电机功率设置</view>
|
2025-03-05 18:51:12 +08:00
|
|
|
|
<view>
|
|
|
|
|
|
<up-icon name="arrow-right"></up-icon>
|
|
|
|
|
|
</view>
|
2025-02-22 15:41:05 +08:00
|
|
|
|
</view>
|
2025-02-21 10:08:06 +08:00
|
|
|
|
<view class="mt-2.5"></view>
|
2025-02-18 18:35:24 +08:00
|
|
|
|
<view
|
2025-02-21 10:08:06 +08:00
|
|
|
|
class="py-3 px-4 bg-white !py-2 flex items-center justify-between text-base"
|
|
|
|
|
|
v-if="
|
|
|
|
|
|
$bluetooth.currentLockSetting.lockFeature.unlockReminder === 1 &&
|
|
|
|
|
|
$bluetooth.currentLockSetting.lockBasicInfo.isLockOwner === 1
|
|
|
|
|
|
"
|
2025-02-18 18:35:24 +08:00
|
|
|
|
>
|
|
|
|
|
|
<view class="item-title">开锁提醒</view>
|
|
|
|
|
|
<switch
|
2025-02-20 15:50:28 +08:00
|
|
|
|
@click="changeSetting('unlockReminder')"
|
2025-02-18 18:35:24 +08:00
|
|
|
|
:checked="$bluetooth.currentLockSetting.lockSettingInfo.unlockReminder === 1"
|
|
|
|
|
|
class="transform-scale-90"
|
|
|
|
|
|
:disabled="true"
|
|
|
|
|
|
color="#002ce5"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</view>
|
2025-02-21 10:08:06 +08:00
|
|
|
|
<view
|
|
|
|
|
|
v-if="
|
|
|
|
|
|
$bluetooth.currentLockSetting.lockFeature.appUnlockOnline === 1 &&
|
|
|
|
|
|
$bluetooth.currentLockSetting.lockBasicInfo.isLockOwner === 1
|
|
|
|
|
|
"
|
|
|
|
|
|
class="py-3 px-4 bg-white !py-2 flex items-center justify-between text-base mt-4rpx"
|
|
|
|
|
|
>
|
2025-02-18 18:35:24 +08:00
|
|
|
|
<view class="item-title">开锁时是否需联网</view>
|
|
|
|
|
|
<switch
|
2025-02-20 15:50:28 +08:00
|
|
|
|
@click="changeSetting('appUnlockOnline')"
|
2025-02-18 18:35:24 +08:00
|
|
|
|
:checked="$bluetooth.currentLockSetting.lockSettingInfo.appUnlockOnline === 1"
|
|
|
|
|
|
class="transform-scale-90"
|
|
|
|
|
|
:disabled="true"
|
|
|
|
|
|
color="#002ce5"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view
|
|
|
|
|
|
class="py-3 px-4 bg-white flex items-center justify-between text-base mt-2.5"
|
2025-02-20 15:50:28 +08:00
|
|
|
|
@click="toJump('lockDate')"
|
2025-02-18 18:35:24 +08:00
|
|
|
|
>
|
|
|
|
|
|
<view class="item-title">锁时间</view>
|
2025-03-05 18:51:12 +08:00
|
|
|
|
<view>
|
|
|
|
|
|
<up-icon name="arrow-right"></up-icon>
|
|
|
|
|
|
</view>
|
2025-02-18 18:35:24 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
<view
|
2025-02-21 10:08:06 +08:00
|
|
|
|
v-if="$bluetooth.currentLockSetting.lockBasicInfo.keyRight === 1"
|
2025-02-18 18:35:24 +08:00
|
|
|
|
class="py-3 px-4 bg-white flex items-center justify-between text-base mt-4rpx"
|
2025-02-20 15:50:28 +08:00
|
|
|
|
@click="toJump('uploadLockData')"
|
2025-02-18 18:35:24 +08:00
|
|
|
|
>
|
|
|
|
|
|
<view class="item-title">上传数据</view>
|
2025-03-05 18:51:12 +08:00
|
|
|
|
<view>
|
|
|
|
|
|
<up-icon name="arrow-right"></up-icon>
|
|
|
|
|
|
</view>
|
2025-02-18 18:35:24 +08:00
|
|
|
|
</view>
|
2025-03-03 11:41:11 +08:00
|
|
|
|
<view
|
|
|
|
|
|
class="py-3 px-4 bg-white flex items-center justify-between text-base mt-4rpx"
|
|
|
|
|
|
v-if="$bluetooth.currentLockSetting.lockBasicInfo.keyRight === 1"
|
|
|
|
|
|
@click="upgrade"
|
|
|
|
|
|
>
|
|
|
|
|
|
<view class="item-title">锁升级</view>
|
2025-03-05 18:51:12 +08:00
|
|
|
|
<view>
|
|
|
|
|
|
<up-icon name="arrow-right"></up-icon>
|
|
|
|
|
|
</view>
|
2025-03-03 11:41:11 +08:00
|
|
|
|
</view>
|
2025-02-18 18:35:24 +08:00
|
|
|
|
<view
|
|
|
|
|
|
class="mt-4 rounded-3xl w-600 h-80 line-height-80rpx text-center mx-75rpx bg-#ec433c text-white text-xl font-bold"
|
|
|
|
|
|
@click="deleteLock"
|
2025-03-05 18:51:12 +08:00
|
|
|
|
>删除
|
|
|
|
|
|
</view>
|
2025-02-06 11:37:41 +08:00
|
|
|
|
<up-modal
|
|
|
|
|
|
:show="showModal"
|
|
|
|
|
|
title="是否删除授权管理员钥匙?"
|
|
|
|
|
|
:showCancelButton="true"
|
|
|
|
|
|
width="600rpx"
|
|
|
|
|
|
@cancel="cancelModal"
|
|
|
|
|
|
@confirm="confirmModal"
|
|
|
|
|
|
>
|
2024-09-03 14:21:40 +08:00
|
|
|
|
<view class="slot-content" @click="changeRadio">
|
2025-02-06 11:37:41 +08:00
|
|
|
|
<view style="display: flex; align-items: center">
|
2024-09-03 14:21:40 +08:00
|
|
|
|
<radio :checked="checked"></radio>
|
|
|
|
|
|
<view>同时删除其发送的所有钥匙,钥匙删除后不能恢复</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</up-modal>
|
2024-08-26 20:04:22 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
2025-02-18 18:35:24 +08:00
|
|
|
|
<script setup>
|
|
|
|
|
|
import { onMounted, ref } from 'vue'
|
2025-02-06 11:37:41 +08:00
|
|
|
|
import { useBluetoothStore } from '@/stores/bluetooth'
|
|
|
|
|
|
import { useUserStore } from '@/stores/user'
|
|
|
|
|
|
import { deleteLockRequest } from '@/api/lock'
|
|
|
|
|
|
import { useLockStore } from '@/stores/lock'
|
|
|
|
|
|
import { deleteKeyRequest } from '@/api/key'
|
|
|
|
|
|
import { useBasicStore } from '@/stores/basic'
|
2025-02-27 11:29:53 +08:00
|
|
|
|
import {
|
|
|
|
|
|
getLockSettingRequest,
|
|
|
|
|
|
lockDataUploadRequest,
|
|
|
|
|
|
updateLockSettingRequest
|
|
|
|
|
|
} from '@/api/setting'
|
2024-08-26 20:04:22 +08:00
|
|
|
|
|
2025-02-18 18:35:24 +08:00
|
|
|
|
const $user = useUserStore()
|
|
|
|
|
|
const $bluetooth = useBluetoothStore()
|
|
|
|
|
|
const $lock = useLockStore()
|
|
|
|
|
|
const $basic = useBasicStore()
|
|
|
|
|
|
|
|
|
|
|
|
const showModal = ref(false)
|
|
|
|
|
|
const checked = ref(false)
|
|
|
|
|
|
const requestFinished = ref(false)
|
|
|
|
|
|
|
2025-02-20 15:50:28 +08:00
|
|
|
|
const pending = ref(false)
|
|
|
|
|
|
|
2025-02-18 18:35:24 +08:00
|
|
|
|
const volumeList = ['低', '较低', '中', '较高', '高']
|
|
|
|
|
|
|
|
|
|
|
|
onMounted(async () => {
|
|
|
|
|
|
uni.showLoading({
|
|
|
|
|
|
title: '加载中'
|
|
|
|
|
|
})
|
|
|
|
|
|
const { code, data, message } = await getLockSettingRequest({
|
|
|
|
|
|
lockId: $bluetooth.currentLockInfo.lockId
|
|
|
|
|
|
})
|
|
|
|
|
|
uni.hideLoading()
|
|
|
|
|
|
if (code === 0) {
|
2025-03-05 18:51:12 +08:00
|
|
|
|
if (data.lockSettingInfo.catEyeConfig[0]) {
|
|
|
|
|
|
data.lockSettingInfo.catEyeConfig[0].catEyeModeConfig.recordTime = Number(
|
|
|
|
|
|
data.lockSettingInfo.catEyeConfig[0].catEyeModeConfig.recordTime
|
|
|
|
|
|
)
|
|
|
|
|
|
data.lockSettingInfo.catEyeConfig[0].catEyeModeConfig.detectionDistance = Number(
|
|
|
|
|
|
data.lockSettingInfo.catEyeConfig[0].catEyeModeConfig.detectionDistance
|
|
|
|
|
|
)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-02-18 18:35:24 +08:00
|
|
|
|
requestFinished.value = true
|
|
|
|
|
|
$bluetooth.updateCurrentLockSetting(data)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
title: message,
|
|
|
|
|
|
icon: 'none'
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2025-07-16 16:30:06 +08:00
|
|
|
|
// #ifdef MP
|
2025-02-27 11:29:53 +08:00
|
|
|
|
await asyncSetting()
|
2025-07-16 16:30:06 +08:00
|
|
|
|
// #endif
|
2025-02-18 18:35:24 +08:00
|
|
|
|
})
|
|
|
|
|
|
|
2025-03-03 11:41:11 +08:00
|
|
|
|
const upgrade = () => {
|
2025-07-14 11:15:28 +08:00
|
|
|
|
// #ifdef MP
|
2025-03-03 11:41:11 +08:00
|
|
|
|
uni.showModal({
|
|
|
|
|
|
title: '提示',
|
|
|
|
|
|
content: '小程序暂不支持升级功能,请下载星星锁APP进行升级',
|
|
|
|
|
|
showCancel: false
|
|
|
|
|
|
})
|
2025-07-14 11:15:28 +08:00
|
|
|
|
// #endif
|
|
|
|
|
|
// #ifdef APP-PLUS
|
|
|
|
|
|
uni.showModal({
|
|
|
|
|
|
title: '提示',
|
|
|
|
|
|
content: '星星锁Lite暂不支持升级功能,请下载星星锁APP进行升级',
|
|
|
|
|
|
showCancel: false
|
|
|
|
|
|
})
|
|
|
|
|
|
// #endif
|
2025-03-03 11:41:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-02-27 11:29:53 +08:00
|
|
|
|
const asyncSetting = async () => {
|
|
|
|
|
|
const { code, data } = await $bluetooth.getLockDataList({
|
|
|
|
|
|
type: 'setting',
|
|
|
|
|
|
lockId: $bluetooth.currentLockInfo.lockName.toString(),
|
|
|
|
|
|
uid: $user.userInfo.uid.toString()
|
|
|
|
|
|
})
|
2025-07-14 15:00:18 +08:00
|
|
|
|
// #ifdef MP
|
2025-02-27 11:29:53 +08:00
|
|
|
|
$bluetooth.closeBluetoothConnection()
|
2025-07-14 15:00:18 +08:00
|
|
|
|
// #endif
|
2025-02-27 11:29:53 +08:00
|
|
|
|
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) {
|
2025-03-05 18:51:12 +08:00
|
|
|
|
if (data.lockSettingInfo.catEyeConfig[0]) {
|
|
|
|
|
|
data.lockSettingInfo.catEyeConfig[0].catEyeModeConfig.recordTime = Number(
|
|
|
|
|
|
data.lockSettingInfo.catEyeConfig[0].catEyeModeConfig.recordTime
|
|
|
|
|
|
)
|
|
|
|
|
|
data.lockSettingInfo.catEyeConfig[0].catEyeModeConfig.detectionDistance = Number(
|
|
|
|
|
|
data.lockSettingInfo.catEyeConfig[0].catEyeModeConfig.detectionDistance
|
|
|
|
|
|
)
|
|
|
|
|
|
}
|
2025-02-27 11:29:53 +08:00
|
|
|
|
$bluetooth.updateCurrentLockSetting(data)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-02-20 15:50:28 +08:00
|
|
|
|
const toUpdateSetting = key => {
|
|
|
|
|
|
$basic.routeJump({
|
|
|
|
|
|
name: 'updateSetting',
|
|
|
|
|
|
params: {
|
|
|
|
|
|
key
|
|
|
|
|
|
},
|
|
|
|
|
|
events: {
|
|
|
|
|
|
changeSetting() {
|
|
|
|
|
|
changeSetting(key)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const changeSetting = async key => {
|
2025-02-27 11:29:53 +08:00
|
|
|
|
const netWork = await $basic.getNetworkType()
|
|
|
|
|
|
if (!netWork) {
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
2025-02-20 15:50:28 +08:00
|
|
|
|
if (pending.value) return
|
|
|
|
|
|
pending.value = true
|
|
|
|
|
|
uni.showLoading({
|
|
|
|
|
|
title: '更新中'
|
|
|
|
|
|
})
|
|
|
|
|
|
let featureBit
|
|
|
|
|
|
if (key === 'unlockReminder') {
|
2025-03-03 09:01:28 +08:00
|
|
|
|
const { code, message } = await updateLockSettingRequest({
|
|
|
|
|
|
lockId: $bluetooth.currentLockInfo.lockId,
|
|
|
|
|
|
[key]: $bluetooth.currentLockSetting.lockSettingInfo[key] === 1 ? 0 : 1
|
|
|
|
|
|
})
|
|
|
|
|
|
pending.value = false
|
|
|
|
|
|
uni.hideLoading()
|
|
|
|
|
|
if (code === 0) {
|
|
|
|
|
|
$bluetooth.updateCurrentLockSetting({
|
|
|
|
|
|
...$bluetooth.currentLockSetting,
|
|
|
|
|
|
lockSettingInfo: {
|
|
|
|
|
|
...$bluetooth.currentLockSetting.lockSettingInfo,
|
|
|
|
|
|
[key]: $bluetooth.currentLockSetting.lockSettingInfo[key] === 1 ? 0 : 1
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
$lock.updateLockSearch({
|
|
|
|
|
|
...$lock.lockSearch,
|
|
|
|
|
|
pageNo: 1
|
|
|
|
|
|
})
|
|
|
|
|
|
$lock.getLockList($lock.lockSearch)
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
title: '更新成功',
|
|
|
|
|
|
icon: 'none'
|
|
|
|
|
|
})
|
|
|
|
|
|
} else {
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
title: message,
|
|
|
|
|
|
icon: 'none'
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
if (key === 'appUnlockOnline') {
|
2025-02-20 15:50:28 +08:00
|
|
|
|
featureBit = 55
|
|
|
|
|
|
} else if (key === 'remoteUnlock') {
|
|
|
|
|
|
featureBit = 28
|
|
|
|
|
|
} else if (key === 'resetSwitch') {
|
|
|
|
|
|
featureBit = 31
|
|
|
|
|
|
} else if (key === 'antiPrySwitch') {
|
|
|
|
|
|
featureBit = 30
|
|
|
|
|
|
}
|
|
|
|
|
|
const { code } = await $bluetooth.updateSetting({
|
|
|
|
|
|
keyId: $bluetooth.keyId.toString(),
|
|
|
|
|
|
uid: $user.userInfo.uid.toString(),
|
|
|
|
|
|
featureBit,
|
|
|
|
|
|
featureEnable: $bluetooth.currentLockSetting.lockSettingInfo[key] === 1 ? 0 : 1,
|
|
|
|
|
|
withParams: false
|
|
|
|
|
|
})
|
|
|
|
|
|
$bluetooth.closeBluetoothConnection()
|
|
|
|
|
|
if (code === 0) {
|
|
|
|
|
|
const { code, message } = await updateLockSettingRequest({
|
|
|
|
|
|
lockId: $bluetooth.currentLockInfo.lockId,
|
|
|
|
|
|
[key]: $bluetooth.currentLockSetting.lockSettingInfo[key] === 1 ? 0 : 1
|
|
|
|
|
|
})
|
|
|
|
|
|
pending.value = false
|
|
|
|
|
|
uni.hideLoading()
|
|
|
|
|
|
if (code === 0) {
|
2025-07-08 10:33:26 +08:00
|
|
|
|
if (key === 'appUnlockOnline') {
|
|
|
|
|
|
$bluetooth.currentLockInfo.appUnlockOnline =
|
|
|
|
|
|
$bluetooth.currentLockSetting.lockSettingInfo[key] === 1 ? 0 : 1
|
|
|
|
|
|
}
|
2025-02-20 15:50:28 +08:00
|
|
|
|
$bluetooth.updateCurrentLockSetting({
|
|
|
|
|
|
...$bluetooth.currentLockSetting,
|
|
|
|
|
|
lockSettingInfo: {
|
|
|
|
|
|
...$bluetooth.currentLockSetting.lockSettingInfo,
|
|
|
|
|
|
[key]: $bluetooth.currentLockSetting.lockSettingInfo[key] === 1 ? 0 : 1
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
$lock.updateLockSearch({
|
|
|
|
|
|
...$lock.lockSearch,
|
|
|
|
|
|
pageNo: 1
|
|
|
|
|
|
})
|
|
|
|
|
|
$lock.getLockList($lock.lockSearch)
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
title: '更新成功',
|
|
|
|
|
|
icon: 'none'
|
|
|
|
|
|
})
|
|
|
|
|
|
} else {
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
title: message,
|
|
|
|
|
|
icon: 'none'
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2025-03-03 09:01:28 +08:00
|
|
|
|
} else if (code === -21) {
|
|
|
|
|
|
pending.value = false
|
|
|
|
|
|
uni.hideLoading()
|
2025-02-20 15:50:28 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
pending.value = false
|
|
|
|
|
|
uni.hideLoading()
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
title: '更新失败,请保持在锁附近',
|
|
|
|
|
|
icon: 'none'
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-02-18 18:35:24 +08:00
|
|
|
|
const toJump = name => {
|
|
|
|
|
|
$basic.routeJump({
|
|
|
|
|
|
name
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const changeRadio = () => {
|
|
|
|
|
|
checked.value = !checked.value
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const cancelModal = () => {
|
|
|
|
|
|
showModal.value = false
|
|
|
|
|
|
checked.value = false
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const confirmModal = async () => {
|
|
|
|
|
|
uni.showLoading({
|
|
|
|
|
|
title: '删除中',
|
|
|
|
|
|
mask: true
|
|
|
|
|
|
})
|
2025-02-27 11:29:53 +08:00
|
|
|
|
const { code, message } = await deleteKeyRequest({
|
2025-02-18 18:35:24 +08:00
|
|
|
|
keyId: $lock.keyId,
|
|
|
|
|
|
includeUnderlings: checked.value ? 1 : 0
|
|
|
|
|
|
})
|
|
|
|
|
|
showModal.value = false
|
|
|
|
|
|
if (code === 0) {
|
|
|
|
|
|
uni.hideLoading()
|
|
|
|
|
|
$lock.updateLockSearch({
|
|
|
|
|
|
...$lock.lockSearch,
|
|
|
|
|
|
pageNo: 1
|
|
|
|
|
|
})
|
|
|
|
|
|
$lock.getLockList($lock.lockSearch)
|
|
|
|
|
|
$basic.backAndToast('删除成功', 2)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
uni.hideLoading()
|
|
|
|
|
|
uni.showToast({
|
2025-02-27 11:29:53 +08:00
|
|
|
|
title: message,
|
2025-02-18 18:35:24 +08:00
|
|
|
|
icon: 'none'
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const deleteLock = async () => {
|
|
|
|
|
|
const netWork = await $basic.getNetworkType()
|
|
|
|
|
|
if (!netWork) {
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
if (
|
|
|
|
|
|
$bluetooth.currentLockInfo.userType !== 110301 &&
|
|
|
|
|
|
$bluetooth.currentLockInfo.keyRight === 1
|
|
|
|
|
|
) {
|
|
|
|
|
|
showModal.value = true
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
const message =
|
|
|
|
|
|
$bluetooth.currentLockInfo.userType === 110301
|
|
|
|
|
|
? '删除锁后,所有信息都会一起删除,确定删除锁吗?'
|
|
|
|
|
|
: '确定删除该钥匙吗?'
|
|
|
|
|
|
uni.showModal({
|
|
|
|
|
|
title: '提示',
|
|
|
|
|
|
content: message,
|
|
|
|
|
|
async success(res) {
|
|
|
|
|
|
if (res.confirm) {
|
|
|
|
|
|
uni.showLoading({
|
|
|
|
|
|
title: '删除中'
|
2025-02-06 11:37:41 +08:00
|
|
|
|
})
|
2025-02-18 18:35:24 +08:00
|
|
|
|
if ($bluetooth.currentLockInfo.userType === 110301) {
|
|
|
|
|
|
const { code: resetDeviceCode } = await $bluetooth.resetDevice({
|
|
|
|
|
|
name: $bluetooth.currentLockInfo.name,
|
|
|
|
|
|
authUid: $user.userInfo.uid.toString(),
|
|
|
|
|
|
keyId: $bluetooth.keyId.toString()
|
|
|
|
|
|
})
|
2025-10-27 09:58:13 +08:00
|
|
|
|
console.log('resetDeviceCode', resetDeviceCode)
|
2025-02-18 18:35:24 +08:00
|
|
|
|
if (resetDeviceCode === 0 || resetDeviceCode === -2) {
|
2025-02-27 11:29:53 +08:00
|
|
|
|
const { code, message } = await deleteLockRequest({
|
2025-02-18 18:35:24 +08:00
|
|
|
|
lockId: $bluetooth.currentLockInfo.lockId
|
2024-08-29 11:30:00 +08:00
|
|
|
|
})
|
2025-02-18 18:35:24 +08:00
|
|
|
|
if (code === 0) {
|
|
|
|
|
|
uni.hideLoading()
|
|
|
|
|
|
$lock.updateLockSearch({
|
|
|
|
|
|
...$lock.lockSearch,
|
|
|
|
|
|
pageNo: 1
|
2025-02-06 11:37:41 +08:00
|
|
|
|
})
|
2025-02-18 18:35:24 +08:00
|
|
|
|
$lock.getLockList($lock.lockSearch)
|
|
|
|
|
|
$basic.backAndToast('删除成功', 2)
|
2025-02-06 11:37:41 +08:00
|
|
|
|
} else {
|
2025-02-18 18:35:24 +08:00
|
|
|
|
uni.hideLoading()
|
|
|
|
|
|
uni.showToast({
|
2025-02-27 11:29:53 +08:00
|
|
|
|
title: message,
|
2025-02-18 18:35:24 +08:00
|
|
|
|
icon: 'none'
|
2024-08-29 11:30:00 +08:00
|
|
|
|
})
|
2024-08-26 20:04:22 +08:00
|
|
|
|
}
|
2025-02-18 18:35:24 +08:00
|
|
|
|
} else if (resetDeviceCode === -1) {
|
|
|
|
|
|
uni.hideLoading()
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
title: '删除失败,请保持在锁附近',
|
|
|
|
|
|
icon: 'none'
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
2025-02-27 11:29:53 +08:00
|
|
|
|
const { code, message } = await deleteKeyRequest({
|
2025-02-18 18:35:24 +08:00
|
|
|
|
keyId: $bluetooth.keyId
|
|
|
|
|
|
})
|
|
|
|
|
|
if (code === 0) {
|
|
|
|
|
|
uni.hideLoading()
|
2025-10-27 09:58:13 +08:00
|
|
|
|
await $lock.updateLockSearch({
|
2025-02-18 18:35:24 +08:00
|
|
|
|
...$lock.lockSearch,
|
|
|
|
|
|
pageNo: 1
|
|
|
|
|
|
})
|
2025-10-27 09:58:13 +08:00
|
|
|
|
await $lock.getLockList($lock.lockSearch)
|
|
|
|
|
|
await $bluetooth.updateCurrentLockInfo({})
|
2025-02-18 18:35:24 +08:00
|
|
|
|
$basic.backAndToast('删除成功', 2)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
uni.hideLoading()
|
|
|
|
|
|
uni.showToast({
|
2025-02-27 11:29:53 +08:00
|
|
|
|
title: message,
|
2025-02-18 18:35:24 +08:00
|
|
|
|
icon: 'none'
|
|
|
|
|
|
})
|
2024-08-26 20:04:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-02-18 18:35:24 +08:00
|
|
|
|
}
|
2025-02-06 11:37:41 +08:00
|
|
|
|
}
|
2025-02-18 18:35:24 +08:00
|
|
|
|
})
|
2024-08-26 20:04:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss">
|
2025-02-06 11:37:41 +08:00
|
|
|
|
page {
|
|
|
|
|
|
background-color: $uni-bg-color-grey;
|
|
|
|
|
|
}
|
2024-08-26 20:04:22 +08:00
|
|
|
|
</style>
|