1. bug修复

2. 锁设置添加权限判断
This commit is contained in:
范鹏 2025-02-21 10:08:06 +08:00
parent 3840971b9c
commit 2233dd2f68
12 changed files with 121 additions and 42 deletions

View File

@ -88,7 +88,7 @@
<view>{{ <view>{{
info.keyRight === 1 info.keyRight === 1
? '取消授权会在用户APP连网后生效' ? '取消授权会在用户APP连网后生效'
: '授权用户拥有管理员的大部分权限,比如发送要是、发送密码' : '授权用户拥有管理员的大部分权限,比如发送钥匙、发送密码'
}}</view> }}</view>
</view> </view>
</up-modal> </up-modal>

View File

@ -7,13 +7,13 @@
:checked="check" :checked="check"
class="transform-scale-90" class="transform-scale-90"
:disabled="true" :disabled="true"
color="#002ce5" :color="$bluetooth.currentLockSetting.lockBasicInfo.keyRight === 1 ? '#002ce5' : '#71acff'"
/> />
</view> </view>
<view <view
v-if="check" v-if="check"
class="py-3 px-4 bg-white !py-2 flex items-center justify-between text-base mt-1" class="py-3 px-4 bg-white !py-2 flex items-center justify-between text-base mt-1"
@click="show = true" @click="open"
> >
<view class="item-title">延迟时间</view> <view class="item-title">延迟时间</view>
<view class="flex items-center"> <view class="flex items-center">
@ -35,6 +35,7 @@
经过以上设定的时间锁会自动关闭开启或修改设置后请先开一次锁使时间生效 经过以上设定的时间锁会自动关闭开启或修改设置后请先开一次锁使时间生效
</view> </view>
<view <view
v-if="$bluetooth.currentLockSetting.lockBasicInfo.keyRight === 1"
:class="[canUpdate ? 'bg-#63b8af' : 'bg-#a3a3a3']" :class="[canUpdate ? 'bg-#63b8af' : 'bg-#a3a3a3']"
class="mt-4 rounded-3xl w-600 h-80 line-height-80rpx text-center mx-75rpx text-white text-xl font-bold" class="mt-4 rounded-3xl w-600 h-80 line-height-80rpx text-center mx-75rpx text-white text-xl font-bold"
@click="update" @click="update"
@ -109,6 +110,11 @@
} }
}) })
const open = () => {
if ($bluetooth.currentLockSetting.lockBasicInfo.keyRight !== 1) return
show.value = true
}
const changeDuration = data => { const changeDuration = data => {
if (custom.value) { if (custom.value) {
value.value = Number(data) value.value = Number(data)
@ -176,6 +182,7 @@
} }
const changeCheck = () => { const changeCheck = () => {
if ($bluetooth.currentLockSetting.lockBasicInfo.keyRight !== 1) return
check.value = !check.value check.value = !check.value
if (!check.value) { if (!check.value) {
value.value = 0 value.value = 0

View File

@ -89,7 +89,10 @@
placeholder="请输入姓名" placeholder="请输入姓名"
@change-input="changeName('single', $event)" @change-input="changeName('single', $event)"
></LockInput> ></LockInput>
<view class="text mt-5 mb-50rpx">单次钥匙有效期为1小时只能使用一次</view> <view class="text mt-5">单次钥匙有效期为1小时只能使用一次</view>
<view class="text" style="margin-bottom: 50rpx">
小程序暂不支持邮箱登录若接收者账号为邮箱可先使用星星锁APP登录绑定手机号后可使用小程序登录
</view>
<view class="button" @click="createKey('single')">发送</view> <view class="button" @click="createKey('single')">发送</view>
</swiper-item> </swiper-item>
<swiper-item> <swiper-item>
@ -108,7 +111,10 @@
<view style="margin-top: 20rpx"> <view style="margin-top: 20rpx">
<LockCycle @change="changeCycle"></LockCycle> <LockCycle @change="changeCycle"></LockCycle>
</view> </view>
<view class="text mt-5 mb-50rpx">接收者可以在有效期内的固定时间段里不限次数使用</view> <view class="text mt-5">接收者可以在有效期内的固定时间段里不限次数使用</view>
<view class="text" style="margin-bottom: 50rpx"
>小程序暂不支持邮箱登录若接收者账号为邮箱可先使用星星锁APP登录绑定手机号后可使用小程序登录</view
>
<view class="button" @click="createKey('cycle')">发送</view> <view class="button" @click="createKey('cycle')">发送</view>
</swiper-item> </swiper-item>
</swiper> </swiper>

View File

@ -123,11 +123,11 @@
<script setup> <script setup>
import { getCurrentInstance, ref } from 'vue' import { getCurrentInstance, ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app' import { onLoad } from '@dcloudio/uni-app'
import { timeFormat } from 'uview-plus'
import { useBasicStore } from '@/stores/basic' import { useBasicStore } from '@/stores/basic'
import { useUserStore } from '@/stores/user' import { useUserStore } from '@/stores/user'
import { useBluetoothStore } from '@/stores/bluetooth' import { useBluetoothStore } from '@/stores/bluetooth'
import { checkPalmVeinNameRequest } from '@/api/palmVein' import { checkPalmVeinNameRequest } from '@/api/palmVein'
import { timeFormat } from 'uview-plus'
const instance = getCurrentInstance().proxy const instance = getCurrentInstance().proxy
const eventChannel = instance.getOpenerEventChannel() const eventChannel = instance.getOpenerEventChannel()

View File

@ -251,6 +251,7 @@
}) })
return return
} }
if (!info.value.type) { if (!info.value.type) {
const data = { const data = {
startDate: updateTime(startDate.value, startTimeText.value), startDate: updateTime(startDate.value, startTimeText.value),
@ -263,6 +264,11 @@
} }
}) })
} else { } else {
const netWork = await $basic.getNetworkType()
if (!netWork) {
return
}
if (pending.value) { if (pending.value) {
return return
} }

View File

@ -91,11 +91,13 @@
</view> </view>
<view class="m-4 flex items-center justify-between text-base"> <view class="m-4 flex items-center justify-between text-base">
<view <view
v-if="$lock.currentKeyInfo.keyType !== 3"
:class="[$lock.currentKeyInfo.keyStatus === 110405 ? 'text-#63b8af' : 'text-red']" :class="[$lock.currentKeyInfo.keyStatus === 110405 ? 'text-#63b8af' : 'text-red']"
@click="freeze" @click="freeze"
>{{ $lock.currentKeyInfo.keyStatus === 110405 ? '解冻' : '冻结' }}</view >{{ $lock.currentKeyInfo.keyStatus === 110405 ? '解冻' : '冻结' }}</view
> >
<view <view
v-if="$lock.currentKeyInfo.keyType !== 3 && $lock.currentKeyInfo.keyType !== 4"
:class="[$lock.currentKeyInfo.keyRight === 1 ? 'text-red' : 'text-#63b8af']" :class="[$lock.currentKeyInfo.keyRight === 1 ? 'text-red' : 'text-#63b8af']"
@click="authorize" @click="authorize"
>{{ $lock.currentKeyInfo.keyRight === 1 ? '取消授权管理员' : '授权管理员' }}</view >{{ $lock.currentKeyInfo.keyRight === 1 ? '取消授权管理员' : '授权管理员' }}</view
@ -157,7 +159,7 @@
<view>{{ <view>{{
$lock.currentKeyInfo.keyRight === 1 $lock.currentKeyInfo.keyRight === 1
? '取消授权会在用户APP连网后生效' ? '取消授权会在用户APP连网后生效'
: '授权用户拥有管理员的大部分权限,比如发送要是、发送密码' : '授权用户拥有管理员的大部分权限,比如发送钥匙、发送密码'
}}</view> }}</view>
</view> </view>
</up-modal> </up-modal>

View File

@ -176,7 +176,7 @@
mask: true mask: true
}) })
const that = this const that = this
const { code } = await deleteKeyRequest({ const { code, message } = await deleteKeyRequest({
keyId: that.deleteKeyId, keyId: that.deleteKeyId,
includeUnderlings: that.checked ? 1 : 0 includeUnderlings: that.checked ? 1 : 0
}) })
@ -195,7 +195,7 @@
} else { } else {
uni.hideLoading() uni.hideLoading()
uni.showToast({ uni.showToast({
title: 'message', title: message,
icon: 'none' icon: 'none'
}) })
} }

