diff --git a/api/fingerprint.js b/api/fingerprint.js
new file mode 100644
index 0000000..3876683
--- /dev/null
+++ b/api/fingerprint.js
@@ -0,0 +1,39 @@
+import request from '../utils/request'
+
+// fingerprint 指纹模块
+
+// 获取指纹列表
+export function getFingerprintList(data) {
+ return request({
+ url: '/fingerprint/list',
+ method: 'POST',
+ data
+ })
+}
+
+// 删除指纹
+export function deleteFingerprintRequest(data) {
+ return request({
+ url: '/fingerprint/delete',
+ method: 'POST',
+ data
+ })
+}
+
+// 检查指纹名称是否重复
+export function checkFingerprintNameRequest(data) {
+ return request({
+ url: '/fingerprint/checkFingerprintName',
+ method: 'POST',
+ data
+ })
+}
+
+// 添加指纹
+export function addFingerprintRequest(data) {
+ return request({
+ url: '/fingerprint/add',
+ method: 'POST',
+ data
+ })
+}
diff --git a/pages.json b/pages.json
index 086df60..d6d4f97 100644
--- a/pages.json
+++ b/pages.json
@@ -190,6 +190,13 @@
"navigationBarTitleText": "指纹详情",
"disableScroll": true
}
+ },
+ {
+ "path": "pages/bindFingerprint/bindFingerprint",
+ "style": {
+ "navigationBarTitleText": "添加指纹",
+ "disableScroll": true
+ }
}
],
"globalStyle": {
diff --git a/pages/bindCard/bindCard.vue b/pages/bindCard/bindCard.vue
index cfb73cb..a4435cd 100644
--- a/pages/bindCard/bindCard.vue
+++ b/pages/bindCard/bindCard.vue
@@ -6,8 +6,11 @@
mode="aspectFill"
class="mx-[200rpx] w-350 h-350"
>
+
+
+
{{ text }}
@@ -36,7 +39,7 @@
onLoad(async options => {
if (options.card) {
const params = JSON.parse(options.card)
- const { code } = await $bluetooth.registerCard(params)
+ const { code } = await $bluetooth.registerAuthentication(params)
if (code === 0) {
text.value = '已连接到锁,请将卡靠近锁的读卡区'
@@ -69,14 +72,16 @@
}
})
- onUnmounted(() => {
+ onUnmounted(async () => {
uni.$off('registerCardConfirm')
if (!bindFlag.value) {
- $bluetooth.registerCardCancel({
+ await $bluetooth.registerAuthenticationCancel({
+ type: 'card',
keyId: $bluetooth.keyId.toString(),
uid: $user.userInfo.uid.toString()
})
}
+ $bluetooth.closeBluetoothConnection()
})
diff --git a/pages/bindFingerprint/bindFingerprint.vue b/pages/bindFingerprint/bindFingerprint.vue
new file mode 100644
index 0000000..5f4608f
--- /dev/null
+++ b/pages/bindFingerprint/bindFingerprint.vue
@@ -0,0 +1,91 @@
+
+
+
+
+ {{ text }}
+
+ ({{ process }}/5)
+
+ 根据提示,抬起手指后再进行下一次指纹采集
+
+
+
+
+
diff --git a/pages/cardList/cardList.vue b/pages/cardList/cardList.vue
index bdc006d..a6ab2f5 100644
--- a/pages/cardList/cardList.vue
+++ b/pages/cardList/cardList.vue
@@ -149,10 +149,11 @@
title: `${info.operate === 2 ? '删除' : '重置'}中`
})
- const { code } = await $bluetooth.registerCard({
+ const { code } = await $bluetooth.registerAuthentication({
+ type: 'card',
keyId: $bluetooth.keyId.toString(),
uid: $user.userInfo.uid.toString(),
- cardNo: Number(info.cardNumber) || 0,
+ no: Number(info.cardNumber) || 0,
operate: info.operate,
isAdmin: 0,
isForce: 0,
diff --git a/pages/createCard/createCard.vue b/pages/createCard/createCard.vue
index 650dc31..97fc646 100644
--- a/pages/createCard/createCard.vue
+++ b/pages/createCard/createCard.vue
@@ -199,9 +199,10 @@
}
let params = {
+ type: 'card',
keyId: $bluetooth.keyId.toString(),
uid: $user.userInfo.uid.toString(),
- cardNo: 0,
+ no: 0,
operate: 0,
userCountLimit: 0xffff
}
diff --git a/pages/createFingerprint/createFingerprint.vue b/pages/createFingerprint/createFingerprint.vue
index 6ebc436..920fbb0 100644
--- a/pages/createFingerprint/createFingerprint.vue
+++ b/pages/createFingerprint/createFingerprint.vue
@@ -1,7 +1,337 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 下一步
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 下一步
+
+
+
-
+
+
+
+
+
diff --git a/pages/fingerprintDetail/fingerprintDetail.vue b/pages/fingerprintDetail/fingerprintDetail.vue
index 281e78b..2246aa2 100644
--- a/pages/fingerprintDetail/fingerprintDetail.vue
+++ b/pages/fingerprintDetail/fingerprintDetail.vue
@@ -1,7 +1,111 @@
-
+
+
+
+ 指纹号
+ {{ info.fingerprintNumber }}
+
+
+ 姓名
+ {{ info.fingerprintName }}
+
+
+ 有效期
+ 永久
+
+ {{ timeFormat(info.startDate, 'yyyy-mm-dd h:M') }}
+ {{ timeFormat(info.endDate, 'yyyy-mm-dd h:M') }}
+
+
+ {{ timeFormat(info.startDate, 'yyyy-mm-dd') }}
+ {{ timeFormat(info.endDate, 'yyyy-mm-dd') }}
+
+
+
+ 有效日
+ {{ $lock.convertWeekDaysToChineseString(info.weekDay) }}
+
+
+ 有效时间
+
+ {{ timeFormat(info.startDate, 'h:M') }} - {{ timeFormat(info.endDate, 'h:M') }}
+
+
+
+ 添加者
+ {{ info.senderUsername }}
+
+
+ 添加时间
+ {{ timeFormat(info.createDate, 'yyyy-mm-dd h:M') }}
+
+
+ 删除
+
+
-
+
+
+
+
+
diff --git a/pages/fingerprintList/fingerprintList.vue b/pages/fingerprintList/fingerprintList.vue
index 281e78b..df9a781 100644
--- a/pages/fingerprintList/fingerprintList.vue
+++ b/pages/fingerprintList/fingerprintList.vue
@@ -1,7 +1,463 @@
-
+
+
+
+
+
+
+
+
+ 暂无数据
+
+
+
+
+
+
+
+
+ {{ item.fingerprintName }}
+
+ {{ item.statusText }}
+
+
+ {{ item.timeText }}
+
+
+
+
+
+
+
+
+
+ 重置指纹
+ 添加指纹
+
+
-
+
+
+
+
+
diff --git a/pages/lockDetail/lockDetail.vue b/pages/lockDetail/lockDetail.vue
index e33c018..6464437 100644
--- a/pages/lockDetail/lockDetail.vue
+++ b/pages/lockDetail/lockDetail.vue
@@ -68,11 +68,19 @@
密码
-
+
卡
-
+
指纹
@@ -129,6 +137,9 @@
import { deleteKeyRequest } from '@/api/key'
export default {
+ components: {
+ SwitchLoading
+ },
data() {
return {
time: 0,
@@ -143,9 +154,6 @@
...mapState(useUserStore, ['userInfo']),
...mapState(useLockStore, ['lockSearch'])
},
- components: {
- SwitchLoading
- },
onLoad() {
this.getServeTime()
},
diff --git a/static/images/icon_fingerprint_0.png b/static/images/icon_fingerprint_0.png
new file mode 100755
index 0000000..ffc2d97
Binary files /dev/null and b/static/images/icon_fingerprint_0.png differ
diff --git a/static/images/icon_fingerprint_1.png b/static/images/icon_fingerprint_1.png
new file mode 100755
index 0000000..ba603bf
Binary files /dev/null and b/static/images/icon_fingerprint_1.png differ
diff --git a/static/images/icon_fingerprint_2.png b/static/images/icon_fingerprint_2.png
new file mode 100755
index 0000000..89dea31
Binary files /dev/null and b/static/images/icon_fingerprint_2.png differ
diff --git a/static/images/icon_fingerprint_3.png b/static/images/icon_fingerprint_3.png
new file mode 100755
index 0000000..a106ee5
Binary files /dev/null and b/static/images/icon_fingerprint_3.png differ
diff --git a/static/images/icon_fingerprint_4.png b/static/images/icon_fingerprint_4.png
new file mode 100755
index 0000000..0c45326
Binary files /dev/null and b/static/images/icon_fingerprint_4.png differ
diff --git a/static/images/icon_fingerprint_5.png b/static/images/icon_fingerprint_5.png
new file mode 100644
index 0000000..a1e9b54
Binary files /dev/null and b/static/images/icon_fingerprint_5.png differ
diff --git a/static/images/icon_fingerprint_white.png b/static/images/icon_fingerprint_white.png
new file mode 100755
index 0000000..5a328b7
Binary files /dev/null and b/static/images/icon_fingerprint_white.png differ
diff --git a/stores/basic.js b/stores/basic.js
index b4c1ed4..869ff81 100644
--- a/stores/basic.js
+++ b/stores/basic.js
@@ -146,6 +146,11 @@ const pages = [
name: 'fingerprintDetail',
path: '/pages/fingerprintDetail/fingerprintDetail',
tabBar: false
+ },
+ {
+ name: 'bindFingerprint',
+ path: '/pages/bindFingerprint/bindFingerprint',
+ tabBar: false
}
]
diff --git a/stores/bluetooth.js b/stores/bluetooth.js
index 6d275e6..7e7ecd7 100644
--- a/stores/bluetooth.js
+++ b/stores/bluetooth.js
@@ -53,7 +53,27 @@ const subCmdIds = {
// 注册卡片确认
registerCardConfirm: 22,
// 注册卡片取消
- registerCardCancel: 25
+ registerCardCancel: 25,
+ // 注册指纹
+ registerFingerprint: 36,
+ // 注册指纹确认
+ registerFingerprintConfirm: 32,
+ // 注册指纹取消
+ registerFingerprintCancel: 37,
+ // 注册指纹过程
+ registerFingerprintProcess: 33,
+ // 注册人脸
+ registerFace: 81,
+ // 注册人脸确认
+ registerFaceConfirm: 82,
+ // 注册人脸取消
+ registerFaceCancel: 86,
+ // 注册遥控
+ registerRemote: 26,
+ // 注册遥控确认
+ registerRemoteConfirm: 27,
+ // 注册遥控取消
+ registerRemoteCancel: 28
}
export const useBluetoothStore = defineStore('ble', {
@@ -377,6 +397,9 @@ export const useBluetoothStore = defineStore('ble', {
})
break
case subCmdIds.registerCard:
+ case subCmdIds.registerFingerprint:
+ case subCmdIds.registerFace:
+ case subCmdIds.registerRemote:
that.updateCurrentLockInfo({
...that.currentLockInfo,
token: decrypted.slice(5, 9)
@@ -385,7 +408,7 @@ export const useBluetoothStore = defineStore('ble', {
code: decrypted[2],
data: {
status: decrypted[9],
- cardNo: decrypted[10] * 256 + decrypted[11]
+ no: decrypted[10] * 256 + decrypted[11]
}
})
break
@@ -395,6 +418,18 @@ export const useBluetoothStore = defineStore('ble', {
cardNumber: decrypted[6] * 256 + decrypted[7]
})
break
+ case subCmdIds.registerFingerprintConfirm:
+ uni.$emit('registerFingerprintConfirm', {
+ status: decrypted[5],
+ fingerprintNumber: decrypted[6] * 256 + decrypted[7]
+ })
+ break
+ case subCmdIds.registerFingerprintProcess:
+ uni.$emit('registerFingerprintProcess', {
+ status: decrypted[5],
+ process: decrypted[6]
+ })
+ break
}
break
case cmdIds.openDoor:
@@ -2187,8 +2222,8 @@ export const useBluetoothStore = defineStore('ble', {
return new Uint8Array(timeList)
},
- // 注册卡片
- async registerCard(data) {
+ // 注册身份认证
+ async registerAuthentication(data) {
// 确认蓝牙状态正常
if (this.bluetoothStatus !== 0) {
console.log('写入未执行', this.bluetoothStatus)
@@ -2227,9 +2262,10 @@ export const useBluetoothStore = defineStore('ble', {
}
const {
+ type,
keyId,
uid,
- cardNo,
+ no,
operate,
isAdmin,
userCountLimit,
@@ -2250,7 +2286,15 @@ export const useBluetoothStore = defineStore('ble', {
contentArray[1] = cmdIds.expandCmd % 256
// 子命令
- contentArray[2] = subCmdIds.registerCard
+ if (type === 'card') {
+ contentArray[2] = subCmdIds.registerCard
+ } else if (type === 'fingerprint') {
+ contentArray[2] = subCmdIds.registerFingerprint
+ } else if (type === 'face') {
+ contentArray[2] = subCmdIds.registerFace
+ } else {
+ contentArray[2] = subCmdIds.registerRemote
+ }
contentArray[3] = length - 3
@@ -2262,8 +2306,8 @@ export const useBluetoothStore = defineStore('ble', {
contentArray[i + 44] = uid.charCodeAt(i)
}
- contentArray[64] = (cardNo || 0) / 256
- contentArray[65] = (cardNo || 0) % 256
+ contentArray[64] = (no || 0) / 256
+ contentArray[65] = (no || 0) % 256
contentArray[66] = (userCountLimit || 0xffff) / 256
contentArray[67] = (userCountLimit || 0xffff) % 256
@@ -2307,10 +2351,11 @@ export const useBluetoothStore = defineStore('ble', {
await this.writeBLECharacteristicValue(packageArray)
- return this.getWriteResult(this.registerCard, data)
+ return this.getWriteResult(this.registerAuthentication, data)
},
- async registerCardCancel(data) {
- const { keyId, uid } = data
+ // 注册身份认证取消
+ async registerAuthenticationCancel(data) {
+ const { type, keyId, uid } = data
const length = 2 + 1 + 1 + 40 + 20 + 4 + 1 + 16
const headArray = this.createPackageHeader(3, length)
@@ -2320,7 +2365,15 @@ export const useBluetoothStore = defineStore('ble', {
contentArray[1] = cmdIds.expandCmd % 256
// 子命令
- contentArray[2] = subCmdIds.registerCardCancel
+ if (type === 'card') {
+ contentArray[2] = subCmdIds.registerCardCancel
+ } else if (type === 'fingerprint') {
+ contentArray[2] = subCmdIds.registerFingerprintCancel
+ } else if (type === 'face') {
+ contentArray[2] = subCmdIds.registerFaceCancel
+ } else {
+ contentArray[2] = subCmdIds.registerRemoteCancel
+ }
contentArray[3] = length - 3
@@ -2353,7 +2406,7 @@ export const useBluetoothStore = defineStore('ble', {
await this.writeBLECharacteristicValue(packageArray)
- return this.getWriteResult(this.registerCardCancel, data)
+ return this.getWriteResult(this.registerAuthenticationCancel, data)
}
}
})