完成人脸、遥控、掌静脉相关功能
48
api/face.js
Normal file
@ -0,0 +1,48 @@
|
||||
import request from '../utils/request'
|
||||
|
||||
// face 人脸模块
|
||||
|
||||
// 获取人脸列表
|
||||
export function getFaceList(data) {
|
||||
return request({
|
||||
url: '/face/list',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除人脸
|
||||
export function deleteFaceRequest(data) {
|
||||
return request({
|
||||
url: '/face/delete',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 清空人脸
|
||||
export function clearFaceRequest(data) {
|
||||
return request({
|
||||
url: '/face/clear',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 检查人脸名称是否重复
|
||||
export function checkFaceNameRequest(data) {
|
||||
return request({
|
||||
url: '/face/checkFaceName',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 添加人脸
|
||||
export function addFaceRequest(data) {
|
||||
return request({
|
||||
url: '/face/add',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
}
|
||||
48
api/palmVein.js
Normal file
@ -0,0 +1,48 @@
|
||||
import request from '../utils/request'
|
||||
|
||||
// palmVein 掌纹模块
|
||||
|
||||
// 获取掌纹列表
|
||||
export function getPalmVeinList(data) {
|
||||
return request({
|
||||
url: '/palmVein/list',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除掌纹
|
||||
export function deletePalmVeinRequest(data) {
|
||||
return request({
|
||||
url: '/palmVein/delete',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 清空掌纹
|
||||
export function clearPalmVeinRequest(data) {
|
||||
return request({
|
||||
url: '/palmVein/clear',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 检查掌纹名称是否重复
|
||||
export function checkPalmVeinNameRequest(data) {
|
||||
return request({
|
||||
url: '/palmVein/checkPalmVeinName',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 添加掌纹
|
||||
export function addPalmVeinRequest(data) {
|
||||
return request({
|
||||
url: '/palmVein/add',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
}
|
||||
48
api/remote.js
Normal file
@ -0,0 +1,48 @@
|
||||
import request from '../utils/request'
|
||||
|
||||
// remote 远程模块
|
||||
|
||||
// 获取远程列表
|
||||
export function getRemoteList(data) {
|
||||
return request({
|
||||
url: '/remote/list',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除远程
|
||||
export function deleteRemoteRequest(data) {
|
||||
return request({
|
||||
url: '/remote/delete',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 清空远程
|
||||
export function clearRemoteRequest(data) {
|
||||
return request({
|
||||
url: '/remote/clear',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 检查远程名称是否重复
|
||||
export function checkRemoteNameRequest(data) {
|
||||
return request({
|
||||
url: '/remote/checkRemoteName',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 添加远程
|
||||
export function addRemoteRequest(data) {
|
||||
return request({
|
||||
url: '/remote/add',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
}
|
||||
84
pages.json
@ -197,6 +197,90 @@
|
||||
"navigationBarTitleText": "添加指纹",
|
||||
"disableScroll": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/faceList/faceList",
|
||||
"style": {
|
||||
"navigationBarTitleText": "人脸",
|
||||
"disableScroll": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/createFace/createFace",
|
||||
"style": {
|
||||
"navigationBarTitleText": "添加人脸",
|
||||
"disableScroll": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/faceDetail/faceDetail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "人脸详情",
|
||||
"disableScroll": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/bindFace/bindFace",
|
||||
"style": {
|
||||
"navigationBarTitleText": "添加人脸",
|
||||
"disableScroll": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/remoteList/remoteList",
|
||||
"style": {
|
||||
"navigationBarTitleText": "遥控",
|
||||
"disableScroll": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/createRemote/createRemote",
|
||||
"style": {
|
||||
"navigationBarTitleText": "添加遥控",
|
||||
"disableScroll": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/remoteDetail/remoteDetail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "遥控详情",
|
||||
"disableScroll": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/bindRemote/bindRemote",
|
||||
"style": {
|
||||
"navigationBarTitleText": "添加遥控",
|
||||
"disableScroll": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/palmVeinList/palmVeinList",
|
||||
"style": {
|
||||
"navigationBarTitleText": "掌静脉",
|
||||
"disableScroll": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/createPalmVein/createPalmVein",
|
||||
"style": {
|
||||
"navigationBarTitleText": "添加掌静脉",
|
||||
"disableScroll": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/palmVeinDetail/palmVeinDetail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "掌静脉详情",
|
||||
"disableScroll": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/bindPalmVein/bindPalmVein",
|
||||
"style": {
|
||||
"navigationBarTitleText": "添加掌静脉",
|
||||
"disableScroll": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"globalStyle": {
|
||||
|
||||
@ -67,6 +67,28 @@
|
||||
} else {
|
||||
$basic.backAndToast(message)
|
||||
}
|
||||
} else if (data.status === 0xff) {
|
||||
$basic.backAndToast('添加失败,请重试')
|
||||
} else if (data.status === 0xfe) {
|
||||
uni.showToast({
|
||||
title: '管理员已满',
|
||||
icon: 'none'
|
||||
})
|
||||
} else if (data.status === 0xfd) {
|
||||
uni.showToast({
|
||||
title: '用户已满',
|
||||
icon: 'none'
|
||||
})
|
||||
} else if (data.status === 0xfc) {
|
||||
uni.showToast({
|
||||
title: '卡片已满',
|
||||
icon: 'none'
|
||||
})
|
||||
} else if (data.status === 0xfb) {
|
||||
uni.showToast({
|
||||
title: '卡片已存在',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
132
pages/bindFace/bindFace.vue
Normal file
@ -0,0 +1,132 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="flex justify-center flex-col pt-10 text-align-center text-base">
|
||||
<image
|
||||
v-if="showProcess"
|
||||
src="/static/images/icon_add_face_1.png"
|
||||
mode="widthFix"
|
||||
class="mx-[100rpx] w-550 mt-5 rounded-2xl"
|
||||
></image>
|
||||
<image
|
||||
v-else
|
||||
src="/static/images/icon_add_face_2.png"
|
||||
mode="widthFix"
|
||||
class="mx-[100rpx] w-550 mt-5 rounded-2xl"
|
||||
></image>
|
||||
<view class="my-10 text-align-left mx-3">
|
||||
<view>请单人正对门锁,距离一个成年人手臂长度</view><view>(约0.6米)。</view
|
||||
><view>保持脸部无遮挡,漏出五官</view>
|
||||
</view>
|
||||
<view v-if="showProcess" class="mt-5 font-bold"> 正在录入中… </view>
|
||||
<view v-else> <view class="button mt-5" @click="ready">准备好了,开始添加</view> </view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onUnmounted, getCurrentInstance } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { useBluetoothStore } from '@/stores/bluetooth'
|
||||
import { useBasicStore } from '@/stores/basic'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { addFaceRequest } from '@/api/face'
|
||||
|
||||
const instance = getCurrentInstance().proxy
|
||||
const eventChannel = instance.getOpenerEventChannel()
|
||||
|
||||
const $bluetooth = useBluetoothStore()
|
||||
const $basic = useBasicStore()
|
||||
const $user = useUserStore()
|
||||
|
||||
const bindFlag = ref(false)
|
||||
const showProcess = ref(false)
|
||||
|
||||
const params = ref(null)
|
||||
|
||||
onLoad(async options => {
|
||||
if (options.info) {
|
||||
params.value = JSON.parse(options.info)
|
||||
uni.$on('registerFaceConfirm', async data => {
|
||||
if (data.status === 0) {
|
||||
bindFlag.value = true
|
||||
const { code, message } = await addFaceRequest({
|
||||
lockId: $bluetooth.currentLockInfo.lockId,
|
||||
startDate: params.value.startDate,
|
||||
endDate: params.value.endDate,
|
||||
faceName: params.value.faceName,
|
||||
faceNumber: String(data.faceNumber),
|
||||
faceType: params.value.faceType,
|
||||
addType: 1,
|
||||
fingerRight: params.value.isAdmin,
|
||||
isCoerced: params.value.isForce === 1 ? 2 : 1
|
||||
})
|
||||
if (code === 0) {
|
||||
eventChannel.emit('refresherList', {})
|
||||
$basic.backAndToast('添加成功', 2)
|
||||
} else {
|
||||
$basic.backAndToast(message)
|
||||
}
|
||||
}
|
||||
})
|
||||
uni.$on('registerFaceProcess', data => {
|
||||
if (data.status === 0xff) {
|
||||
$basic.backAndToast('添加失败,请重试')
|
||||
} else if (data.status === 0xfe) {
|
||||
uni.showToast({
|
||||
title: '管理员已满',
|
||||
icon: 'none'
|
||||
})
|
||||
} else if (data.status === 0xfd) {
|
||||
uni.showToast({
|
||||
title: '用户已满',
|
||||
icon: 'none'
|
||||
})
|
||||
} else if (data.status === 0xfc) {
|
||||
uni.showToast({
|
||||
title: '人脸已满',
|
||||
icon: 'none'
|
||||
})
|
||||
} else if (data.status === 0xfb) {
|
||||
uni.showToast({
|
||||
title: '人脸已存在',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
const ready = async () => {
|
||||
showProcess.value = true
|
||||
const { code } = await $bluetooth.registerAuthentication(params.value)
|
||||
if (code !== 0) {
|
||||
$basic.backAndToast('操作失败,请重试')
|
||||
}
|
||||
}
|
||||
|
||||
onUnmounted(() => {
|
||||
uni.$off('registerFaceConfirm')
|
||||
if (!bindFlag.value) {
|
||||
$bluetooth.registerAuthenticationCancel({
|
||||
type: 'face',
|
||||
keyId: $bluetooth.keyId.toString(),
|
||||
uid: $user.userInfo.uid.toString()
|
||||
})
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.button {
|
||||
border-radius: 64rpx;
|
||||
width: 686rpx;
|
||||
margin-left: 32rpx;
|
||||
height: 100rpx;
|
||||
line-height: 100rpx;
|
||||
text-align: center;
|
||||
background-color: #63b8af;
|
||||
color: #fff;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
@ -4,7 +4,7 @@
|
||||
<view>
|
||||
{{ text }}
|
||||
</view>
|
||||
<view v-if="showProcess" class="mt-5 font-bold">({{ process }}/5)</view>
|
||||
<view v-if="showProcess" class="mt-5 font-bold">({{ process }}/{{ maxProcess }})</view>
|
||||
<image
|
||||
:src="`/static/images/icon_fingerprint_${process}.png`"
|
||||
mode="widthFix"
|
||||
@ -33,16 +33,18 @@
|
||||
const bindFlag = ref(false)
|
||||
const showProcess = ref(false)
|
||||
const process = ref(0)
|
||||
const maxProcess = ref(0)
|
||||
|
||||
const text = ref('尝试连接设备…')
|
||||
|
||||
onLoad(async options => {
|
||||
if (options.info) {
|
||||
const params = JSON.parse(options.info)
|
||||
const { code } = await $bluetooth.registerAuthentication(params)
|
||||
const { code, data } = await $bluetooth.registerAuthentication(params)
|
||||
|
||||
if (code === 0) {
|
||||
text.value = '请将您的手指按下'
|
||||
maxProcess.value = data.maxProcess
|
||||
showProcess.value = true
|
||||
} else {
|
||||
$basic.backAndToast('操作失败,请重试')
|
||||
@ -73,6 +75,28 @@
|
||||
uni.$on('registerFingerprintProcess', data => {
|
||||
if (data.status === 0) {
|
||||
process.value = data.process
|
||||
} else if (data.status === 0xff) {
|
||||
$basic.backAndToast('添加失败,请重试')
|
||||
} else if (data.status === 0xfe) {
|
||||
uni.showToast({
|
||||
title: '管理员已满',
|
||||
icon: 'none'
|
||||
})
|
||||
} else if (data.status === 0xfd) {
|
||||
uni.showToast({
|
||||
title: '用户已满',
|
||||
icon: 'none'
|
||||
})
|
||||
} else if (data.status === 0xfc) {
|
||||
uni.showToast({
|
||||
title: '指纹已满',
|
||||
icon: 'none'
|
||||
})
|
||||
} else if (data.status === 0xfb) {
|
||||
uni.showToast({
|
||||
title: '指纹已存在',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
105
pages/bindPalmVein/bindPalmVein.vue
Normal file
@ -0,0 +1,105 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="flex justify-center flex-col pt-20">
|
||||
<image
|
||||
src="/static/images/icon_add_palm_vein.png"
|
||||
mode="aspectFill"
|
||||
class="mx-[125rpx] w-500 h-500"
|
||||
></image>
|
||||
<view
|
||||
class="text-base rounded-xl mt-15 bg-#5eb4ac mx-[32rpx] w-686 h-80 text-align-center line-height-[80rpx] text-white shadow-sm"
|
||||
>{{ text }}</view
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onUnmounted, getCurrentInstance } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { useBluetoothStore } from '@/stores/bluetooth'
|
||||
import { useBasicStore } from '@/stores/basic'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { addPalmVeinRequest } from '@/api/palmVein'
|
||||
|
||||
const instance = getCurrentInstance().proxy
|
||||
const eventChannel = instance.getOpenerEventChannel()
|
||||
|
||||
const $bluetooth = useBluetoothStore()
|
||||
const $basic = useBasicStore()
|
||||
const $user = useUserStore()
|
||||
|
||||
const bindFlag = ref(false)
|
||||
|
||||
const text = ref('尝试连接设备…')
|
||||
|
||||
onLoad(async options => {
|
||||
if (options.info) {
|
||||
const params = JSON.parse(options.info)
|
||||
const { code } = await $bluetooth.registerAuthentication(params)
|
||||
|
||||
if (code === 0) {
|
||||
text.value = '已连接到锁,请自然张开手掌,掌心对准摄像头'
|
||||
} else {
|
||||
$basic.backAndToast('操作失败,请重试')
|
||||
}
|
||||
|
||||
uni.$on('registerPalmVeinConfirm', async data => {
|
||||
if (data.status === 0) {
|
||||
bindFlag.value = true
|
||||
const { code, message } = await addPalmVeinRequest({
|
||||
lockId: $bluetooth.currentLockInfo.lockId,
|
||||
startDate: params.startDate,
|
||||
endDate: params.endDate,
|
||||
palmVeinName: params.palmVeinName,
|
||||
palmVeinNumber: String(data.palmVeinNumber),
|
||||
palmVeinType: params.palmVeinType,
|
||||
addType: 1,
|
||||
palmVeinRight: params.isAdmin,
|
||||
isCoerced: params.isForce === 1 ? 2 : 1
|
||||
})
|
||||
if (code === 0) {
|
||||
eventChannel.emit('refresherList', {})
|
||||
$basic.backAndToast('绑卡成功', 2)
|
||||
} else {
|
||||
$basic.backAndToast(message)
|
||||
}
|
||||
} else if (data.status === 0xff) {
|
||||
$basic.backAndToast('添加失败,请重试')
|
||||
} else if (data.status === 0xfe) {
|
||||
uni.showToast({
|
||||
title: '管理员已满',
|
||||
icon: 'none'
|
||||
})
|
||||
} else if (data.status === 0xfd) {
|
||||
uni.showToast({
|
||||
title: '用户已满',
|
||||
icon: 'none'
|
||||
})
|
||||
} else if (data.status === 0xfc) {
|
||||
uni.showToast({
|
||||
title: '掌静脉已满',
|
||||
icon: 'none'
|
||||
})
|
||||
} else if (data.status === 0xfb) {
|
||||
uni.showToast({
|
||||
title: '掌静脉已存在',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
onUnmounted(async () => {
|
||||
uni.$off('registerPalmVeinConfirm')
|
||||
if (!bindFlag.value) {
|
||||
await $bluetooth.registerAuthenticationCancel({
|
||||
type: 'palmVein',
|
||||
keyId: $bluetooth.keyId.toString(),
|
||||
uid: $user.userInfo.uid.toString()
|
||||
})
|
||||
}
|
||||
$bluetooth.closeBluetoothConnection()
|
||||
})
|
||||
</script>
|
||||
114
pages/bindRemote/bindRemote.vue
Normal file
@ -0,0 +1,114 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="flex justify-center flex-col pt-20">
|
||||
<image
|
||||
src="/static/images/icon_add_remote.png"
|
||||
mode="aspectFill"
|
||||
class="mx-[200rpx] w-350 h-350"
|
||||
></image>
|
||||
<view class="mt-5">
|
||||
<up-loading-icon size="70rpx" text="" :vertical="true" textSize="32rpx"></up-loading-icon>
|
||||
</view>
|
||||
<view
|
||||
class="text-base rounded-xl mt-15 bg-black mx-[75rpx] w-600 h-80 text-align-center line-height-[80rpx] text-white shadow-sm"
|
||||
>{{ text }}</view
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onUnmounted, getCurrentInstance } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { useBluetoothStore } from '@/stores/bluetooth'
|
||||
import { useBasicStore } from '@/stores/basic'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { addRemoteRequest } from '@/api/remote'
|
||||
|
||||
const instance = getCurrentInstance().proxy
|
||||
const eventChannel = instance.getOpenerEventChannel()
|
||||
|
||||
const $bluetooth = useBluetoothStore()
|
||||
const $basic = useBasicStore()
|
||||
const $user = useUserStore()
|
||||
|
||||
const bindFlag = ref(false)
|
||||
|
||||
const text = ref('尝试连接设备…')
|
||||
|
||||
onLoad(async options => {
|
||||
if (options.info) {
|
||||
const params = JSON.parse(options.info)
|
||||
const { code } = await $bluetooth.registerAuthentication(params)
|
||||
|
||||
if (code === 0) {
|
||||
text.value = '已连接到锁,请按遥控'
|
||||
} else {
|
||||
$basic.backAndToast('操作失败,请重试')
|
||||
}
|
||||
|
||||
uni.$on('registerRemoteConfirm', async data => {
|
||||
if (data.status === 0) {
|
||||
bindFlag.value = true
|
||||
const { code, message } = await addRemoteRequest({
|
||||
lockId: $bluetooth.currentLockInfo.lockId,
|
||||
startDate: params.startDate,
|
||||
endDate: params.endDate,
|
||||
remoteName: params.remoteName,
|
||||
remoteNumber: String(data.remoteNumber),
|
||||
remoteType: params.remoteType,
|
||||
addType: 1,
|
||||
remoteRight: params.isAdmin,
|
||||
isCoerced: params.isForce === 1 ? 2 : 1
|
||||
})
|
||||
if (code === 0) {
|
||||
eventChannel.emit('refresherList', {})
|
||||
$basic.backAndToast('添加成功', 2)
|
||||
} else {
|
||||
$basic.backAndToast(message)
|
||||
}
|
||||
} else if (data.status === 0xff) {
|
||||
$basic.backAndToast('添加失败,请重试')
|
||||
} else if (data.status === 0xfe) {
|
||||
uni.showToast({
|
||||
title: '管理员已满',
|
||||
icon: 'none'
|
||||
})
|
||||
} else if (data.status === 0xfd) {
|
||||
uni.showToast({
|
||||
title: '用户已满',
|
||||
icon: 'none'
|
||||
})
|
||||
} else if (data.status === 0xfc) {
|
||||
uni.showToast({
|
||||
title: '遥控已满',
|
||||
icon: 'none'
|
||||
})
|
||||
} else if (data.status === 0xfb) {
|
||||
uni.showToast({
|
||||
title: '遥控已存在',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
onUnmounted(async () => {
|
||||
uni.$off('registerRemoteConfirm')
|
||||
if (!bindFlag.value) {
|
||||
await $bluetooth.registerAuthenticationCancel({
|
||||
type: 'remote',
|
||||
keyId: $bluetooth.keyId.toString(),
|
||||
uid: $user.userInfo.uid.toString()
|
||||
})
|
||||
}
|
||||
$bluetooth.closeBluetoothConnection()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: $uni-bg-color-grey;
|
||||
}
|
||||
</style>
|
||||
307
pages/createFace/createFace.vue
Normal file
@ -0,0 +1,307 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="tabs">
|
||||
<up-tabs
|
||||
:list="tabs"
|
||||
lineWidth="40rpx"
|
||||
lineHeight="5rpx"
|
||||
:current="currentIndex"
|
||||
lineColor="#63b8af"
|
||||
@click="clickTab"
|
||||
:inactiveStyle="{ color: '#a3a3a3', fontSize: '32rpx', fontWeight: 'bold' }"
|
||||
:activeStyle="{ color: '#63b8af', fontSize: '32rpx', fontWeight: 'bold' }"
|
||||
>
|
||||
</up-tabs>
|
||||
</view>
|
||||
<swiper
|
||||
:style="{ height: deviceInfo.screenHeight - deviceInfo.safeArea.top - 44 + 'px' }"
|
||||
v-if="deviceInfo"
|
||||
:list="tabs"
|
||||
:autoplay="false"
|
||||
:circular="true"
|
||||
:current="currentIndex"
|
||||
@change="changeSwiper"
|
||||
>
|
||||
<swiper-item>
|
||||
<LockInput
|
||||
:value="permanentName"
|
||||
title="姓名"
|
||||
placeholder="请输入"
|
||||
@change-input="changeName('permanent', $event)"
|
||||
></LockInput>
|
||||
<view class="mt-3">
|
||||
<LockSwitch
|
||||
:value="permanentAdmin"
|
||||
title="是否为管理员"
|
||||
@change="changeAdmin('permanent', $event)"
|
||||
></LockSwitch>
|
||||
</view>
|
||||
<view class="button mt-5" @click="create('permanent')">下一步</view>
|
||||
</swiper-item>
|
||||
<swiper-item :style="{ height: deviceInfo.windowHeight - 44 + 'px' }">
|
||||
<LockInput
|
||||
:value="temporaryName"
|
||||
title="姓名"
|
||||
placeholder="请输入"
|
||||
@change-input="changeName('temporary', $event)"
|
||||
></LockInput>
|
||||
<view class="mt-3">
|
||||
<LockDatetimePicker
|
||||
title="生效时间"
|
||||
:value="temporaryStartTime"
|
||||
:minDate="minDate"
|
||||
:maxDate="maxDate"
|
||||
type="datehour"
|
||||
@change-time="changeDate('temporaryStartTime', $event)"
|
||||
></LockDatetimePicker>
|
||||
</view>
|
||||
<view class="mt-3">
|
||||
<LockDatetimePicker
|
||||
title="失效时间"
|
||||
:value="temporaryEndTime"
|
||||
:minDate="minDate"
|
||||
:maxDate="maxDate"
|
||||
type="datehour"
|
||||
@change-time="changeDate('temporaryEndTime', $event)"
|
||||
></LockDatetimePicker>
|
||||
</view>
|
||||
<view class="mt-3">
|
||||
<LockSwitch
|
||||
:value="temporaryAdmin"
|
||||
title="是否为管理员"
|
||||
@change="changeAdmin('temporary', $event)"
|
||||
></LockSwitch>
|
||||
</view>
|
||||
<view class="button mt-5" @click="create('temporary')">下一步</view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { getCurrentInstance, ref } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { useBasicStore } from '@/stores/basic'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { useBluetoothStore } from '@/stores/bluetooth'
|
||||
import { checkFaceNameRequest } from '@/api/face'
|
||||
|
||||
const instance = getCurrentInstance().proxy
|
||||
const eventChannel = instance.getOpenerEventChannel()
|
||||
|
||||
const $basic = useBasicStore()
|
||||
const $bluetooth = useBluetoothStore()
|
||||
const $user = useUserStore()
|
||||
|
||||
const tabs = [
|
||||
{
|
||||
name: '永久'
|
||||
},
|
||||
{
|
||||
name: '限时'
|
||||
}
|
||||
]
|
||||
|
||||
const permanentName = ref('')
|
||||
const permanentAdmin = ref(false)
|
||||
|
||||
const temporaryName = ref('')
|
||||
const temporaryStartTime = ref(Number(new Date()))
|
||||
const temporaryEndTime = ref(Number(new Date()))
|
||||
const temporaryAdmin = ref(false)
|
||||
|
||||
const minDate = ref(Number(new Date()))
|
||||
const maxDate = ref(Number(4133951940000))
|
||||
const currentIndex = ref(0)
|
||||
const deviceInfo = ref(null)
|
||||
|
||||
onLoad(async () => {
|
||||
deviceInfo.value = await $basic.getDeviceInfo()
|
||||
temporaryStartTime.value = setTime()
|
||||
temporaryEndTime.value = setTime()
|
||||
minDate.value = Number(getNextFullHour())
|
||||
maxDate.value = Number(getFutureTimestamp())
|
||||
})
|
||||
|
||||
const getNextFullHour = () => {
|
||||
const now = new Date()
|
||||
const currentHour = now.getHours()
|
||||
now.setHours(currentHour)
|
||||
now.setMinutes(0)
|
||||
now.setSeconds(0)
|
||||
now.setMilliseconds(0)
|
||||
|
||||
return now
|
||||
}
|
||||
|
||||
const getFutureTimestamp = () => {
|
||||
const currentDate = new Date()
|
||||
|
||||
const year = currentDate.getFullYear()
|
||||
const month = currentDate.getMonth()
|
||||
const day = currentDate.getDate()
|
||||
|
||||
const futureDate = new Date(year + 3, month, day, 23, 0, 0)
|
||||
|
||||
return futureDate.getTime()
|
||||
}
|
||||
|
||||
const setTime = () => {
|
||||
const now = new Date()
|
||||
now.setMinutes(0, 0, 0)
|
||||
|
||||
return now.getTime()
|
||||
}
|
||||
|
||||
const create = async type => {
|
||||
if (
|
||||
(type === 'temporary' && temporaryName.value === '') ||
|
||||
(type === 'permanent' && permanentName.value === '')
|
||||
) {
|
||||
uni.showToast({
|
||||
title: '名称不能为空',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (type === 'temporary' && temporaryStartTime.value > temporaryEndTime.value) {
|
||||
uni.showToast({
|
||||
title: '失效时间要大于生效时间',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
const netWork = await $basic.getNetworkType()
|
||||
if (!netWork) {
|
||||
return
|
||||
}
|
||||
|
||||
let params = {
|
||||
type: 'face',
|
||||
keyId: $bluetooth.keyId.toString(),
|
||||
uid: $user.userInfo.uid.toString(),
|
||||
no: 0,
|
||||
operate: 0,
|
||||
userCountLimit: 0xffff
|
||||
}
|
||||
|
||||
if (type === 'permanent') {
|
||||
params = {
|
||||
...params,
|
||||
faceName: permanentName.value,
|
||||
isAdmin: permanentAdmin.value ? 1 : 0,
|
||||
weekDays: [],
|
||||
isRound: 0,
|
||||
startDate: 0,
|
||||
faceType: 1,
|
||||
endDate: 0,
|
||||
startTime: '00:00',
|
||||
endTime: '00:00'
|
||||
}
|
||||
} else {
|
||||
params = {
|
||||
...params,
|
||||
faceName: temporaryName.value,
|
||||
isAdmin: temporaryAdmin.value ? 1 : 0,
|
||||
weekDays: [],
|
||||
faceType: 2,
|
||||
isRound: 0,
|
||||
startDate: temporaryStartTime.value,
|
||||
endDate: temporaryEndTime.value,
|
||||
startTime: '00:00',
|
||||
endTime: '00:00'
|
||||
}
|
||||
}
|
||||
|
||||
const { code, message } = await checkFaceNameRequest({
|
||||
lockId: $bluetooth.currentLockInfo.lockId,
|
||||
faceName: params.faceName
|
||||
})
|
||||
if (code === 0) {
|
||||
$basic.routeJump({
|
||||
name: 'bindFace',
|
||||
params: {
|
||||
info: JSON.stringify(params)
|
||||
},
|
||||
events: {
|
||||
refresherList() {
|
||||
eventChannel.emit('refresherList', {})
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: message,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const changeName = (type, event) => {
|
||||
if (type === 'permanent') {
|
||||
permanentName.value = event
|
||||
} else {
|
||||
temporaryName.value = event
|
||||
}
|
||||
}
|
||||
|
||||
const changeDate = (type, event) => {
|
||||
if (type === 'temporaryStartTime') {
|
||||
temporaryStartTime.value = event
|
||||
} else {
|
||||
temporaryEndTime.value = event
|
||||
}
|
||||
}
|
||||
|
||||
const changeAdmin = (type, event) => {
|
||||
if (type === 'permanent') {
|
||||
permanentAdmin.value = event.detail.value
|
||||
} else {
|
||||
temporaryAdmin.value = event.detail.value
|
||||
}
|
||||
}
|
||||
|
||||
const clickTab = data => {
|
||||
currentIndex.value = data.index
|
||||
}
|
||||
|
||||
const changeSwiper = e => {
|
||||
currentIndex.value = e.detail.current
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: $uni-bg-color-grey;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.tabs {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.text {
|
||||
margin-top: 40rpx;
|
||||
margin-bottom: 50rpx;
|
||||
color: #262626;
|
||||
font-size: 26rpx;
|
||||
padding: 0 32rpx;
|
||||
}
|
||||
|
||||
.button {
|
||||
border-radius: 64rpx;
|
||||
width: 686rpx;
|
||||
margin-left: 32rpx;
|
||||
height: 100rpx;
|
||||
line-height: 100rpx;
|
||||
text-align: center;
|
||||
background-color: #63b8af;
|
||||
color: #fff;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
@ -39,7 +39,7 @@
|
||||
<view class="mt-3 mb-3">
|
||||
<LockSwitch
|
||||
:value="permanentCoerced"
|
||||
title="胁迫卡"
|
||||
title="胁迫指纹"
|
||||
@change="changeCoerced('permanent', $event)"
|
||||
:placeholder="placeholder"
|
||||
></LockSwitch>
|
||||
@ -83,7 +83,7 @@
|
||||
<view class="mt-3 mb-3">
|
||||
<LockSwitch
|
||||
:value="temporaryCoerced"
|
||||
title="胁迫卡"
|
||||
title="胁迫指纹"
|
||||
@change="changeCoerced('temporary', $event)"
|
||||
:placeholder="placeholder"
|
||||
></LockSwitch>
|
||||
|
||||
337
pages/createPalmVein/createPalmVein.vue
Normal file
@ -0,0 +1,337 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="tabs">
|
||||
<up-tabs
|
||||
:list="tabs"
|
||||
lineWidth="40rpx"
|
||||
lineHeight="5rpx"
|
||||
:current="currentIndex"
|
||||
lineColor="#63b8af"
|
||||
@click="clickTab"
|
||||
:inactiveStyle="{ color: '#a3a3a3', fontSize: '32rpx', fontWeight: 'bold' }"
|
||||
:activeStyle="{ color: '#63b8af', fontSize: '32rpx', fontWeight: 'bold' }"
|
||||
>
|
||||
</up-tabs>
|
||||
</view>
|
||||
<swiper
|
||||
:style="{ height: deviceInfo.screenHeight - deviceInfo.safeArea.top - 44 + 'px' }"
|
||||
v-if="deviceInfo"
|
||||
:list="tabs"
|
||||
:autoplay="false"
|
||||
:circular="true"
|
||||
:current="currentIndex"
|
||||
@change="changeSwiper"
|
||||
>
|
||||
<swiper-item>
|
||||
<LockInput
|
||||
:value="permanentName"
|
||||
title="姓名"
|
||||
placeholder="请输入"
|
||||
@change-input="changeName('permanent', $event)"
|
||||
></LockInput>
|
||||
<view class="mt-3">
|
||||
<LockSwitch
|
||||
:value="permanentAdmin"
|
||||
title="是否为管理员"
|
||||
@change="changeAdmin('permanent', $event)"
|
||||
></LockSwitch>
|
||||
</view>
|
||||
<view class="mt-3 mb-3">
|
||||
<LockSwitch
|
||||
:value="permanentCoerced"
|
||||
title="胁迫掌静脉"
|
||||
@change="changeCoerced('permanent', $event)"
|
||||
:placeholder="placeholder"
|
||||
></LockSwitch>
|
||||
</view>
|
||||
<view class="button" @click="create('permanent')">下一步</view>
|
||||
</swiper-item>
|
||||
<swiper-item :style="{ height: deviceInfo.windowHeight - 44 + 'px' }">
|
||||
<LockInput
|
||||
:value="temporaryName"
|
||||
title="姓名"
|
||||
placeholder="请输入"
|
||||
@change-input="changeName('temporary', $event)"
|
||||
></LockInput>
|
||||
<view class="mt-3">
|
||||
<LockDatetimePicker
|
||||
title="生效时间"
|
||||
:value="temporaryStartTime"
|
||||
:minDate="minDate"
|
||||
:maxDate="maxDate"
|
||||
type="datehour"
|
||||
@change-time="changeDate('temporaryStartTime', $event)"
|
||||
></LockDatetimePicker>
|
||||
</view>
|
||||
<view class="mt-3">
|
||||
<LockDatetimePicker
|
||||
title="失效时间"
|
||||
:value="temporaryEndTime"
|
||||
:minDate="minDate"
|
||||
:maxDate="maxDate"
|
||||
type="datehour"
|
||||
@change-time="changeDate('temporaryEndTime', $event)"
|
||||
></LockDatetimePicker>
|
||||
</view>
|
||||
<view class="mt-3">
|
||||
<LockSwitch
|
||||
:value="temporaryAdmin"
|
||||
title="是否为管理员"
|
||||
@change="changeAdmin('temporary', $event)"
|
||||
></LockSwitch>
|
||||
</view>
|
||||
<view class="mt-3 mb-3">
|
||||
<LockSwitch
|
||||
:value="temporaryCoerced"
|
||||
title="胁迫掌静脉"
|
||||
@change="changeCoerced('temporary', $event)"
|
||||
:placeholder="placeholder"
|
||||
></LockSwitch>
|
||||
</view>
|
||||
<view class="button" @click="create('temporary')">下一步</view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { getCurrentInstance, ref } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { useBasicStore } from '@/stores/basic'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { useBluetoothStore } from '@/stores/bluetooth'
|
||||
import { checkPalmVeinNameRequest } from '@/api/palmVein'
|
||||
|
||||
const instance = getCurrentInstance().proxy
|
||||
const eventChannel = instance.getOpenerEventChannel()
|
||||
|
||||
const $basic = useBasicStore()
|
||||
const $bluetooth = useBluetoothStore()
|
||||
const $user = useUserStore()
|
||||
|
||||
const tabs = [
|
||||
{
|
||||
name: '永久'
|
||||
},
|
||||
{
|
||||
name: '限时'
|
||||
}
|
||||
]
|
||||
|
||||
const permanentName = ref('')
|
||||
const permanentAdmin = ref(false)
|
||||
const permanentCoerced = ref(false)
|
||||
|
||||
const temporaryName = ref('')
|
||||
const temporaryStartTime = ref(Number(new Date()))
|
||||
const temporaryEndTime = ref(Number(new Date()))
|
||||
const temporaryAdmin = ref(false)
|
||||
const temporaryCoerced = ref(false)
|
||||
|
||||
const minDate = ref(Number(new Date()))
|
||||
const maxDate = ref(Number(4133951940000))
|
||||
const currentIndex = ref(0)
|
||||
const deviceInfo = ref(null)
|
||||
const placeholder =
|
||||
'当被胁迫要求强行开锁时,使用胁迫掌静脉会触发报警,报警信息会推送给管理员,该功能需要锁联网。\n请不要将胁迫掌静脉用于日常开锁'
|
||||
|
||||
onLoad(async () => {
|
||||
deviceInfo.value = await $basic.getDeviceInfo()
|
||||
temporaryStartTime.value = setTime()
|
||||
temporaryEndTime.value = setTime()
|
||||
minDate.value = Number(getNextFullHour())
|
||||
maxDate.value = Number(getFutureTimestamp())
|
||||
})
|
||||
|
||||
const getNextFullHour = () => {
|
||||
const now = new Date()
|
||||
const currentHour = now.getHours()
|
||||
now.setHours(currentHour)
|
||||
now.setMinutes(0)
|
||||
now.setSeconds(0)
|
||||
now.setMilliseconds(0)
|
||||
|
||||
return now
|
||||
}
|
||||
|
||||
const getFutureTimestamp = () => {
|
||||
const currentDate = new Date()
|
||||
|
||||
const year = currentDate.getFullYear()
|
||||
const month = currentDate.getMonth()
|
||||
const day = currentDate.getDate()
|
||||
|
||||
const futureDate = new Date(year + 3, month, day, 23, 0, 0)
|
||||
|
||||
return futureDate.getTime()
|
||||
}
|
||||
|
||||
const setTime = () => {
|
||||
const now = new Date()
|
||||
now.setMinutes(0, 0, 0)
|
||||
|
||||
return now.getTime()
|
||||
}
|
||||
|
||||
const create = async type => {
|
||||
if (
|
||||
(type === 'temporary' && temporaryName.value === '') ||
|
||||
(type === 'permanent' && permanentName.value === '')
|
||||
) {
|
||||
uni.showToast({
|
||||
title: '名称不能为空',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (type === 'temporary' && temporaryStartTime.value > temporaryEndTime.value) {
|
||||
uni.showToast({
|
||||
title: '失效时间要大于生效时间',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
const netWork = await $basic.getNetworkType()
|
||||
if (!netWork) {
|
||||
return
|
||||
}
|
||||
|
||||
let params = {
|
||||
type: 'palmVein',
|
||||
keyId: $bluetooth.keyId.toString(),
|
||||
uid: $user.userInfo.uid.toString(),
|
||||
no: 0,
|
||||
operate: 0,
|
||||
userCountLimit: 0xffff
|
||||
}
|
||||
|
||||
if (type === 'permanent') {
|
||||
params = {
|
||||
...params,
|
||||
palmVeinName: permanentName.value,
|
||||
isAdmin: permanentAdmin.value ? 1 : 0,
|
||||
isForce: permanentCoerced.value ? 1 : 0,
|
||||
weekDays: [],
|
||||
isRound: 0,
|
||||
startDate: 0,
|
||||
palmVeinType: 1,
|
||||
endDate: 0,
|
||||
startTime: '00:00',
|
||||
endTime: '00:00'
|
||||
}
|
||||
} else {
|
||||
params = {
|
||||
...params,
|
||||
palmVeinName: temporaryName.value,
|
||||
isAdmin: temporaryAdmin.value ? 1 : 0,
|
||||
isForce: temporaryCoerced.value ? 1 : 0,
|
||||
weekDays: [],
|
||||
palmVeinType: 2,
|
||||
isRound: 0,
|
||||
startDate: temporaryStartTime.value,
|
||||
endDate: temporaryEndTime.value,
|
||||
startTime: '00:00',
|
||||
endTime: '00:00'
|
||||
}
|
||||
}
|
||||
|
||||
const { code, message } = await checkPalmVeinNameRequest({
|
||||
lockId: $bluetooth.currentLockInfo.lockId,
|
||||
palmVeinName: params.palmVeinName
|
||||
})
|
||||
if (code === 0) {
|
||||
$basic.routeJump({
|
||||
name: 'bindPalmVein',
|
||||
params: {
|
||||
info: JSON.stringify(params)
|
||||
},
|
||||
events: {
|
||||
refresherList() {
|
||||
eventChannel.emit('refresherList', {})
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: message,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const changeName = (type, event) => {
|
||||
if (type === 'permanent') {
|
||||
permanentName.value = event
|
||||
} else {
|
||||
temporaryName.value = event
|
||||
}
|
||||
}
|
||||
|
||||
const changeDate = (type, event) => {
|
||||
if (type === 'temporaryStartTime') {
|
||||
temporaryStartTime.value = event
|
||||
} else {
|
||||
temporaryEndTime.value = event
|
||||
}
|
||||
}
|
||||
|
||||
const changeAdmin = (type, event) => {
|
||||
if (type === 'permanent') {
|
||||
permanentAdmin.value = event.detail.value
|
||||
} else {
|
||||
temporaryAdmin.value = event.detail.value
|
||||
}
|
||||
}
|
||||
|
||||
const changeCoerced = (type, event) => {
|
||||
if (type === 'permanent') {
|
||||
permanentCoerced.value = event.detail.value
|
||||
} else {
|
||||
temporaryCoerced.value = event.detail.value
|
||||
}
|
||||
}
|
||||
|
||||
const clickTab = data => {
|
||||
currentIndex.value = data.index
|
||||
}
|
||||
|
||||
const changeSwiper = e => {
|
||||
currentIndex.value = e.detail.current
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: $uni-bg-color-grey;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.tabs {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.text {
|
||||
margin-top: 40rpx;
|
||||
margin-bottom: 50rpx;
|
||||
color: #262626;
|
||||
font-size: 26rpx;
|
||||
padding: 0 32rpx;
|
||||
}
|
||||
|
||||
.button {
|
||||
border-radius: 64rpx;
|
||||
width: 686rpx;
|
||||
margin-left: 32rpx;
|
||||
height: 100rpx;
|
||||
line-height: 100rpx;
|
||||
text-align: center;
|
||||
background-color: #63b8af;
|
||||
color: #fff;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
281
pages/createRemote/createRemote.vue
Normal file
@ -0,0 +1,281 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="tabs">
|
||||
<up-tabs
|
||||
:list="tabs"
|
||||
lineWidth="40rpx"
|
||||
lineHeight="5rpx"
|
||||
:current="currentIndex"
|
||||
lineColor="#63b8af"
|
||||
@click="clickTab"
|
||||
:inactiveStyle="{ color: '#a3a3a3', fontSize: '32rpx', fontWeight: 'bold' }"
|
||||
:activeStyle="{ color: '#63b8af', fontSize: '32rpx', fontWeight: 'bold' }"
|
||||
>
|
||||
</up-tabs>
|
||||
</view>
|
||||
<swiper
|
||||
:style="{ height: deviceInfo.screenHeight - deviceInfo.safeArea.top - 44 + 'px' }"
|
||||
v-if="deviceInfo"
|
||||
:list="tabs"
|
||||
:autoplay="false"
|
||||
:circular="true"
|
||||
:current="currentIndex"
|
||||
@change="changeSwiper"
|
||||
>
|
||||
<swiper-item>
|
||||
<LockInput
|
||||
:value="permanentName"
|
||||
title="姓名"
|
||||
placeholder="请输入"
|
||||
@change-input="changeName('permanent', $event)"
|
||||
></LockInput>
|
||||
<view class="button mt-5" @click="create('permanent')">下一步</view>
|
||||
</swiper-item>
|
||||
<swiper-item :style="{ height: deviceInfo.windowHeight - 44 + 'px' }">
|
||||
<LockInput
|
||||
:value="temporaryName"
|
||||
title="姓名"
|
||||
placeholder="请输入"
|
||||
@change-input="changeName('temporary', $event)"
|
||||
></LockInput>
|
||||
<view class="mt-3">
|
||||
<LockDatetimePicker
|
||||
title="生效时间"
|
||||
:value="temporaryStartTime"
|
||||
:minDate="minDate"
|
||||
:maxDate="maxDate"
|
||||
type="datehour"
|
||||
@change-time="changeDate('temporaryStartTime', $event)"
|
||||
></LockDatetimePicker>
|
||||
</view>
|
||||
<view class="mt-3">
|
||||
<LockDatetimePicker
|
||||
title="失效时间"
|
||||
:value="temporaryEndTime"
|
||||
:minDate="minDate"
|
||||
:maxDate="maxDate"
|
||||
type="datehour"
|
||||
@change-time="changeDate('temporaryEndTime', $event)"
|
||||
></LockDatetimePicker>
|
||||
</view>
|
||||
<view class="button mt-5" @click="create('temporary')">下一步</view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { getCurrentInstance, ref } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { useBasicStore } from '@/stores/basic'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { useBluetoothStore } from '@/stores/bluetooth'
|
||||
import { checkRemoteNameRequest } from '@/api/remote'
|
||||
|
||||
const instance = getCurrentInstance().proxy
|
||||
const eventChannel = instance.getOpenerEventChannel()
|
||||
|
||||
const $basic = useBasicStore()
|
||||
const $bluetooth = useBluetoothStore()
|
||||
const $user = useUserStore()
|
||||
|
||||
const tabs = [
|
||||
{
|
||||
name: '永久'
|
||||
},
|
||||
{
|
||||
name: '限时'
|
||||
}
|
||||
]
|
||||
|
||||
const permanentName = ref('')
|
||||
|
||||
const temporaryName = ref('')
|
||||
const temporaryStartTime = ref(Number(new Date()))
|
||||
const temporaryEndTime = ref(Number(new Date()))
|
||||
|
||||
const minDate = ref(Number(new Date()))
|
||||
const maxDate = ref(Number(4133951940000))
|
||||
const currentIndex = ref(0)
|
||||
const deviceInfo = ref(null)
|
||||
|
||||
onLoad(async () => {
|
||||
deviceInfo.value = await $basic.getDeviceInfo()
|
||||
temporaryStartTime.value = setTime()
|
||||
temporaryEndTime.value = setTime()
|
||||
minDate.value = Number(getNextFullHour())
|
||||
maxDate.value = Number(getFutureTimestamp())
|
||||
})
|
||||
|
||||
const getNextFullHour = () => {
|
||||
const now = new Date()
|
||||
const currentHour = now.getHours()
|
||||
now.setHours(currentHour)
|
||||
now.setMinutes(0)
|
||||
now.setSeconds(0)
|
||||
now.setMilliseconds(0)
|
||||
|
||||
return now
|
||||
}
|
||||
|
||||
const getFutureTimestamp = () => {
|
||||
const currentDate = new Date()
|
||||
|
||||
const year = currentDate.getFullYear()
|
||||
const month = currentDate.getMonth()
|
||||
const day = currentDate.getDate()
|
||||
|
||||
const futureDate = new Date(year + 3, month, day, 23, 0, 0)
|
||||
|
||||
return futureDate.getTime()
|
||||
}
|
||||
|
||||
const setTime = () => {
|
||||
const now = new Date()
|
||||
now.setMinutes(0, 0, 0)
|
||||
|
||||
return now.getTime()
|
||||
}
|
||||
|
||||
const create = async type => {
|
||||
if (
|
||||
(type === 'temporary' && temporaryName.value === '') ||
|
||||
(type === 'permanent' && permanentName.value === '')
|
||||
) {
|
||||
uni.showToast({
|
||||
title: '名称不能为空',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (type === 'temporary' && temporaryStartTime.value > temporaryEndTime.value) {
|
||||
uni.showToast({
|
||||
title: '失效时间要大于生效时间',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
const netWork = await $basic.getNetworkType()
|
||||
if (!netWork) {
|
||||
return
|
||||
}
|
||||
|
||||
let params = {
|
||||
type: 'remote',
|
||||
keyId: $bluetooth.keyId.toString(),
|
||||
uid: $user.userInfo.uid.toString(),
|
||||
no: 0,
|
||||
operate: 0,
|
||||
userCountLimit: 0xffff
|
||||
}
|
||||
|
||||
if (type === 'permanent') {
|
||||
params = {
|
||||
...params,
|
||||
remoteName: permanentName.value,
|
||||
weekDays: [],
|
||||
isRound: 0,
|
||||
startDate: 0,
|
||||
remoteType: 1,
|
||||
endDate: 0,
|
||||
startTime: '00:00',
|
||||
endTime: '00:00'
|
||||
}
|
||||
} else {
|
||||
params = {
|
||||
...params,
|
||||
remoteName: temporaryName.value,
|
||||
weekDays: [],
|
||||
remoteType: 2,
|
||||
isRound: 0,
|
||||
startDate: temporaryStartTime.value,
|
||||
endDate: temporaryEndTime.value,
|
||||
startTime: '00:00',
|
||||
endTime: '00:00'
|
||||
}
|
||||
}
|
||||
|
||||
const { code, message } = await checkRemoteNameRequest({
|
||||
lockId: $bluetooth.currentLockInfo.lockId,
|
||||
remoteName: params.remoteName
|
||||
})
|
||||
if (code === 0) {
|
||||
$basic.routeJump({
|
||||
name: 'bindRemote',
|
||||
params: {
|
||||
info: JSON.stringify(params)
|
||||
},
|
||||
events: {
|
||||
refresherList() {
|
||||
eventChannel.emit('refresherList', {})
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: message,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const changeName = (type, event) => {
|
||||
if (type === 'permanent') {
|
||||
permanentName.value = event
|
||||
} else {
|
||||
temporaryName.value = event
|
||||
}
|
||||
}
|
||||
|
||||
const changeDate = (type, event) => {
|
||||
if (type === 'temporaryStartTime') {
|
||||
temporaryStartTime.value = event
|
||||
} else {
|
||||
temporaryEndTime.value = event
|
||||
}
|
||||
}
|
||||
|
||||
const clickTab = data => {
|
||||
currentIndex.value = data.index
|
||||
}
|
||||
|
||||
const changeSwiper = e => {
|
||||
currentIndex.value = e.detail.current
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: $uni-bg-color-grey;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.tabs {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.text {
|
||||
margin-top: 40rpx;
|
||||
margin-bottom: 50rpx;
|
||||
color: #262626;
|
||||
font-size: 26rpx;
|
||||
padding: 0 32rpx;
|
||||
}
|
||||
|
||||
.button {
|
||||
border-radius: 64rpx;
|
||||
width: 686rpx;
|
||||
margin-left: 32rpx;
|
||||
height: 100rpx;
|
||||
line-height: 100rpx;
|
||||
text-align: center;
|
||||
background-color: #63b8af;
|
||||
color: #fff;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
111
pages/faceDetail/faceDetail.vue
Normal file
@ -0,0 +1,111 @@
|
||||
<template>
|
||||
<view>
|
||||
<view v-if="info">
|
||||
<view class="item">
|
||||
<view class="item-title">人脸号</view>
|
||||
<view class="item-content">{{ info.faceNumber }}</view>
|
||||
</view>
|
||||
<view class="item" style="margin-top: 2rpx">
|
||||
<view class="item-title">姓名</view>
|
||||
<view class="item-content">{{ info.faceName }}</view>
|
||||
</view>
|
||||
<view class="item" style="margin-top: 2rpx">
|
||||
<view class="item-title">有效期</view>
|
||||
<view v-if="info.faceType === 1">永久</view>
|
||||
<view v-else-if="info.faceType === 2">
|
||||
<view class="item-content">{{ timeFormat(info.startDate, 'yyyy-mm-dd h:M') }}</view>
|
||||
<view class="item-content">{{ timeFormat(info.endDate, 'yyyy-mm-dd h:M') }}</view>
|
||||
</view>
|
||||
<view v-else>
|
||||
<view class="item-content">{{ timeFormat(info.startDate, 'yyyy-mm-dd') }}</view>
|
||||
<view class="item-content">{{ timeFormat(info.endDate, 'yyyy-mm-dd') }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="item" style="margin-top: 2rpx" v-if="info.faceType === 4">
|
||||
<view class="item-title">有效日</view>
|
||||
<view class="item-content">{{ $lock.convertWeekDaysToChineseString(info.weekDay) }}</view>
|
||||
</view>
|
||||
<view class="item" style="margin-top: 2rpx" v-if="info.faceType === 4">
|
||||
<view class="item-title">有效时间</view>
|
||||
<view class="item-content">
|
||||
{{ timeFormat(info.startDate, 'h:M') }} - {{ timeFormat(info.endDate, 'h:M') }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="item" style="margin-top: 20rpx">
|
||||
<view class="item-title">添加者</view>
|
||||
<view class="item-content">{{ info.senderUsername }}</view>
|
||||
</view>
|
||||
<view class="item" style="margin-top: 2rpx">
|
||||
<view class="item-title">添加时间</view>
|
||||
<view class="item-content">{{ timeFormat(info.createDate, 'yyyy-mm-dd h:M') }}</view>
|
||||
</view>
|
||||
|
||||
<view class="button" @click="deletePassword">删除</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { getCurrentInstance, ref } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { timeFormat } from 'uview-plus'
|
||||
import { useLockStore } from '@/stores/lock'
|
||||
|
||||
const instance = getCurrentInstance().proxy
|
||||
const eventChannel = instance.getOpenerEventChannel()
|
||||
|
||||
const $lock = useLockStore()
|
||||
|
||||
const info = ref(null)
|
||||
|
||||
onLoad(options => {
|
||||
if (options.info) {
|
||||
info.value = JSON.parse(options.info)
|
||||
console.log(info.value)
|
||||
}
|
||||
})
|
||||
|
||||
const deletePassword = async () => {
|
||||
eventChannel.emit('delete', {})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: $uni-bg-color-grey;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.item-title {
|
||||
width: 350rpx;
|
||||
}
|
||||
|
||||
.item {
|
||||
padding: 24rpx 32rpx;
|
||||
background-color: #ffffff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.tips {
|
||||
padding: 24rpx 32rpx;
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.button {
|
||||
margin: 32rpx;
|
||||
width: 686rpx;
|
||||
height: 88rpx;
|
||||
background-color: #df282d;
|
||||
color: white;
|
||||
text-align: center;
|
||||
line-height: 88rpx;
|
||||
border-radius: 44rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
464
pages/faceList/faceList.vue
Normal file
@ -0,0 +1,464 @@
|
||||
<template>
|
||||
<view>
|
||||
<scroll-view
|
||||
v-if="deviceInfo"
|
||||
scroll-y="true"
|
||||
:style="{ height: deviceInfo.screenHeight - deviceInfo.safeArea.top + 'px' }"
|
||||
lower-threshold="100"
|
||||
@refresherrefresh="refresherList"
|
||||
:refresher-enabled="true"
|
||||
@scrolltolower="nextPage"
|
||||
:refresher-triggered="refresherTriggered"
|
||||
>
|
||||
<view class="search">
|
||||
<up-search
|
||||
shape="square"
|
||||
:searchIconSize="48"
|
||||
:inputStyle="{ fontSize: '32rpx' }"
|
||||
:height="80"
|
||||
placeholder="搜索"
|
||||
:clearabled="false"
|
||||
@change="changeSearch"
|
||||
v-model="searchStr"
|
||||
bgColor="#ffffff"
|
||||
:showAction="false"
|
||||
maxlength="50"
|
||||
></up-search>
|
||||
</view>
|
||||
<view style="padding: 0 0 calc(env(safe-area-inset-bottom) + 250rpx) 0">
|
||||
<view v-if="list.length === 0 && requestFinished">
|
||||
<image
|
||||
class="empty-list"
|
||||
src="/static/images/background_empty_list.png"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
<view class="empty-list-text">暂无数据</view>
|
||||
</view>
|
||||
<view v-else>
|
||||
<up-swipe-action>
|
||||
<up-swipe-action-item
|
||||
ref="swipeItem"
|
||||
:options="options"
|
||||
v-for="item in list"
|
||||
:key="item.keyboardPwdId"
|
||||
:threshold="50"
|
||||
@click="deleteItem(item)"
|
||||
>
|
||||
<view class="item" @click="toDetail(item)">
|
||||
<image
|
||||
class="item-left"
|
||||
src="/static/images/icon_face_white.png"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
<view class="item-right">
|
||||
<view style="display: flex; align-items: center">
|
||||
<view class="item-right-top">{{ item.faceName }}</view>
|
||||
<view class="status">
|
||||
{{ item.statusText }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="item-right-bottom">{{ item.timeText }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="line"></view>
|
||||
</up-swipe-action-item>
|
||||
</up-swipe-action>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="button">
|
||||
<view class="button-reset" @click="reset">重置人脸</view>
|
||||
<view class="button-create" @click="toCreate">添加人脸</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { timeFormat } from 'uview-plus'
|
||||
import { useBasicStore } from '@/stores/basic'
|
||||
import { useBluetoothStore } from '@/stores/bluetooth'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { clearFaceRequest, deleteFaceRequest, getFaceList } from '@/api/face'
|
||||
|
||||
const $basic = useBasicStore()
|
||||
const $bluetooth = useBluetoothStore()
|
||||
const $user = useUserStore()
|
||||
|
||||
const swipeItem = ref(null)
|
||||
|
||||
const searchStr = ref('')
|
||||
const list = ref([])
|
||||
const pageNo = ref(1)
|
||||
const pageSize = 50
|
||||
const total = ref(0)
|
||||
const lockId = ref(null)
|
||||
|
||||
const deviceInfo = ref(null)
|
||||
const requestFinished = ref(false)
|
||||
const refresherTriggered = ref(false)
|
||||
const options = ref([
|
||||
{
|
||||
text: '删除',
|
||||
style: {
|
||||
backgroundColor: '#f56c6c'
|
||||
}
|
||||
}
|
||||
])
|
||||
|
||||
onMounted(async () => {
|
||||
uni.showLoading({
|
||||
title: '加载中',
|
||||
mask: true
|
||||
})
|
||||
deviceInfo.value = await $basic.getDeviceInfo()
|
||||
lockId.value = $bluetooth.currentLockInfo.lockId
|
||||
const { code, message } = await getList({
|
||||
pageNo: pageNo.value
|
||||
})
|
||||
requestFinished.value = true
|
||||
uni.hideLoading()
|
||||
if (code !== 0) {
|
||||
uni.showToast({
|
||||
title: message,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
const reset = async () => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '重置后,该锁的人脸都将被删除哦,确认要重置吗?',
|
||||
async success(res) {
|
||||
if (res.confirm) {
|
||||
const netWork = await $basic.getNetworkType()
|
||||
if (!netWork) {
|
||||
return
|
||||
}
|
||||
await deleteData({
|
||||
operate: 3
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const deleteData = async info => {
|
||||
uni.showLoading({
|
||||
title: `${info.operate === 2 ? '删除' : '重置'}中`
|
||||
})
|
||||
|
||||
const { code } = await $bluetooth.registerAuthentication({
|
||||
type: 'face',
|
||||
keyId: $bluetooth.keyId.toString(),
|
||||
uid: $user.userInfo.uid.toString(),
|
||||
no: Number(info.faceNumber) || 0,
|
||||
operate: info.operate,
|
||||
isAdmin: 0,
|
||||
isForce: 0,
|
||||
userCountLimit: 0,
|
||||
weekDays: [],
|
||||
isRound: 0,
|
||||
startDate: 0,
|
||||
endDate: 0,
|
||||
startTime: '00:00',
|
||||
endTime: '00:00'
|
||||
})
|
||||
|
||||
$bluetooth.closeBluetoothConnection()
|
||||
if (code === 0) {
|
||||
let params = {
|
||||
lockId: $bluetooth.currentLockInfo.lockId,
|
||||
deleteType: 1,
|
||||
type: 1
|
||||
}
|
||||
if (info.operate === 2) {
|
||||
params = {
|
||||
...params,
|
||||
faceId: info.faceId,
|
||||
type: 0
|
||||
}
|
||||
}
|
||||
const { code: requestCode, message } =
|
||||
info.operate === 3 ? await clearFaceRequest(params) : await deleteFaceRequest(params)
|
||||
if (requestCode === 0) {
|
||||
if (info.back) {
|
||||
$basic.backAndToast(`删除成功`)
|
||||
}
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: `${info.operate === 2 ? '删除' : '重置'}成功`,
|
||||
icon: 'none'
|
||||
})
|
||||
pageNo.value = 1
|
||||
await getList({
|
||||
pageNo: pageNo.value
|
||||
})
|
||||
} else {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: message,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
} else if (code === -1) {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: `${info.operate === 2 ? '删除' : '重置'}失败,请保持在锁附近`,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const deleteItem = async data => {
|
||||
const index = list.value.findIndex(item => item.keyboardPwdId === data.keyboardPwdId)
|
||||
swipeItem.value[index].closeHandler()
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定要删除吗?',
|
||||
async success(res) {
|
||||
if (res.confirm) {
|
||||
const netWork = await $basic.getNetworkType()
|
||||
if (!netWork) {
|
||||
return
|
||||
}
|
||||
await deleteData({
|
||||
...data,
|
||||
operate: 2
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const refresherList = async () => {
|
||||
refresherTriggered.value = true
|
||||
pageNo.value = 1
|
||||
const { code, message } = await getList({
|
||||
pageNo: pageNo.value,
|
||||
searchStr: searchStr.value
|
||||
})
|
||||
if (code === 0) {
|
||||
uni.showToast({
|
||||
title: '刷新成功',
|
||||
icon: 'none'
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: message,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
refresherTriggered.value = false
|
||||
}
|
||||
|
||||
const nextPage = async () => {
|
||||
if (total.value <= pageNo.value * pageSize) {
|
||||
return
|
||||
}
|
||||
const page = pageNo.value + 1
|
||||
const params = {
|
||||
searchStr: searchStr.value,
|
||||
pageNo: page
|
||||
}
|
||||
const { code, message } = await getList(params)
|
||||
if (code === 0) {
|
||||
pageNo.value = page
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: message,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const getList = async params => {
|
||||
const {
|
||||
data: { timestamp }
|
||||
} = await $bluetooth.updateServerTimestamp()
|
||||
const { code, data, message } = await getFaceList({
|
||||
...params,
|
||||
lockId: lockId.value,
|
||||
pageSize
|
||||
})
|
||||
if (code === 0) {
|
||||
total.value = data.total
|
||||
for (let i = 0; i < data.list.length; i++) {
|
||||
if (data.list[i].faceStatus === 1 && data.list[i].startDate > timestamp) {
|
||||
data.list[i].statusText = '未生效'
|
||||
} else if (data.list[i].faceStatus === 2) {
|
||||
data.list[i].statusText = '已失效'
|
||||
}
|
||||
|
||||
if (data.list[i].faceType === 1) {
|
||||
data.list[i].timeText = timeFormat(data.list[i].startDate, 'yyyy-mm-dd hh:MM') + ' 永久'
|
||||
} else if (data.list[i].faceType === 2) {
|
||||
data.list[i].timeText =
|
||||
timeFormat(data.list[i].startDate, 'yyyy-mm-dd hh:MM') +
|
||||
' - ' +
|
||||
timeFormat(data.list[i].endDate, 'yyyy-mm-dd hh:MM') +
|
||||
' 限时'
|
||||
} else {
|
||||
data.list[i].timeText =
|
||||
timeFormat(data.list[i].startDate, 'yyyy-mm-dd') +
|
||||
' - ' +
|
||||
timeFormat(data.list[i].endDate, 'yyyy-mm-dd') +
|
||||
' 循环'
|
||||
}
|
||||
}
|
||||
if (params.pageNo === 1) {
|
||||
list.value = data.list
|
||||
} else {
|
||||
list.value = list.value.concat(data.list)
|
||||
}
|
||||
return { code }
|
||||
}
|
||||
return { code, message }
|
||||
}
|
||||
|
||||
const changeSearch = async data => {
|
||||
pageNo.value = 1
|
||||
const { code, message } = await getList({
|
||||
searchStr: data,
|
||||
pageNo: pageNo.value
|
||||
})
|
||||
if (code !== 0) {
|
||||
uni.showToast({
|
||||
title: message,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const toCreate = () => {
|
||||
$basic.routeJump({
|
||||
name: 'createFace',
|
||||
events: {
|
||||
refresherList() {
|
||||
pageNo.value = 1
|
||||
getList({
|
||||
pageNo: pageNo.value
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const toDetail = item => {
|
||||
$basic.routeJump({
|
||||
name: 'faceDetail',
|
||||
params: {
|
||||
info: JSON.stringify(item)
|
||||
},
|
||||
events: {
|
||||
delete() {
|
||||
deleteItem({ ...item, back: true })
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: $uni-bg-color-grey;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.search {
|
||||
padding: 32rpx;
|
||||
width: 686rpx !important;
|
||||
}
|
||||
|
||||
.button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: fixed;
|
||||
bottom: calc(env(safe-area-inset-bottom) + 20rpx);
|
||||
font-weight: bold;
|
||||
|
||||
.button-reset {
|
||||
margin-left: 50rpx;
|
||||
width: 300rpx;
|
||||
height: 88rpx;
|
||||
background-color: #df282d;
|
||||
color: white;
|
||||
text-align: center;
|
||||
line-height: 88rpx;
|
||||
border-radius: 44rpx;
|
||||
}
|
||||
|
||||
.button-create {
|
||||
margin-left: 50rpx;
|
||||
width: 300rpx;
|
||||
height: 88rpx;
|
||||
background-color: #63b8af;
|
||||
color: white;
|
||||
text-align: center;
|
||||
line-height: 88rpx;
|
||||
border-radius: 44rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background-color: #ffffff;
|
||||
height: 120rpx;
|
||||
width: 750rpx;
|
||||
|
||||
.item-left {
|
||||
margin-left: 32rpx;
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
}
|
||||
|
||||
.item-right {
|
||||
margin-right: 32rpx;
|
||||
margin-left: 32rpx;
|
||||
width: 574rpx;
|
||||
|
||||
.item-right-top {
|
||||
max-width: 400rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
padding-bottom: 6rpx;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.item-right-bottom {
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.line {
|
||||
width: 100%;
|
||||
height: 2rpx;
|
||||
background: #ebebeb;
|
||||
}
|
||||
|
||||
.empty-list {
|
||||
width: 150rpx;
|
||||
height: 150rpx;
|
||||
margin: 300rpx auto 20rpx 50%;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
|
||||
.empty-list-text {
|
||||
text-align: center;
|
||||
font-size: 32rpx;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.status {
|
||||
margin-left: auto;
|
||||
font-size: 26rpx;
|
||||
color: #df282d;
|
||||
}
|
||||
</style>
|
||||
@ -84,6 +84,35 @@
|
||||
<image class="menu-main-image" src="/static/images/icon_fingerprint.png"></image>
|
||||
<view>指纹</view>
|
||||
</view>
|
||||
<view
|
||||
v-if="
|
||||
currentLockInfo.lockFeature.bluetoothRemoteControl || currentLockInfo.keyRight === 1
|
||||
"
|
||||
class="menu-main-view"
|
||||
@click="routeJump({ name: 'remoteList' })"
|
||||
>
|
||||
<image class="menu-main-image" src="/static/images/icon_remote.png"></image>
|
||||
<view>遥控</view>
|
||||
</view>
|
||||
<view
|
||||
v-if="currentLockInfo.lockFeature.d3Face || currentLockInfo.keyRight === 1"
|
||||
class="menu-main-view"
|
||||
@click="routeJump({ name: 'faceList' })"
|
||||
>
|
||||
<image
|
||||
class="menu-main-image transform-scale-125"
|
||||
src="/static/images/icon_face.png"
|
||||
></image>
|
||||
<view>人脸</view>
|
||||
</view>
|
||||
<view
|
||||
v-if="currentLockInfo.lockFeature.palmVein || currentLockInfo.keyRight === 1"
|
||||
class="menu-main-view"
|
||||
@click="routeJump({ name: 'palmVeinList' })"
|
||||
>
|
||||
<image class="menu-main-image" src="/static/images/icon_palm_vein.png"></image>
|
||||
<view>掌静脉</view>
|
||||
</view>
|
||||
<view class="menu-main-view" @click="routeJump({ name: 'keyList' })">
|
||||
<image class="menu-main-image" src="/static/images/icon_admin_black.png"></image>
|
||||
<view>授权管理员</view>
|
||||
|
||||
111
pages/palmVeinDetail/palmVeinDetail.vue
Normal file
@ -0,0 +1,111 @@
|
||||
<template>
|
||||
<view>
|
||||
<view v-if="info">
|
||||
<view class="item">
|
||||
<view class="item-title">掌静脉号</view>
|
||||
<view class="item-content">{{ info.palmVeinNumber }}</view>
|
||||
</view>
|
||||
<view class="item" style="margin-top: 2rpx">
|
||||
<view class="item-title">姓名</view>
|
||||
<view class="item-content">{{ info.palmVeinName }}</view>
|
||||
</view>
|
||||
<view class="item" style="margin-top: 2rpx">
|
||||
<view class="item-title">有效期</view>
|
||||
<view v-if="info.palmVeinType === 1">永久</view>
|
||||
<view v-else-if="info.palmVeinType === 2">
|
||||
<view class="item-content">{{ timeFormat(info.startDate, 'yyyy-mm-dd h:M') }}</view>
|
||||
<view class="item-content">{{ timeFormat(info.endDate, 'yyyy-mm-dd h:M') }}</view>
|
||||
</view>
|
||||
<view v-else>
|
||||
<view class="item-content">{{ timeFormat(info.startDate, 'yyyy-mm-dd') }}</view>
|
||||
<view class="item-content">{{ timeFormat(info.endDate, 'yyyy-mm-dd') }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="item" style="margin-top: 2rpx" v-if="info.palmVeinType === 4">
|
||||
<view class="item-title">有效日</view>
|
||||
<view class="item-content">{{ $lock.convertWeekDaysToChineseString(info.weekDay) }}</view>
|
||||
</view>
|
||||
<view class="item" style="margin-top: 2rpx" v-if="info.palmVeinType === 4">
|
||||
<view class="item-title">有效时间</view>
|
||||
<view class="item-content">
|
||||
{{ timeFormat(info.startDate, 'h:M') }} - {{ timeFormat(info.endDate, 'h:M') }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="item" style="margin-top: 20rpx">
|
||||
<view class="item-title">添加者</view>
|
||||
<view class="item-content">{{ info.senderUsername }}</view>
|
||||
</view>
|
||||
<view class="item" style="margin-top: 2rpx">
|
||||
<view class="item-title">添加时间</view>
|
||||
<view class="item-content">{{ timeFormat(info.createDate, 'yyyy-mm-dd h:M') }}</view>
|
||||
</view>
|
||||
|
||||
<view class="button" @click="deletePassword">删除</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { getCurrentInstance, ref } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { timeFormat } from 'uview-plus'
|
||||
import { useLockStore } from '@/stores/lock'
|
||||
|
||||
const instance = getCurrentInstance().proxy
|
||||
const eventChannel = instance.getOpenerEventChannel()
|
||||
|
||||
const $lock = useLockStore()
|
||||
|
||||
const info = ref(null)
|
||||
|
||||
onLoad(options => {
|
||||
if (options.info) {
|
||||
info.value = JSON.parse(options.info)
|
||||
console.log(info.value)
|
||||
}
|
||||
})
|
||||
|
||||
const deletePassword = async () => {
|
||||
eventChannel.emit('delete', {})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: $uni-bg-color-grey;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.item-title {
|
||||
width: 350rpx;
|
||||
}
|
||||
|
||||
.item {
|
||||
padding: 24rpx 32rpx;
|
||||
background-color: #ffffff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.tips {
|
||||
padding: 24rpx 32rpx;
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.button {
|
||||
margin: 32rpx;
|
||||
width: 686rpx;
|
||||
height: 88rpx;
|
||||
background-color: #df282d;
|
||||
color: white;
|
||||
text-align: center;
|
||||
line-height: 88rpx;
|
||||
border-radius: 44rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
468
pages/palmVeinList/palmVeinList.vue
Normal file
@ -0,0 +1,468 @@
|
||||
<template>
|
||||
<view>
|
||||
<scroll-view
|
||||
v-if="deviceInfo"
|
||||
scroll-y="true"
|
||||
:style="{ height: deviceInfo.screenHeight - deviceInfo.safeArea.top + 'px' }"
|
||||
lower-threshold="100"
|
||||
@refresherrefresh="refresherList"
|
||||
:refresher-enabled="true"
|
||||
@scrolltolower="nextPage"
|
||||
:refresher-triggered="refresherTriggered"
|
||||
>
|
||||
<view class="search">
|
||||
<up-search
|
||||
shape="square"
|
||||
:searchIconSize="48"
|
||||
:inputStyle="{ fontSize: '32rpx' }"
|
||||
:height="80"
|
||||
placeholder="搜索"
|
||||
:clearabled="false"
|
||||
@change="changeSearch"
|
||||
v-model="searchStr"
|
||||
bgColor="#ffffff"
|
||||
:showAction="false"
|
||||
maxlength="50"
|
||||
></up-search>
|
||||
</view>
|
||||
<view style="padding: 0 0 calc(env(safe-area-inset-bottom) + 250rpx) 0">
|
||||
<view v-if="list.length === 0 && requestFinished">
|
||||
<image
|
||||
class="empty-list"
|
||||
src="/static/images/background_empty_list.png"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
<view class="empty-list-text">暂无数据</view>
|
||||
</view>
|
||||
<view v-else>
|
||||
<up-swipe-action>
|
||||
<up-swipe-action-item
|
||||
ref="swipeItem"
|
||||
:options="options"
|
||||
v-for="item in list"
|
||||
:key="item.keyboardPwdId"
|
||||
:threshold="50"
|
||||
@click="deleteItem(item)"
|
||||
>
|
||||
<view class="item" @click="toDetail(item)">
|
||||
<view class="item-left rounded-50% bg-#2863f6 flex items-center justify-center">
|
||||
<image
|
||||
class="w-50 h-50"
|
||||
src="/static/images/icon_palm_vein_white.png"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
</view>
|
||||
<view class="item-right">
|
||||
<view style="display: flex; align-items: center">
|
||||
<view class="item-right-top">{{ item.palmVeinName }}</view>
|
||||
<view class="status">
|
||||
{{ item.statusText }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="item-right-bottom">{{ item.timeText }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="line"></view>
|
||||
</up-swipe-action-item>
|
||||
</up-swipe-action>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="button">
|
||||
<view class="button-reset" @click="reset">重置掌静脉</view>
|
||||
<view class="button-create" @click="toCreate">添加掌静脉</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { timeFormat } from 'uview-plus'
|
||||
import { useBasicStore } from '@/stores/basic'
|
||||
import { useBluetoothStore } from '@/stores/bluetooth'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { clearPalmVeinRequest, deletePalmVeinRequest, getPalmVeinList } from '@/api/palmVein'
|
||||
|
||||
const $basic = useBasicStore()
|
||||
const $bluetooth = useBluetoothStore()
|
||||
const $user = useUserStore()
|
||||
|
||||
const swipeItem = ref(null)
|
||||
|
||||
const searchStr = ref('')
|
||||
const list = ref([])
|
||||
const pageNo = ref(1)
|
||||
const pageSize = 50
|
||||
const total = ref(0)
|
||||
const lockId = ref(null)
|
||||
|
||||
const deviceInfo = ref(null)
|
||||
const requestFinished = ref(false)
|
||||
const refresherTriggered = ref(false)
|
||||
const options = ref([
|
||||
{
|
||||
text: '删除',
|
||||
style: {
|
||||
backgroundColor: '#f56c6c'
|
||||
}
|
||||
}
|
||||
])
|
||||
|
||||
onMounted(async () => {
|
||||
uni.showLoading({
|
||||
title: '加载中',
|
||||
mask: true
|
||||
})
|
||||
deviceInfo.value = await $basic.getDeviceInfo()
|
||||
lockId.value = $bluetooth.currentLockInfo.lockId
|
||||
const { code, message } = await getList({
|
||||
pageNo: pageNo.value
|
||||
})
|
||||
requestFinished.value = true
|
||||
uni.hideLoading()
|
||||
if (code !== 0) {
|
||||
uni.showToast({
|
||||
title: message,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
const reset = async () => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '重置后,该锁的掌静脉都将被删除哦,确认要重置吗?',
|
||||
async success(res) {
|
||||
if (res.confirm) {
|
||||
const netWork = await $basic.getNetworkType()
|
||||
if (!netWork) {
|
||||
return
|
||||
}
|
||||
await deleteData({
|
||||
operate: 3
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const deleteData = async info => {
|
||||
uni.showLoading({
|
||||
title: `${info.operate === 2 ? '删除' : '重置'}中`
|
||||
})
|
||||
|
||||
const { code } = await $bluetooth.registerAuthentication({
|
||||
type: 'palmVein',
|
||||
keyId: $bluetooth.keyId.toString(),
|
||||
uid: $user.userInfo.uid.toString(),
|
||||
no: Number(info.palmVeinNumber) || 0,
|
||||
operate: info.operate,
|
||||
isAdmin: 0,
|
||||
isForce: 0,
|
||||
userCountLimit: 0,
|
||||
weekDays: [],
|
||||
isRound: 0,
|
||||
startDate: 0,
|
||||
endDate: 0,
|
||||
startTime: '00:00',
|
||||
endTime: '00:00'
|
||||
})
|
||||
|
||||
$bluetooth.closeBluetoothConnection()
|
||||
if (code === 0) {
|
||||
let params = {
|
||||
lockId: $bluetooth.currentLockInfo.lockId,
|
||||
deleteType: 1,
|
||||
type: 1
|
||||
}
|
||||
if (info.operate === 2) {
|
||||
params = {
|
||||
...params,
|
||||
palmVeinId: info.palmVeinId,
|
||||
type: 0
|
||||
}
|
||||
}
|
||||
const { code: requestCode, message } =
|
||||
info.operate === 3
|
||||
? await clearPalmVeinRequest(params)
|
||||
: await deletePalmVeinRequest(params)
|
||||
if (requestCode === 0) {
|
||||
if (info.back) {
|
||||
$basic.backAndToast(`删除成功`)
|
||||
}
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: `${info.operate === 2 ? '删除' : '重置'}成功`,
|
||||
icon: 'none'
|
||||
})
|
||||
pageNo.value = 1
|
||||
await getList({
|
||||
pageNo: pageNo.value
|
||||
})
|
||||
} else {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: message,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
} else if (code === -1) {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: `${info.operate === 2 ? '删除' : '重置'}失败,请保持在锁附近`,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const deleteItem = async data => {
|
||||
const index = list.value.findIndex(item => item.keyboardPwdId === data.keyboardPwdId)
|
||||
swipeItem.value[index].closeHandler()
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定要删除吗?',
|
||||
async success(res) {
|
||||
if (res.confirm) {
|
||||
const netWork = await $basic.getNetworkType()
|
||||
if (!netWork) {
|
||||
return
|
||||
}
|
||||
await deleteData({
|
||||
...data,
|
||||
operate: 2
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const refresherList = async () => {
|
||||
refresherTriggered.value = true
|
||||
pageNo.value = 1
|
||||
const { code, message } = await getList({
|
||||
pageNo: pageNo.value,
|
||||
searchStr: searchStr.value
|
||||
})
|
||||
if (code === 0) {
|
||||
uni.showToast({
|
||||
title: '刷新成功',
|
||||
icon: 'none'
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: message,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
refresherTriggered.value = false
|
||||
}
|
||||
|
||||
const nextPage = async () => {
|
||||
if (total.value <= pageNo.value * pageSize) {
|
||||
return
|
||||
}
|
||||
const page = pageNo.value + 1
|
||||
const params = {
|
||||
searchStr: searchStr.value,
|
||||
pageNo: page
|
||||
}
|
||||
const { code, message } = await getList(params)
|
||||
if (code === 0) {
|
||||
pageNo.value = page
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: message,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const getList = async params => {
|
||||
const {
|
||||
data: { timestamp }
|
||||
} = await $bluetooth.updateServerTimestamp()
|
||||
const { code, data, message } = await getPalmVeinList({
|
||||
...params,
|
||||
lockId: lockId.value,
|
||||
pageSize
|
||||
})
|
||||
if (code === 0) {
|
||||
total.value = data.total
|
||||
for (let i = 0; i < data.list.length; i++) {
|
||||
if (data.list[i].palmVeinStatus === 1 && data.list[i].startDate > timestamp) {
|
||||
data.list[i].statusText = '未生效'
|
||||
} else if (data.list[i].palmVeinStatus === 2) {
|
||||
data.list[i].statusText = '已失效'
|
||||
}
|
||||
|
||||
if (data.list[i].palmVeinType === 1) {
|
||||
data.list[i].timeText = timeFormat(data.list[i].startDate, 'yyyy-mm-dd hh:MM') + ' 永久'
|
||||
} else if (data.list[i].palmVeinType === 2) {
|
||||
data.list[i].timeText =
|
||||
timeFormat(data.list[i].startDate, 'yyyy-mm-dd hh:MM') +
|
||||
' - ' +
|
||||
timeFormat(data.list[i].endDate, 'yyyy-mm-dd hh:MM') +
|
||||
' 限时'
|
||||
} else {
|
||||
data.list[i].timeText =
|
||||
timeFormat(data.list[i].startDate, 'yyyy-mm-dd') +
|
||||
' - ' +
|
||||
timeFormat(data.list[i].endDate, 'yyyy-mm-dd') +
|
||||
' 循环'
|
||||
}
|
||||
}
|
||||
if (params.pageNo === 1) {
|
||||
list.value = data.list
|
||||
} else {
|
||||
list.value = list.value.concat(data.list)
|
||||
}
|
||||
return { code }
|
||||
}
|
||||
return { code, message }
|
||||
}
|
||||
|
||||
const changeSearch = async data => {
|
||||
pageNo.value = 1
|
||||
const { code, message } = await getList({
|
||||
searchStr: data,
|
||||
pageNo: pageNo.value
|
||||
})
|
||||
if (code !== 0) {
|
||||
uni.showToast({
|
||||
title: message,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const toCreate = () => {
|
||||
$basic.routeJump({
|
||||
name: 'createPalmVein',
|
||||
events: {
|
||||
refresherList() {
|
||||
pageNo.value = 1
|
||||
getList({
|
||||
pageNo: pageNo.value
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const toDetail = item => {
|
||||
$basic.routeJump({
|
||||
name: 'palmVeinDetail',
|
||||
params: {
|
||||
info: JSON.stringify(item)
|
||||
},
|
||||
events: {
|
||||
delete() {
|
||||
deleteItem({ ...item, back: true })
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: $uni-bg-color-grey;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.search {
|
||||
padding: 32rpx;
|
||||
width: 686rpx !important;
|
||||
}
|
||||
|
||||
.button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: fixed;
|
||||
bottom: calc(env(safe-area-inset-bottom) + 20rpx);
|
||||
font-weight: bold;
|
||||
|
||||
.button-reset {
|
||||
margin-left: 50rpx;
|
||||
width: 300rpx;
|
||||
height: 88rpx;
|
||||
background-color: #df282d;
|
||||
color: white;
|
||||
text-align: center;
|
||||
line-height: 88rpx;
|
||||
border-radius: 44rpx;
|
||||
}
|
||||
|
||||
.button-create {
|
||||
margin-left: 50rpx;
|
||||
width: 300rpx;
|
||||
height: 88rpx;
|
||||
background-color: #63b8af;
|
||||
color: white;
|
||||
text-align: center;
|
||||
line-height: 88rpx;
|
||||
border-radius: 44rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background-color: #ffffff;
|
||||
height: 120rpx;
|
||||
width: 750rpx;
|
||||
|
||||
.item-left {
|
||||
margin-left: 32rpx;
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
}
|
||||
|
||||
.item-right {
|
||||
margin-right: 32rpx;
|
||||
margin-left: 32rpx;
|
||||
width: 574rpx;
|
||||
|
||||
.item-right-top {
|
||||
max-width: 400rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
padding-bottom: 6rpx;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.item-right-bottom {
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.line {
|
||||
width: 100%;
|
||||
height: 2rpx;
|
||||
background: #ebebeb;
|
||||
}
|
||||
|
||||
.empty-list {
|
||||
width: 150rpx;
|
||||
height: 150rpx;
|
||||
margin: 300rpx auto 20rpx 50%;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
|
||||
.empty-list-text {
|
||||
text-align: center;
|
||||
font-size: 32rpx;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.status {
|
||||
margin-left: auto;
|
||||
font-size: 26rpx;
|
||||
color: #df282d;
|
||||
}
|
||||
</style>
|
||||
111
pages/remoteDetail/remoteDetail.vue
Normal file
@ -0,0 +1,111 @@
|
||||
<template>
|
||||
<view>
|
||||
<view v-if="info">
|
||||
<view class="item">
|
||||
<view class="item-title">遥控号</view>
|
||||
<view class="item-content">{{ info.remoteNumber }}</view>
|
||||
</view>
|
||||
<view class="item" style="margin-top: 2rpx">
|
||||
<view class="item-title">姓名</view>
|
||||
<view class="item-content">{{ info.remoteName }}</view>
|
||||
</view>
|
||||
<view class="item" style="margin-top: 2rpx">
|
||||
<view class="item-title">有效期</view>
|
||||
<view v-if="info.remoteType === 1">永久</view>
|
||||
<view v-else-if="info.remoteType === 2">
|
||||
<view class="item-content">{{ timeFormat(info.startDate, 'yyyy-mm-dd h:M') }}</view>
|
||||
<view class="item-content">{{ timeFormat(info.endDate, 'yyyy-mm-dd h:M') }}</view>
|
||||
</view>
|
||||
<view v-else>
|
||||
<view class="item-content">{{ timeFormat(info.startDate, 'yyyy-mm-dd') }}</view>
|
||||
<view class="item-content">{{ timeFormat(info.endDate, 'yyyy-mm-dd') }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="item" style="margin-top: 2rpx" v-if="info.remoteType === 4">
|
||||
<view class="item-title">有效日</view>
|
||||
<view class="item-content">{{ $lock.convertWeekDaysToChineseString(info.weekDay) }}</view>
|
||||
</view>
|
||||
<view class="item" style="margin-top: 2rpx" v-if="info.remoteType === 4">
|
||||
<view class="item-title">有效时间</view>
|
||||
<view class="item-content">
|
||||
{{ timeFormat(info.startDate, 'h:M') }} - {{ timeFormat(info.endDate, 'h:M') }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="item" style="margin-top: 20rpx">
|
||||
<view class="item-title">添加者</view>
|
||||
<view class="item-content">{{ info.senderUsername }}</view>
|
||||
</view>
|
||||
<view class="item" style="margin-top: 2rpx">
|
||||
<view class="item-title">添加时间</view>
|
||||
<view class="item-content">{{ timeFormat(info.createDate, 'yyyy-mm-dd h:M') }}</view>
|
||||
</view>
|
||||
|
||||
<view class="button" @click="deletePassword">删除</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { getCurrentInstance, ref } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { timeFormat } from 'uview-plus'
|
||||
import { useLockStore } from '@/stores/lock'
|
||||
|
||||
const instance = getCurrentInstance().proxy
|
||||
const eventChannel = instance.getOpenerEventChannel()
|
||||
|
||||
const $lock = useLockStore()
|
||||
|
||||
const info = ref(null)
|
||||
|
||||
onLoad(options => {
|
||||
if (options.info) {
|
||||
info.value = JSON.parse(options.info)
|
||||
console.log(info.value)
|
||||
}
|
||||
})
|
||||
|
||||
const deletePassword = async () => {
|
||||
eventChannel.emit('delete', {})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: $uni-bg-color-grey;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.item-title {
|
||||
width: 350rpx;
|
||||
}
|
||||
|
||||
.item {
|
||||
padding: 24rpx 32rpx;
|
||||
background-color: #ffffff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.tips {
|
||||
padding: 24rpx 32rpx;
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.button {
|
||||
margin: 32rpx;
|
||||
width: 686rpx;
|
||||
height: 88rpx;
|
||||
background-color: #df282d;
|
||||
color: white;
|
||||
text-align: center;
|
||||
line-height: 88rpx;
|
||||
border-radius: 44rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
466
pages/remoteList/remoteList.vue
Normal file
@ -0,0 +1,466 @@
|
||||
<template>
|
||||
<view>
|
||||
<scroll-view
|
||||
v-if="deviceInfo"
|
||||
scroll-y="true"
|
||||
:style="{ height: deviceInfo.screenHeight - deviceInfo.safeArea.top + 'px' }"
|
||||
lower-threshold="100"
|
||||
@refresherrefresh="refresherList"
|
||||
:refresher-enabled="true"
|
||||
@scrolltolower="nextPage"
|
||||
:refresher-triggered="refresherTriggered"
|
||||
>
|
||||
<view class="search">
|
||||
<up-search
|
||||
shape="square"
|
||||
:searchIconSize="48"
|
||||
:inputStyle="{ fontSize: '32rpx' }"
|
||||
:height="80"
|
||||
placeholder="搜索"
|
||||
:clearabled="false"
|
||||
@change="changeSearch"
|
||||
v-model="searchStr"
|
||||
bgColor="#ffffff"
|
||||
:showAction="false"
|
||||
maxlength="50"
|
||||
></up-search>
|
||||
</view>
|
||||
<view style="padding: 0 0 calc(env(safe-area-inset-bottom) + 250rpx) 0">
|
||||
<view v-if="list.length === 0 && requestFinished">
|
||||
<image
|
||||
class="empty-list"
|
||||
src="/static/images/background_empty_list.png"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
<view class="empty-list-text">暂无数据</view>
|
||||
</view>
|
||||
<view v-else>
|
||||
<up-swipe-action>
|
||||
<up-swipe-action-item
|
||||
ref="swipeItem"
|
||||
:options="options"
|
||||
v-for="item in list"
|
||||
:key="item.keyboardPwdId"
|
||||
:threshold="50"
|
||||
@click="deleteItem(item)"
|
||||
>
|
||||
<view class="item" @click="toDetail(item)">
|
||||
<view class="item-left rounded-50% bg-#2863f6 flex items-center justify-center">
|
||||
<image
|
||||
class="w-80 h-80"
|
||||
src="/static/images/icon_remote_white.png"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
</view>
|
||||
<view class="item-right">
|
||||
<view style="display: flex; align-items: center">
|
||||
<view class="item-right-top">{{ item.remoteName }}</view>
|
||||
<view class="status">
|
||||
{{ item.statusText }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="item-right-bottom">{{ item.timeText }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="line"></view>
|
||||
</up-swipe-action-item>
|
||||
</up-swipe-action>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="button">
|
||||
<view class="button-reset" @click="reset">重置遥控</view>
|
||||
<view class="button-create" @click="toCreate">添加遥控</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { timeFormat } from 'uview-plus'
|
||||
import { useBasicStore } from '@/stores/basic'
|
||||
import { useBluetoothStore } from '@/stores/bluetooth'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { clearRemoteRequest, deleteRemoteRequest, getRemoteList } from '@/api/remote'
|
||||
|
||||
const $basic = useBasicStore()
|
||||
const $bluetooth = useBluetoothStore()
|
||||
const $user = useUserStore()
|
||||
|
||||
const swipeItem = ref(null)
|
||||
|
||||
const searchStr = ref('')
|
||||
const list = ref([])
|
||||
const pageNo = ref(1)
|
||||
const pageSize = 50
|
||||
const total = ref(0)
|
||||
const lockId = ref(null)
|
||||
|
||||
const deviceInfo = ref(null)
|
||||
const requestFinished = ref(false)
|
||||
const refresherTriggered = ref(false)
|
||||
const options = ref([
|
||||
{
|
||||
text: '删除',
|
||||
style: {
|
||||
backgroundColor: '#f56c6c'
|
||||
}
|
||||
}
|
||||
])
|
||||
|
||||
onMounted(async () => {
|
||||
uni.showLoading({
|
||||
title: '加载中',
|
||||
mask: true
|
||||
})
|
||||
deviceInfo.value = await $basic.getDeviceInfo()
|
||||
lockId.value = $bluetooth.currentLockInfo.lockId
|
||||
const { code, message } = await getList({
|
||||
pageNo: pageNo.value
|
||||
})
|
||||
requestFinished.value = true
|
||||
uni.hideLoading()
|
||||
if (code !== 0) {
|
||||
uni.showToast({
|
||||
title: message,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
const reset = async () => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '重置后,该锁的遥控都将被删除哦,确认要重置吗?',
|
||||
async success(res) {
|
||||
if (res.confirm) {
|
||||
const netWork = await $basic.getNetworkType()
|
||||
if (!netWork) {
|
||||
return
|
||||
}
|
||||
await deleteData({
|
||||
operate: 3
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const deleteData = async info => {
|
||||
uni.showLoading({
|
||||
title: `${info.operate === 2 ? '删除' : '重置'}中`
|
||||
})
|
||||
|
||||
const { code } = await $bluetooth.registerAuthentication({
|
||||
type: 'remote',
|
||||
keyId: $bluetooth.keyId.toString(),
|
||||
uid: $user.userInfo.uid.toString(),
|
||||
no: Number(info.remoteNumber) || 0,
|
||||
operate: info.operate,
|
||||
isAdmin: 0,
|
||||
isForce: 0,
|
||||
userCountLimit: 0,
|
||||
weekDays: [],
|
||||
isRound: 0,
|
||||
startDate: 0,
|
||||
endDate: 0,
|
||||
startTime: '00:00',
|
||||
endTime: '00:00'
|
||||
})
|
||||
|
||||
$bluetooth.closeBluetoothConnection()
|
||||
if (code === 0) {
|
||||
let params = {
|
||||
lockId: $bluetooth.currentLockInfo.lockId,
|
||||
deleteType: 1,
|
||||
type: 1
|
||||
}
|
||||
if (info.operate === 2) {
|
||||
params = {
|
||||
...params,
|
||||
remoteId: info.remoteId,
|
||||
type: 0
|
||||
}
|
||||
}
|
||||
const { code: requestCode, message } =
|
||||
info.operate === 3 ? await clearRemoteRequest(params) : await deleteRemoteRequest(params)
|
||||
if (requestCode === 0) {
|
||||
if (info.back) {
|
||||
$basic.backAndToast(`删除成功`)
|
||||
}
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: `${info.operate === 2 ? '删除' : '重置'}成功`,
|
||||
icon: 'none'
|
||||
})
|
||||
pageNo.value = 1
|
||||
await getList({
|
||||
pageNo: pageNo.value
|
||||
})
|
||||
} else {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: message,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
} else if (code === -1) {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: `${info.operate === 2 ? '删除' : '重置'}失败,请保持在锁附近`,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const deleteItem = async data => {
|
||||
const index = list.value.findIndex(item => item.keyboardPwdId === data.keyboardPwdId)
|
||||
swipeItem.value[index].closeHandler()
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定要删除吗?',
|
||||
async success(res) {
|
||||
if (res.confirm) {
|
||||
const netWork = await $basic.getNetworkType()
|
||||
if (!netWork) {
|
||||
return
|
||||
}
|
||||
await deleteData({
|
||||
...data,
|
||||
operate: 2
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const refresherList = async () => {
|
||||
refresherTriggered.value = true
|
||||
pageNo.value = 1
|
||||
const { code, message } = await getList({
|
||||
pageNo: pageNo.value,
|
||||
searchStr: searchStr.value
|
||||
})
|
||||
if (code === 0) {
|
||||
uni.showToast({
|
||||
title: '刷新成功',
|
||||
icon: 'none'
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: message,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
refresherTriggered.value = false
|
||||
}
|
||||
|
||||
const nextPage = async () => {
|
||||
if (total.value <= pageNo.value * pageSize) {
|
||||
return
|
||||
}
|
||||
const page = pageNo.value + 1
|
||||
const params = {
|
||||
searchStr: searchStr.value,
|
||||
pageNo: page
|
||||
}
|
||||
const { code, message } = await getList(params)
|
||||
if (code === 0) {
|
||||
pageNo.value = page
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: message,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const getList = async params => {
|
||||
const {
|
||||
data: { timestamp }
|
||||
} = await $bluetooth.updateServerTimestamp()
|
||||
const { code, data, message } = await getRemoteList({
|
||||
...params,
|
||||
lockId: lockId.value,
|
||||
pageSize
|
||||
})
|
||||
if (code === 0) {
|
||||
total.value = data.total
|
||||
for (let i = 0; i < data.list.length; i++) {
|
||||
if (data.list[i].remoteStatus === 1 && data.list[i].startDate > timestamp) {
|
||||
data.list[i].statusText = '未生效'
|
||||
} else if (data.list[i].remoteStatus === 2) {
|
||||
data.list[i].statusText = '已失效'
|
||||
}
|
||||
|
||||
if (data.list[i].remoteType === 1) {
|
||||
data.list[i].timeText = timeFormat(data.list[i].startDate, 'yyyy-mm-dd hh:MM') + ' 永久'
|
||||
} else if (data.list[i].remoteType === 2) {
|
||||
data.list[i].timeText =
|
||||
timeFormat(data.list[i].startDate, 'yyyy-mm-dd hh:MM') +
|
||||
' - ' +
|
||||
timeFormat(data.list[i].endDate, 'yyyy-mm-dd hh:MM') +
|
||||
' 限时'
|
||||
} else {
|
||||
data.list[i].timeText =
|
||||
timeFormat(data.list[i].startDate, 'yyyy-mm-dd') +
|
||||
' - ' +
|
||||
timeFormat(data.list[i].endDate, 'yyyy-mm-dd') +
|
||||
' 循环'
|
||||
}
|
||||
}
|
||||
if (params.pageNo === 1) {
|
||||
list.value = data.list
|
||||
} else {
|
||||
list.value = list.value.concat(data.list)
|
||||
}
|
||||
return { code }
|
||||
}
|
||||
return { code, message }
|
||||
}
|
||||
|
||||
const changeSearch = async data => {
|
||||
pageNo.value = 1
|
||||
const { code, message } = await getList({
|
||||
searchStr: data,
|
||||
pageNo: pageNo.value
|
||||
})
|
||||
if (code !== 0) {
|
||||
uni.showToast({
|
||||
title: message,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const toCreate = () => {
|
||||
$basic.routeJump({
|
||||
name: 'createRemote',
|
||||
events: {
|
||||
refresherList() {
|
||||
pageNo.value = 1
|
||||
getList({
|
||||
pageNo: pageNo.value
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const toDetail = item => {
|
||||
$basic.routeJump({
|
||||
name: 'remoteDetail',
|
||||
params: {
|
||||
info: JSON.stringify(item)
|
||||
},
|
||||
events: {
|
||||
delete() {
|
||||
deleteItem({ ...item, back: true })
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: $uni-bg-color-grey;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.search {
|
||||
padding: 32rpx;
|
||||
width: 686rpx !important;
|
||||
}
|
||||
|
||||
.button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: fixed;
|
||||
bottom: calc(env(safe-area-inset-bottom) + 20rpx);
|
||||
font-weight: bold;
|
||||
|
||||
.button-reset {
|
||||
margin-left: 50rpx;
|
||||
width: 300rpx;
|
||||
height: 88rpx;
|
||||
background-color: #df282d;
|
||||
color: white;
|
||||
text-align: center;
|
||||
line-height: 88rpx;
|
||||
border-radius: 44rpx;
|
||||
}
|
||||
|
||||
.button-create {
|
||||
margin-left: 50rpx;
|
||||
width: 300rpx;
|
||||
height: 88rpx;
|
||||
background-color: #63b8af;
|
||||
color: white;
|
||||
text-align: center;
|
||||
line-height: 88rpx;
|
||||
border-radius: 44rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background-color: #ffffff;
|
||||
height: 120rpx;
|
||||
width: 750rpx;
|
||||
|
||||
.item-left {
|
||||
margin-left: 32rpx;
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
}
|
||||
|
||||
.item-right {
|
||||
margin-right: 32rpx;
|
||||
margin-left: 32rpx;
|
||||
width: 574rpx;
|
||||
|
||||
.item-right-top {
|
||||
max-width: 400rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
padding-bottom: 6rpx;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.item-right-bottom {
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.line {
|
||||
width: 100%;
|
||||
height: 2rpx;
|
||||
background: #ebebeb;
|
||||
}
|
||||
|
||||
.empty-list {
|
||||
width: 150rpx;
|
||||
height: 150rpx;
|
||||
margin: 300rpx auto 20rpx 50%;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
|
||||
.empty-list-text {
|
||||
text-align: center;
|
||||
font-size: 32rpx;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.status {
|
||||
margin-left: auto;
|
||||
font-size: 26rpx;
|
||||
color: #df282d;
|
||||
}
|
||||
</style>
|
||||
|
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 527 B |
|
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 880 B After Width: | Height: | Size: 198 B |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 552 B |
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 12 KiB |
BIN
static/images/icon_add_face_1.png
Executable file
|
After Width: | Height: | Size: 24 KiB |
BIN
static/images/icon_add_face_2.png
Executable file
|
After Width: | Height: | Size: 24 KiB |
BIN
static/images/icon_add_palm_vein.png
Executable file
|
After Width: | Height: | Size: 106 KiB |
BIN
static/images/icon_add_remote.png
Normal file
|
After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 688 B |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 487 B |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 758 B |
|
Before Width: | Height: | Size: 941 B After Width: | Height: | Size: 204 B |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 909 B |
|
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 683 B |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 683 B |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 268 B |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 1.1 KiB |
BIN
static/images/icon_face.png
Normal file
|
After Width: | Height: | Size: 460 B |
BIN
static/images/icon_face_white.png
Executable file
|
After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 156 KiB After Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 182 KiB After Width: | Height: | Size: 57 KiB |
|
Before Width: | Height: | Size: 303 KiB After Width: | Height: | Size: 77 KiB |
|
Before Width: | Height: | Size: 336 KiB After Width: | Height: | Size: 79 KiB |
|
Before Width: | Height: | Size: 361 KiB After Width: | Height: | Size: 87 KiB |
|
Before Width: | Height: | Size: 308 KiB After Width: | Height: | Size: 92 KiB |
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 2.9 KiB |
BIN
static/images/icon_palm_vein.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
static/images/icon_palm_vein_white.png
Normal file
|
After Width: | Height: | Size: 821 B |
BIN
static/images/icon_remote.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
static/images/icon_remote_white.png
Normal file
|
After Width: | Height: | Size: 929 B |
@ -151,6 +151,66 @@ const pages = [
|
||||
name: 'bindFingerprint',
|
||||
path: '/pages/bindFingerprint/bindFingerprint',
|
||||
tabBar: false
|
||||
},
|
||||
{
|
||||
name: 'faceList',
|
||||
path: '/pages/faceList/faceList',
|
||||
tabBar: false
|
||||
},
|
||||
{
|
||||
name: 'createFace',
|
||||
path: '/pages/createFace/createFace',
|
||||
tabBar: false
|
||||
},
|
||||
{
|
||||
name: 'faceDetail',
|
||||
path: '/pages/faceDetail/faceDetail',
|
||||
tabBar: false
|
||||
},
|
||||
{
|
||||
name: 'bindFace',
|
||||
path: '/pages/bindFace/bindFace',
|
||||
tabBar: false
|
||||
},
|
||||
{
|
||||
name: 'remoteList',
|
||||
path: '/pages/remoteList/remoteList',
|
||||
tabBar: false
|
||||
},
|
||||
{
|
||||
name: 'createRemote',
|
||||
path: '/pages/createRemote/createRemote',
|
||||
tabBar: false
|
||||
},
|
||||
{
|
||||
name: 'remoteDetail',
|
||||
path: '/pages/remoteDetail/remoteDetail',
|
||||
tabBar: false
|
||||
},
|
||||
{
|
||||
name: 'bindRemote',
|
||||
path: '/pages/bindRemote/bindRemote',
|
||||
tabBar: false
|
||||
},
|
||||
{
|
||||
name: 'palmVeinList',
|
||||
path: '/pages/palmVeinList/palmVeinList',
|
||||
tabBar: false
|
||||
},
|
||||
{
|
||||
name: 'createPalmVein',
|
||||
path: '/pages/createPalmVein/createPalmVein',
|
||||
tabBar: false
|
||||
},
|
||||
{
|
||||
name: 'palmVeinDetail',
|
||||
path: '/pages/palmVeinDetail/palmVeinDetail',
|
||||
tabBar: false
|
||||
},
|
||||
{
|
||||
name: 'bindPalmVein',
|
||||
path: '/pages/bindPalmVein/bindPalmVein',
|
||||
tabBar: false
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
@ -68,12 +68,20 @@ const subCmdIds = {
|
||||
registerFaceConfirm: 82,
|
||||
// 注册人脸取消
|
||||
registerFaceCancel: 86,
|
||||
// 注册人脸过程
|
||||
registerFaceProcess: 83,
|
||||
// 注册遥控
|
||||
registerRemote: 26,
|
||||
// 注册遥控确认
|
||||
registerRemoteConfirm: 27,
|
||||
// 注册遥控取消
|
||||
registerRemoteCancel: 28
|
||||
registerRemoteCancel: 28,
|
||||
// 注册掌纹
|
||||
registerPalmVein: 42,
|
||||
// 注册掌纹确认
|
||||
registerPalmVeinConfirm: 43,
|
||||
// 注册掌纹取消
|
||||
registerPalmVeinCancel: 44
|
||||
}
|
||||
|
||||
export const useBluetoothStore = defineStore('ble', {
|
||||
@ -397,9 +405,8 @@ export const useBluetoothStore = defineStore('ble', {
|
||||
})
|
||||
break
|
||||
case subCmdIds.registerCard:
|
||||
case subCmdIds.registerFingerprint:
|
||||
case subCmdIds.registerFace:
|
||||
case subCmdIds.registerRemote:
|
||||
case subCmdIds.registerPalmVein:
|
||||
that.updateCurrentLockInfo({
|
||||
...that.currentLockInfo,
|
||||
token: decrypted.slice(5, 9)
|
||||
@ -407,8 +414,20 @@ export const useBluetoothStore = defineStore('ble', {
|
||||
characteristicValueCallback({
|
||||
code: decrypted[2],
|
||||
data: {
|
||||
status: decrypted[9],
|
||||
no: decrypted[10] * 256 + decrypted[11]
|
||||
status: decrypted[9]
|
||||
}
|
||||
})
|
||||
break
|
||||
case subCmdIds.registerFingerprint:
|
||||
case subCmdIds.registerFace:
|
||||
that.updateCurrentLockInfo({
|
||||
...that.currentLockInfo,
|
||||
token: decrypted.slice(5, 9)
|
||||
})
|
||||
characteristicValueCallback({
|
||||
code: decrypted[2],
|
||||
data: {
|
||||
maxProcess: decrypted[11]
|
||||
}
|
||||
})
|
||||
break
|
||||
@ -424,12 +443,36 @@ export const useBluetoothStore = defineStore('ble', {
|
||||
fingerprintNumber: decrypted[6] * 256 + decrypted[7]
|
||||
})
|
||||
break
|
||||
case subCmdIds.registerFaceConfirm:
|
||||
uni.$emit('registerFaceConfirm', {
|
||||
status: decrypted[5],
|
||||
faceNumber: decrypted[6] * 256 + decrypted[7]
|
||||
})
|
||||
break
|
||||
case subCmdIds.registerRemoteConfirm:
|
||||
uni.$emit('registerRemoteConfirm', {
|
||||
status: decrypted[5],
|
||||
remoteNumber: decrypted[6] * 256 + decrypted[7]
|
||||
})
|
||||
break
|
||||
case subCmdIds.registerPalmVeinConfirm:
|
||||
uni.$emit('registerPalmVeinConfirm', {
|
||||
status: decrypted[5],
|
||||
palmVeinNumber: decrypted[6] * 256 + decrypted[7]
|
||||
})
|
||||
break
|
||||
case subCmdIds.registerFingerprintProcess:
|
||||
uni.$emit('registerFingerprintProcess', {
|
||||
status: decrypted[5],
|
||||
process: decrypted[6]
|
||||
})
|
||||
break
|
||||
case subCmdIds.registerFaceProcess:
|
||||
uni.$emit('registerFaceProcess', {
|
||||
status: decrypted[5],
|
||||
process: decrypted[6]
|
||||
})
|
||||
break
|
||||
}
|
||||
break
|
||||
case cmdIds.openDoor:
|
||||
@ -2292,8 +2335,10 @@ export const useBluetoothStore = defineStore('ble', {
|
||||
contentArray[2] = subCmdIds.registerFingerprint
|
||||
} else if (type === 'face') {
|
||||
contentArray[2] = subCmdIds.registerFace
|
||||
} else {
|
||||
} else if (type === 'remote') {
|
||||
contentArray[2] = subCmdIds.registerRemote
|
||||
} else if (type === 'palmVein') {
|
||||
contentArray[2] = subCmdIds.registerPalmVein
|
||||
}
|
||||
|
||||
contentArray[3] = length - 3
|
||||
@ -2371,8 +2416,10 @@ export const useBluetoothStore = defineStore('ble', {
|
||||
contentArray[2] = subCmdIds.registerFingerprintCancel
|
||||
} else if (type === 'face') {
|
||||
contentArray[2] = subCmdIds.registerFaceCancel
|
||||
} else {
|
||||
} else if (type === 'remote') {
|
||||
contentArray[2] = subCmdIds.registerRemoteCancel
|
||||
} else if (type === 'palmVein') {
|
||||
contentArray[2] = subCmdIds.registerPalmVeinCancel
|
||||
}
|
||||
|
||||
contentArray[3] = length - 3
|
||||
|
||||