View File

@ -61,7 +61,7 @@
<view>电子钥匙</view> <view>电子钥匙</view>
</view> </view>
<view <view
v-if="currentLockInfo.lockFeature.password || currentLockInfo.keyRight === 1" v-if="currentLockInfo.lockFeature.password && currentLockInfo.keyRight === 1"
class="menu-main-view" class="menu-main-view"
@click="routeJump({ name: 'passwordList' })" @click="routeJump({ name: 'passwordList' })"
> >
@ -69,7 +69,7 @@
<view>密码</view> <view>密码</view>
</view> </view>
<view <view
v-if="currentLockInfo.lockFeature.icCard || currentLockInfo.keyRight === 1" v-if="currentLockInfo.lockFeature.icCard && currentLockInfo.keyRight === 1"
class="menu-main-view" class="menu-main-view"
@click="routeJump({ name: 'cardList' })" @click="routeJump({ name: 'cardList' })"
> >
@ -77,7 +77,7 @@
<view></view> <view></view>
</view> </view>
<view <view
v-if="currentLockInfo.lockFeature.fingerprint || currentLockInfo.keyRight === 1" v-if="currentLockInfo.lockFeature.fingerprint && currentLockInfo.keyRight === 1"
class="menu-main-view" class="menu-main-view"
@click="routeJump({ name: 'fingerprintList' })" @click="routeJump({ name: 'fingerprintList' })"
> >
@ -86,7 +86,7 @@
</view> </view>
<view <view
v-if=" v-if="
currentLockInfo.lockFeature.bluetoothRemoteControl || currentLockInfo.keyRight === 1 currentLockInfo.lockFeature.bluetoothRemoteControl && currentLockInfo.keyRight === 1
" "
class="menu-main-view" class="menu-main-view"
@click="routeJump({ name: 'remoteList' })" @click="routeJump({ name: 'remoteList' })"
@ -95,7 +95,7 @@
<view>遥控</view> <view>遥控</view>
</view> </view>
<view <view
v-if="currentLockInfo.lockFeature.d3Face || currentLockInfo.keyRight === 1" v-if="currentLockInfo.lockFeature.d3Face && currentLockInfo.keyRight === 1"
class="menu-main-view" class="menu-main-view"
@click="routeJump({ name: 'faceList' })" @click="routeJump({ name: 'faceList' })"
> >
@ -106,7 +106,7 @@
<view>人脸</view> <view>人脸</view>
</view> </view>
<view <view
v-if="currentLockInfo.lockFeature.palmVein || currentLockInfo.keyRight === 1" v-if="currentLockInfo.lockFeature.palmVein && currentLockInfo.keyRight === 1"
class="menu-main-view" class="menu-main-view"
@click="routeJump({ name: 'palmVeinList' })" @click="routeJump({ name: 'palmVeinList' })"
> >
@ -324,7 +324,7 @@
} }
} else if (code === 13) { } else if (code === 13) {
uni.showToast({ uni.showToast({
title: `只能在循环时间内操作门锁`, title: `钥匙当前不可用`,
icon: 'none' icon: 'none'
}) })
} else if (code === -1) { } else if (code === -1) {

View File

@ -68,8 +68,10 @@
> >
</view> </view>
</view> </view>
<view class="mt-2.5"></view>
<view <view
class="py-3 px-4 bg-white flex items-center justify-between text-base mt-2.5" v-if="$bluetooth.currentLockSetting.lockBasicInfo.keyRight === 1"
class="py-3 px-4 bg-white flex items-center justify-between text-base mb-4rpx"
@click="() => $refs.modalInput.open()" @click="() => $refs.modalInput.open()"
> >
<view>名称</view> <view>名称</view>
@ -81,7 +83,7 @@
</view> </view>
</view> </view>
<view <view
class="py-3 px-4 bg-white flex items-center justify-between text-base mt-4rpx" class="py-3 px-4 bg-white flex items-center justify-between text-base mb-4rpx"
@click="toJump('selectGroup')" @click="toJump('selectGroup')"
> >
<view>锁分组</view> <view>锁分组</view>
@ -93,7 +95,8 @@
</view> </view>
</view> </view>
<view <view
class="py-3 px-4 bg-white flex items-center justify-between text-base mt-4rpx" v-if="$bluetooth.currentLockSetting.lockBasicInfo.isLockOwner === 1"
class="py-3 px-4 bg-white flex items-center justify-between text-base mb-4rpx"
@click="() => $refs.modalPassword.open()" @click="() => $refs.modalPassword.open()"
> >
<view>管理员开锁密码</view> <view>管理员开锁密码</view>
@ -102,7 +105,7 @@
<up-icon name="arrow-right"></up-icon> <up-icon name="arrow-right"></up-icon>
</view> </view>
</view> </view>
<view class="py-3 px-4 bg-white flex items-center justify-between text-base mt-4rpx"> <view class="py-3 px-4 bg-white flex items-center justify-between text-base">
<view>位置信息</view> <view>位置信息</view>
<view class="flex items-center max-w-400"> <view class="flex items-center max-w-400">
<view>{{ $bluetooth.currentLockSetting.lockBasicInfo.address }}</view> <view>{{ $bluetooth.currentLockSetting.lockBasicInfo.address }}</view>

View File

@ -52,7 +52,11 @@
timeFormat($lock.currentPasswordInfo.sendDate, 'yyyy-mm-dd h:M') timeFormat($lock.currentPasswordInfo.sendDate, 'yyyy-mm-dd h:M')
}}</view> }}</view>
</view> </view>
<view class="item !py-2" style="margin-top: 20rpx"> <view
class="item !py-2"
style="margin-top: 20rpx"
v-if="$lock.currentPasswordInfo.isCustom === 1"
>
<view class="item-title">是否为管理员</view> <view class="item-title">是否为管理员</view>
<switch <switch
@click="disabled" @click="disabled"
@ -62,10 +66,18 @@
color="#002ce5" color="#002ce5"
/> />
</view> </view>
<view class="item" style="margin-top: 20rpx" @click="toRecordList"> <view
v-if="$lock.currentPasswordInfo.keyboardPwdType !== 4"
class="item"
style="margin-top: 20rpx"
@click="toRecordList"
>
<view class="item-title">操作记录</view> <view class="item-title">操作记录</view>
<up-icon name="arrow-right"></up-icon> <up-icon name="arrow-right"></up-icon>
</view> </view>
<view class="text-sm text-#262626 mt-3 mx-4" v-if="$lock.currentPasswordInfo.isCustom !== 1">
密码生成后请在当日23:59前使用一次进行激活否则过0点后未激活则失效
</view>
<view class="button" @click="deletePassword">删除</view> <view class="button" @click="deletePassword">删除</view>
<ModalInput <ModalInput
ref="modalInput" ref="modalInput"
@ -155,6 +167,12 @@
}) })
return return
} }
const netWork = await $basic.getNetworkType()
if (!netWork) {
return
}
if (pending.value) return if (pending.value) return
pending.value = true pending.value = true

View File

@ -7,8 +7,10 @@
<view class="item-title">基本信息</view> <view class="item-title">基本信息</view>
<view><up-icon name="arrow-right"></up-icon></view> <view><up-icon name="arrow-right"></up-icon></view>
</view> </view>
<view class="mt-2.5"></view>
<view <view
class="py-3 px-4 bg-white flex items-center justify-between text-base mt-2.5" class="py-3 px-4 bg-white flex items-center justify-between text-base mb-4rpx"
v-if="$bluetooth.currentLockSetting.lockFeature.autoLock === 1"
@click="toJump('autoLock')" @click="toJump('autoLock')"
> >
<view class="item-title">自动闭锁</view> <view class="item-title">自动闭锁</view>
@ -24,7 +26,11 @@
</view> </view>
</view> </view>
<view <view
class="py-3 px-4 bg-white flex items-center justify-between text-base mt-4rpx" v-if="
$bluetooth.currentLockSetting.lockSettingInfo.lockSound === 1 &&
$bluetooth.currentLockSetting.lockBasicInfo.keyRight === 1
"
class="py-3 px-4 bg-white flex items-center justify-between text-base mb-4rpx"
@click="toJump('lockSound')" @click="toJump('lockSound')"
> >
<view class="item-title">锁声音</view> <view class="item-title">锁声音</view>
@ -40,7 +46,11 @@
</view> </view>
</view> </view>
<view <view
class="py-3 px-4 bg-white flex items-center justify-between text-base mt-4rpx" 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"
@click="toUpdateSetting('antiPrySwitch')" @click="toUpdateSetting('antiPrySwitch')"
> >
<view class="item-title">防撬报警</view> <view class="item-title">防撬报警</view>
@ -53,8 +63,13 @@
<up-icon name="arrow-right"></up-icon> <up-icon name="arrow-right"></up-icon>
</view> </view>
</view> </view>
<view class="mt-2.5"></view>
<view <view
class="py-3 px-4 bg-white flex items-center justify-between text-base mt-2.5" 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"
@click="toUpdateSetting('remoteUnlock')" @click="toUpdateSetting('remoteUnlock')"
> >
<view class="item-title">远程开锁</view> <view class="item-title">远程开锁</view>
@ -68,7 +83,11 @@
</view> </view>
</view> </view>
<view <view
class="py-3 px-4 bg-white flex items-center justify-between text-base mt-4rpx" 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"
@click="toUpdateSetting('resetSwitch')" @click="toUpdateSetting('resetSwitch')"
> >
<view class="item-title">重置键</view> <view class="item-title">重置键</view>
@ -81,21 +100,30 @@
<up-icon name="arrow-right"></up-icon> <up-icon name="arrow-right"></up-icon>
</view> </view>
</view> </view>
<view class="mt-2.5"></view>
<view <view
class="py-3 px-4 bg-white flex items-center justify-between text-base mt-2.5" 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"
@click="toJump('faceSetting')" @click="toJump('faceSetting')"
> >
<view class="item-title">面容开锁</view> <view class="item-title">面容开锁</view>
<view><up-icon name="arrow-right"></up-icon></view> <view><up-icon name="arrow-right"></up-icon></view>
</view> </view>
<!-- <view class="py-3 px-4 bg-white flex items-center justify-between text-base">-->
<!-- <view class="item-title">消息提醒</view>-->
<!-- <view><up-icon name="arrow-right"></up-icon></view>-->
<!-- </view>-->
<view class="mt-2.5"></view>
<view <view
class="py-3 px-4 bg-white flex items-center justify-between text-base mt-4rpx" class="py-3 px-4 bg-white !py-2 flex items-center justify-between text-base"
@click="toJump('lockInfo')" v-if="
$bluetooth.currentLockSetting.lockFeature.unlockReminder === 1 &&
$bluetooth.currentLockSetting.lockBasicInfo.isLockOwner === 1
"
> >
<view class="item-title">消息提醒</view>
<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-2.5">
<view class="item-title">开锁提醒</view> <view class="item-title">开锁提醒</view>
<switch <switch
@click="changeSetting('unlockReminder')" @click="changeSetting('unlockReminder')"
@ -105,7 +133,13 @@
color="#002ce5" color="#002ce5"
/> />
</view> </view>
<view class="py-3 px-4 bg-white !py-2 flex items-center justify-between text-base mt-4rpx"> <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"
>
<view class="item-title">开锁时是否需联网</view> <view class="item-title">开锁时是否需联网</view>
<switch <switch
@click="changeSetting('appUnlockOnline')" @click="changeSetting('appUnlockOnline')"
@ -123,19 +157,17 @@
<view><up-icon name="arrow-right"></up-icon></view> <view><up-icon name="arrow-right"></up-icon></view>
</view> </view>
<view <view
v-if="$bluetooth.currentLockSetting.lockBasicInfo.keyRight === 1"
class="py-3 px-4 bg-white flex items-center justify-between text-base mt-4rpx" class="py-3 px-4 bg-white flex items-center justify-between text-base mt-4rpx"
@click="toJump('uploadLockData')" @click="toJump('uploadLockData')"
> >
<view class="item-title">上传数据</view> <view class="item-title">上传数据</view>
<view><up-icon name="arrow-right"></up-icon></view> <view><up-icon name="arrow-right"></up-icon></view>
</view> </view>
<view <!-- <view class="py-3 px-4 bg-white flex items-center justify-between text-base mt-4rpx">-->
class="py-3 px-4 bg-white flex items-center justify-between text-base mt-4rpx" <!-- <view class="item-title">锁升级</view>-->
@click="toJump('lockInfo')" <!-- <view><up-icon name="arrow-right"></up-icon></view>-->
> <!-- </view>-->
<view class="item-title">锁升级</view>
<view><up-icon name="arrow-right"></up-icon></view>
</view>
<view <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" 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" @click="deleteLock"

View File

@ -141,6 +141,11 @@
return return
} }
const netWork = await $basic.getNetworkType()
if (!netWork) {
return
}
if (pending.value) { if (pending.value) {
return return
} }