diff --git a/api/card.js b/api/card.js
index d0d2385..eec0878 100644
--- a/api/card.js
+++ b/api/card.js
@@ -37,3 +37,21 @@ export function addCardRequest(data) {
data
})
}
+
+// 更新卡片
+export function updateCardRequest(data) {
+ return request({
+ url: '/identityCard/update',
+ method: 'POST',
+ data
+ })
+}
+
+// 卡详情
+export function getCardRequest(data) {
+ return request({
+ url: '/identityCard/detail',
+ method: 'POST',
+ data
+ })
+}
diff --git a/api/face.js b/api/face.js
index 7b9cf69..7bc0e16 100644
--- a/api/face.js
+++ b/api/face.js
@@ -46,3 +46,21 @@ export function addFaceRequest(data) {
data
})
}
+
+// 更新人脸
+export function updateFaceRequest(data) {
+ return request({
+ url: '/face/update',
+ method: 'POST',
+ data
+ })
+}
+
+// 人脸详情
+export function getFaceRequest(data) {
+ return request({
+ url: '/face/detail',
+ method: 'POST',
+ data
+ })
+}
diff --git a/api/fingerprint.js b/api/fingerprint.js
index 3876683..3eeff52 100644
--- a/api/fingerprint.js
+++ b/api/fingerprint.js
@@ -37,3 +37,21 @@ export function addFingerprintRequest(data) {
data
})
}
+
+// 更新指纹
+export function updateFingerprintRequest(data) {
+ return request({
+ url: '/fingerprint/changePeriod',
+ method: 'POST',
+ data
+ })
+}
+
+// 指纹详情
+export function getFingerprintRequest(data) {
+ return request({
+ url: '/fingerprint/detail',
+ method: 'POST',
+ data
+ })
+}
diff --git a/api/key.js b/api/key.js
index 5733885..c3755c6 100644
--- a/api/key.js
+++ b/api/key.js
@@ -55,3 +55,30 @@ export function getUserNoListRequest(data) {
data
})
}
+
+// 修改电子钥匙名称
+export function updateKeyNameRequest(data) {
+ return request({
+ url: '/key/modifyKeyNameForAdmin',
+ method: 'POST',
+ data
+ })
+}
+
+// 修改电子钥匙有效期
+export function updateKeyDateRequest(data) {
+ return request({
+ url: '/key/updateKeyDate',
+ method: 'POST',
+ data
+ })
+}
+
+// 获取电子钥匙详情
+export function getKeyRequest(data) {
+ return request({
+ url: '/key/detail',
+ method: 'POST',
+ data
+ })
+}
diff --git a/api/keyboardPwd.js b/api/keyboardPwd.js
index 59afe24..cf869c0 100644
--- a/api/keyboardPwd.js
+++ b/api/keyboardPwd.js
@@ -37,3 +37,30 @@ export function deletePsaawordRequest(data) {
data
})
}
+
+// 创建自定义密码
+export function addCustomPasswordRequest(data) {
+ return request({
+ url: '/keyboardPwd/add',
+ method: 'POST',
+ data
+ })
+}
+
+// 更新密码
+export function updatePasswordRequest(data) {
+ return request({
+ url: '/keyboardPwd/update',
+ method: 'POST',
+ data
+ })
+}
+
+// 获取密码详情
+export function getPasswordRequest(data) {
+ return request({
+ url: '/keyboardPwd/detail',
+ method: 'POST',
+ data
+ })
+}
diff --git a/api/palmVein.js b/api/palmVein.js
index 83e1327..0e64818 100644
--- a/api/palmVein.js
+++ b/api/palmVein.js
@@ -46,3 +46,21 @@ export function addPalmVeinRequest(data) {
data
})
}
+
+// 更新掌纹
+export function updatePalmVeinRequest(data) {
+ return request({
+ url: '/palmVein/update',
+ method: 'POST',
+ data
+ })
+}
+
+// 掌纹详情
+export function getPalmVeinRequest(data) {
+ return request({
+ url: '/palmVein/detail',
+ method: 'POST',
+ data
+ })
+}
diff --git a/api/remote.js b/api/remote.js
index fe2bc64..850c25e 100644
--- a/api/remote.js
+++ b/api/remote.js
@@ -46,3 +46,21 @@ export function addRemoteRequest(data) {
data
})
}
+
+// 更新远程
+export function updateRemoteRequest(data) {
+ return request({
+ url: '/remote/update',
+ method: 'POST',
+ data
+ })
+}
+
+// 远程详情
+export function getRemoteRequest(data) {
+ return request({
+ url: '/remote/detail',
+ method: 'POST',
+ data
+ })
+}
diff --git a/components/LockInput/LockInput.vue b/components/LockInput/LockInput.vue
index b68df6b..cf9d376 100644
--- a/components/LockInput/LockInput.vue
+++ b/components/LockInput/LockInput.vue
@@ -4,10 +4,11 @@
{{ title }}
@@ -20,7 +21,15 @@
props: {
title: String,
placeholder: String,
- value: String
+ value: String,
+ maxlength: {
+ type: Number,
+ default: 50
+ },
+ type: {
+ type: String,
+ default: 'text'
+ }
},
methods: {
changeInput(e) {
diff --git a/components/ModalInput/ModalInput.vue b/components/ModalInput/ModalInput.vue
new file mode 100644
index 0000000..bdbc21a
--- /dev/null
+++ b/components/ModalInput/ModalInput.vue
@@ -0,0 +1,76 @@
+
+
+
+
+ {{ title }}
+
+
+
+
+ 取消
+ 确定
+
+
+
+
+
+
+
+
+
diff --git a/pages.json b/pages.json
index aa45846..2232296 100644
--- a/pages.json
+++ b/pages.json
@@ -330,6 +330,13 @@
"navigationBarTitleText": "有效期",
"disableScroll": true
}
+ },
+ {
+ "path": "pages/temporaryDate/temporaryDate",
+ "style": {
+ "navigationBarTitleText": "修改有效期",
+ "disableScroll": true
+ }
}
],
"globalStyle": {
diff --git a/pages/adminDetail/adminDetail.vue b/pages/adminDetail/adminDetail.vue
index d16d1c6..cc4e045 100644
--- a/pages/adminDetail/adminDetail.vue
+++ b/pages/adminDetail/adminDetail.vue
@@ -1,16 +1,26 @@
-
+ $refs.modalInput.open()">
姓名
- {{ info.keyName }}
+
+ {{ info.keyName }}
+
+
-
+
有效期
- 永久
-
- {{ timeFormat(info.startDate, 'yyyy-mm-dd h:M') }}
- {{ timeFormat(info.endDate, 'yyyy-mm-dd h:M') }}
+
+ 永久
+
+ {{ 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') }}
+
+
@@ -25,11 +35,29 @@
发送时间
{{ timeFormat(info.sendDate, 'yyyy-mm-dd h:M') }}
+
+ 仅管理自己创建的用户
+
+
操作记录
删除
+
{
+ if (!name) {
+ uni.showToast({
+ title: '请输入姓名',
+ icon: 'none'
+ })
+ return
+ }
+ if (pending.value) return
+ pending.value = true
+ const { code, message } = await updateKeyNameRequest({
+ lockId: $bluetooth.currentLockInfo.lockId,
+ keyId: info.value.keyId,
+ keyNameForAdmin: name
+ })
+ pending.value = false
+ if (code === 0) {
+ modalInput.value.close()
+ eventChannel.emit('refresherList', {})
+ info.value.keyName = name
+ uni.showToast({
+ title: '更新成功',
+ icon: 'none'
+ })
+ } else {
+ uni.showToast({
+ title: message,
+ icon: 'none'
+ })
+ }
+ }
+
onLoad(options => {
if (options.info) {
info.value = JSON.parse(options.info)
@@ -73,6 +144,59 @@
}
})
+ const changeManageSelf = async () => {
+ if (pending.value) return
+ pending.value = true
+ uni.showLoading({
+ title: '更新中'
+ })
+ const { code, message } = await updateKeyDateRequest({
+ lockId: $bluetooth.currentLockInfo.lockId,
+ keyId: info.value.keyId,
+ keyType: info.value.keyType,
+ startDate: info.value.startDate,
+ endDate: info.value.endDate,
+ isOnlyManageSelf: info.value.isOnlyManageSelf === 1 ? 0 : 1
+ })
+ pending.value = false
+ uni.hideLoading()
+ if (code === 0) {
+ info.value.isOnlyManageSelf = info.value.isOnlyManageSelf === 1 ? 0 : 1
+ eventChannel.emit('refresherList', {})
+ uni.showToast({
+ title: '更新成功',
+ icon: 'none'
+ })
+ } else {
+ uni.showToast({
+ title: message,
+ icon: 'none'
+ })
+ }
+ }
+
+ const updateTime = () => {
+ $basic.routeJump({
+ name: 'temporaryDate',
+ params: {
+ info: JSON.stringify({ ...info.value, type: 'key' })
+ },
+ events: {
+ refresh() {
+ eventChannel.emit('refresherList', {})
+ getKeyRequest({
+ keyId: info.value.keyId
+ }).then(res => {
+ info.value = {
+ ...res.data,
+ keyId: info.value.keyId
+ }
+ })
+ }
+ }
+ })
+ }
+
const toRecordList = async () => {
$basic.routeJump({
name: 'typeRecordList',
diff --git a/pages/bindCard/bindCard.vue b/pages/bindCard/bindCard.vue
index f80b393..cace36a 100644
--- a/pages/bindCard/bindCard.vue
+++ b/pages/bindCard/bindCard.vue
@@ -59,6 +59,8 @@
cardUserNo: String(data.cardNumber),
cardType: params.cardType,
addType: 1,
+ startTime: params.startDate,
+ endTime: params.endDate,
weekDay: params.weekDays,
cardRight: params.isAdmin,
isCoerced: params.isForce === 1 ? 2 : 1
diff --git a/pages/bindFace/bindFace.vue b/pages/bindFace/bindFace.vue
index 08d3322..cd25ba4 100644
--- a/pages/bindFace/bindFace.vue
+++ b/pages/bindFace/bindFace.vue
@@ -53,13 +53,15 @@
lockId: $bluetooth.currentLockInfo.lockId,
startDate: params.value.startDate,
endDate: params.value.endDate,
+ startTime: params.value.startDate,
+ endTime: params.value.endDate,
faceName: params.value.faceName,
faceNumber: String(data.faceNumber),
faceUserNo: String(data.faceNumber),
faceType: params.value.faceType,
addType: 1,
weekDay: params.value.weekDays,
- fingerRight: params.value.isAdmin,
+ faceRight: params.value.isAdmin,
isCoerced: params.value.isForce === 1 ? 2 : 1
})
if (code === 0) {
diff --git a/pages/bindFingerprint/bindFingerprint.vue b/pages/bindFingerprint/bindFingerprint.vue
index 317cc3a..fb20e38 100644
--- a/pages/bindFingerprint/bindFingerprint.vue
+++ b/pages/bindFingerprint/bindFingerprint.vue
@@ -58,6 +58,8 @@
startDate: params.startDate,
endDate: params.endDate,
weekDay: params.weekDays,
+ startTime: params.startDate,
+ endTime: params.endDate,
fingerprintName: params.fingerprintName,
fingerprintNumber: String(data.fingerprintNumber),
fingerprintUserNo: String(data.fingerprintNumber),
diff --git a/pages/bindPalmVein/bindPalmVein.vue b/pages/bindPalmVein/bindPalmVein.vue
index e2da53e..d272254 100644
--- a/pages/bindPalmVein/bindPalmVein.vue
+++ b/pages/bindPalmVein/bindPalmVein.vue
@@ -51,6 +51,8 @@
lockId: $bluetooth.currentLockInfo.lockId,
startDate: params.startDate,
endDate: params.endDate,
+ startTime: params.startDate,
+ endTime: params.endDate,
palmVeinName: params.palmVeinName,
palmVeinNumber: String(data.palmVeinNumber),
palmVeinUserNo: String(data.palmVeinNumber),
diff --git a/pages/bindRemote/bindRemote.vue b/pages/bindRemote/bindRemote.vue
index 0fc4009..3e9c442 100644
--- a/pages/bindRemote/bindRemote.vue
+++ b/pages/bindRemote/bindRemote.vue
@@ -55,6 +55,8 @@
startDate: params.startDate,
endDate: params.endDate,
remoteName: params.remoteName,
+ startTime: params.startDate,
+ endTime: params.endDate,
remoteNumber: String(data.remoteNumber),
remoteUserNo: String(data.remoteNumber),
remoteType: params.remoteType,
diff --git a/pages/cardDetail/cardDetail.vue b/pages/cardDetail/cardDetail.vue
index f8038c1..e45fe34 100644
--- a/pages/cardDetail/cardDetail.vue
+++ b/pages/cardDetail/cardDetail.vue
@@ -5,30 +5,44 @@
卡号
{{ info.cardNumber }}
-
+ $refs.modalInput.open()">
姓名
- {{ info.cardName }}
+
+ {{ info.cardName }}
+
+
-
+
有效期
- 永久
-
- {{ 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') }}
+
+ 永久
+
+ {{ 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) }}
+
+ {{
+ $lock.convertWeekDaysToChineseString(info.weekDay)
+ }}
+
+
-
+
有效时间
-
- {{ timeFormat(info.startDate, 'h:M') }} - {{ timeFormat(info.endDate, 'h:M') }}
+
+
+ {{ timeFormat(info.startDate, 'h:M') }} - {{ timeFormat(info.endDate, 'h:M') }}
+
+
@@ -39,11 +53,39 @@
添加时间
{{ timeFormat(info.createDate, 'yyyy-mm-dd h:M') }}
+
+ 胁迫卡
+
+
+
+ 是否为管理员
+
+
操作记录
删除
+
@@ -54,19 +96,27 @@
import { timeFormat } from 'uview-plus'
import { useLockStore } from '@/stores/lock'
import { useBasicStore } from '@/stores/basic'
+ import { getCardRequest, updateCardRequest } from '@/api/card'
+ import { useBluetoothStore } from '@/stores/bluetooth'
+ import { useUserStore } from '@/stores/user'
const instance = getCurrentInstance().proxy
const eventChannel = instance.getOpenerEventChannel()
const $lock = useLockStore()
const $basic = useBasicStore()
+ const $bluetooth = useBluetoothStore()
+ const $user = useUserStore()
const info = ref(null)
+ const modalInput = ref(null)
+
+ const pending = ref(false)
+
onLoad(options => {
if (options.info) {
info.value = JSON.parse(options.info)
- console.log(info.value)
}
})
@@ -81,6 +131,121 @@
})
}
+ const disabled = () => {
+ uni.showToast({
+ title: '暂不支持修改',
+ icon: 'none'
+ })
+ }
+
+ const updateTime = () => {
+ $basic.routeJump({
+ name: info.value.cardType === 1 || info.value.cardType === 2 ? 'temporaryDate' : 'cycleDate',
+ params: {
+ info: JSON.stringify({ ...info.value, type: 'card' })
+ },
+ events: {
+ refresh() {
+ eventChannel.emit('refresherList', {})
+ getCardRequest({
+ cardId: info.value.cardId
+ }).then(res => {
+ info.value = res.data
+ })
+ }
+ }
+ })
+ }
+
+ const changeName = async name => {
+ if (!name) {
+ uni.showToast({
+ title: '请输入姓名',
+ icon: 'none'
+ })
+ return
+ }
+ if (pending.value) return
+ pending.value = true
+ const { code, message } = await updateCardRequest({
+ lockId: $bluetooth.currentLockInfo.lockId,
+ cardId: info.value.cardId,
+ cardType: info.value.cardType,
+ cardName: name,
+ changeType: 1
+ })
+ pending.value = false
+ if (code === 0) {
+ modalInput.value.close()
+ eventChannel.emit('refresherList', {})
+ info.value.cardName = name
+ uni.showToast({
+ title: '更新成功',
+ icon: 'none'
+ })
+ } else {
+ uni.showToast({
+ title: message,
+ icon: 'none'
+ })
+ }
+ }
+
+ const changeCoerced = async () => {
+ if (pending.value) return
+ pending.value = true
+ uni.showLoading({
+ title: '更新中'
+ })
+ const { code } = await $bluetooth.registerAuthentication({
+ type: 'card',
+ operate: 1,
+ isAdmin: info.value.isAdmin,
+ isForce: info.value.isCoerced === 2 ? 0 : 1,
+ isRound: info.value.cardType === 4 ? 1 : 0,
+ weekDays: info.value.weekDay,
+ no: info.value.cardNumber,
+ userCountLimit: 0xffff,
+ keyId: $bluetooth.keyId.toString(),
+ uid: $user.userInfo.uid.toString(),
+ startDate: info.value.startDate,
+ endDate: info.value.endDate,
+ startTime: info.value.cardType === 4 ? timeFormat(info.value.startDate, 'h:M') : '00:00',
+ endTime: info.value.cardType === 4 ? timeFormat(info.value.endDate, 'h:M') : '00:00'
+ })
+ if (code === 0) {
+ const { code, message } = await updateCardRequest({
+ lockId: $bluetooth.currentLockInfo.lockId,
+ cardId: info.value.cardId,
+ cardType: info.value.cardType,
+ isCoerced: info.value.isCoerced === 2 ? 1 : 2,
+ changeType: 1
+ })
+ pending.value = false
+ uni.hideLoading()
+ if (code === 0) {
+ info.value.isCoerced = info.value.isCoerced === 2 ? 1 : 2
+ eventChannel.emit('refresherList', {})
+ uni.showToast({
+ title: '更新成功',
+ icon: 'none'
+ })
+ } else {
+ uni.showToast({
+ title: message,
+ icon: 'none'
+ })
+ }
+ } else {
+ pending.value = false
+ uni.hideLoading()
+ uni.showToast({
+ title: '操作失败,请重试',
+ icon: 'none'
+ })
+ }
+ }
+
const deletePassword = async () => {
eventChannel.emit('delete', {})
}
diff --git a/pages/cardList/cardList.vue b/pages/cardList/cardList.vue
index a6ab2f5..d6a8af2 100644
--- a/pages/cardList/cardList.vue
+++ b/pages/cardList/cardList.vue
@@ -353,6 +353,12 @@
events: {
delete() {
deleteItem({ ...item, back: true })
+ },
+ refresherList() {
+ pageNo.value = 1
+ getList({
+ pageNo: pageNo.value
+ })
}
}
})
diff --git a/pages/createAdmin/createAdmin.vue b/pages/createAdmin/createAdmin.vue
index e6b594b..ba08013 100644
--- a/pages/createAdmin/createAdmin.vue
+++ b/pages/createAdmin/createAdmin.vue
@@ -196,7 +196,7 @@
return
}
- if (type === 'temporary' && temporaryStartTime.value > temporaryEndTime.value) {
+ if (type === 'temporary' && temporaryStartTime.value >= temporaryEndTime.value) {
uni.showToast({
title: '失效时间要大于生效时间',
icon: 'none'
diff --git a/pages/createCard/createCard.vue b/pages/createCard/createCard.vue
index b1ad0cc..8bef323 100644
--- a/pages/createCard/createCard.vue
+++ b/pages/createCard/createCard.vue
@@ -228,7 +228,7 @@
return
}
- if (type === 'temporary' && temporaryStartTime.value > temporaryEndTime.value) {
+ if (type === 'temporary' && temporaryStartTime.value >= temporaryEndTime.value) {
uni.showToast({
title: '失效时间要大于生效时间',
icon: 'none'
diff --git a/pages/createFace/createFace.vue b/pages/createFace/createFace.vue
index 7f9427d..91b57b5 100644
--- a/pages/createFace/createFace.vue
+++ b/pages/createFace/createFace.vue
@@ -200,7 +200,7 @@
return
}
- if (type === 'temporary' && temporaryStartTime.value > temporaryEndTime.value) {
+ if (type === 'temporary' && temporaryStartTime.value >= temporaryEndTime.value) {
uni.showToast({
title: '失效时间要大于生效时间',
icon: 'none'
diff --git a/pages/createFingerprint/createFingerprint.vue b/pages/createFingerprint/createFingerprint.vue
index 1122f1a..d96abe0 100644
--- a/pages/createFingerprint/createFingerprint.vue
+++ b/pages/createFingerprint/createFingerprint.vue
@@ -228,7 +228,7 @@
return
}
- if (type === 'temporary' && temporaryStartTime.value > temporaryEndTime.value) {
+ if (type === 'temporary' && temporaryStartTime.value >= temporaryEndTime.value) {
uni.showToast({
title: '失效时间要大于生效时间',
icon: 'none'
diff --git a/pages/createKey/createKey.vue b/pages/createKey/createKey.vue
index 8df68b7..909fcac 100644
--- a/pages/createKey/createKey.vue
+++ b/pages/createKey/createKey.vue
@@ -5,7 +5,7 @@
:list="tabs"
lineWidth="40rpx"
lineHeight="5rpx"
- :current="currnetIndex"
+ :current="current"
lineColor="#63b8af"
@click="clickTab"
:inactiveStyle="{ color: '#a3a3a3', fontSize: '32rpx', fontWeight: 'bold' }"
@@ -19,7 +19,7 @@
:list="tabs"
:autoplay="false"
:circular="true"
- :current="currnetIndex"
+ :current="current"
@change="changeSwiper"
>
@@ -27,13 +27,13 @@
:value="permanentAccount"
title="接收者"
placeholder="请输入手机号或邮箱"
- @change-input="changePermanentAccountInput"
+ @change-input="changeAccount('permanent', $event)"
>
接收者可使用此小程序开关锁
发送
-
+
发送
+
+
+
+ 单次钥匙有效期为1小时,只能使用一次
+ 发送
+
+
+
+
+
+
+
+ 接收者可以在有效期内的固定时间段里,不限次数使用
+ 发送
+
@@ -103,17 +138,30 @@
},
{
name: '限时'
+ },
+ {
+ name: '单次'
+ },
+ {
+ name: '循环'
}
],
permanentName: '',
permanentAccount: '',
temporaryName: '',
temporaryAccount: '',
- temporaryValidTime: Number(new Date()),
- temporaryInvalidTime: Number(new Date()),
+ startDate: Number(new Date()),
+ endDate: Number(new Date()),
+ singleName: '',
+ singleAccount: '',
+ cycleName: '',
+ cycleAccount: '',
+ cycleStartTime: null,
+ cycleEndTime: null,
+ weekDays: [],
minDate: Number(new Date()),
maxDate: Number(4133951940000),
- currnetIndex: 0,
+ current: 0,
deviceInfo: null,
pending: false
}
@@ -124,24 +172,24 @@
},
async onLoad() {
this.deviceInfo = await this.getDeviceInfo()
- // this.temporaryInvalidTime = this.setTime()
},
methods: {
...mapActions(useBasicStore, ['getDeviceInfo', 'backAndToast', 'getNetworkType']),
...mapActions(useLockStore, ['getKeyList', 'updateKeySearch']),
- setTime() {
- const now = new Date()
- now.setMinutes(0, 0, 0)
- now.setDate(now.getDate() + 3)
-
- return now.getTime()
+ changeCycle(data) {
+ this.cycleStartTime = data.startDate
+ this.cycleEndTime = data.endDate
+ this.weekDays = data.weekDays
},
async createKey(type, createUser = false) {
if (
(type === 'temporary' &&
!(test.email(this.temporaryAccount) || test.mobile(this.temporaryAccount))) ||
(type === 'permanent' &&
- !(test.email(this.permanentAccount) || test.mobile(this.permanentAccount)))
+ !(test.email(this.permanentAccount) || test.mobile(this.permanentAccount))) ||
+ (type === 'single' &&
+ !(test.email(this.singleAccount) || test.mobile(this.singleAccount))) ||
+ (type === 'cycle' && !(test.email(this.cycleAccount) || test.mobile(this.cycleAccount)))
) {
uni.showToast({
title: '请输入格式正确的手机号或邮箱',
@@ -150,7 +198,7 @@
return
}
- if (type === 'temporary' && this.temporaryValidTime >= this.temporaryInvalidTime) {
+ if (type === 'temporary' && this.startDate >= this.endDate) {
uni.showToast({
title: '失效时间必须大于生效时间',
icon: 'none'
@@ -158,6 +206,14 @@
return
}
+ if (type === 'cycle' && this.weekDays.length === 0) {
+ uni.showToast({
+ title: '请选择有效期',
+ icon: 'none'
+ })
+ return
+ }
+
const netWork = await this.getNetworkType()
if (!netWork) {
return
@@ -183,16 +239,31 @@
}
if (type === 'temporary') {
params.keyNameForAdmin = this.temporaryName
- params.endDate = this.temporaryInvalidTime.toString()
+ params.endDate = this.endDate.toString()
params.keyType = '2'
params.receiverUsername = this.temporaryAccount
- params.startDate = this.temporaryValidTime.toString()
- } else {
+ params.startDate = this.startDate.toString()
+ } else if (type === 'permanent') {
params.keyNameForAdmin = this.permanentName
params.startDate = new Date().getTime().toString()
params.endDate = '0'
params.keyType = '1'
params.receiverUsername = this.permanentAccount
+ } else if (type === 'single') {
+ params.keyNameForAdmin = this.singleName
+ params.startDate = new Date().getTime().toString()
+ params.endDate = '0'
+ params.keyType = '3'
+ params.receiverUsername = this.singleAccount
+ } else if (type === 'cycle') {
+ params.keyNameForAdmin = this.cycleName
+ params.startDate = this.cycleStartTime
+ params.endDate = this.cycleEndTime
+ params.keyType = '4'
+ params.receiverUsername = this.cycleAccount
+ params.weekDays = this.weekDays
+ params.startTime = this.cycleStartTime
+ params.endTime = this.cycleEndTime
}
const { code, message } = await createKeyRequest(params)
if (code === 0) {
@@ -222,29 +293,39 @@
}
this.pending = false
},
- changePermanentAccountInput(e) {
- this.permanentAccount = e
+ changeAccount(type, e) {
+ if (type === 'permanent') {
+ this.permanentAccount = e
+ } else if (type === 'temporary') {
+ this.temporaryAccount = e
+ } else if (type === 'single') {
+ this.singleAccount = e
+ } else if (type === 'cycle') {
+ this.cycleAccount = e
+ }
},
- changePermanentNameInput(e) {
- this.permanentName = e
- },
- changeTemporaryNameInput(e) {
- this.temporaryName = e
- },
- changeTemporaryAccountInput(e) {
- this.temporaryAccount = e
+ changeName(type, e) {
+ if (type === 'permanent') {
+ this.permanentName = e
+ } else if (type === 'temporary') {
+ this.temporaryName = e
+ } else if (type === 'single') {
+ this.singleName = e
+ } else if (type === 'cycle') {
+ this.cycleName = e
+ }
},
changeTemporaryValidTime(e) {
- this.temporaryValidTime = e
+ this.startDate = e
},
changeTemporaryInvalidTime(e) {
- this.temporaryInvalidTime = e
+ this.endDate = e
},
clickTab(data) {
- this.currnetIndex = data.index
+ this.current = data.index
},
changeSwiper(e) {
- this.currnetIndex = e.detail.current
+ this.current = e.detail.current
}
}
}
diff --git a/pages/createPalmVein/createPalmVein.vue b/pages/createPalmVein/createPalmVein.vue
index 1717ca7..fa7e295 100644
--- a/pages/createPalmVein/createPalmVein.vue
+++ b/pages/createPalmVein/createPalmVein.vue
@@ -229,7 +229,7 @@
return
}
- if (type === 'temporary' && temporaryStartTime.value > temporaryEndTime.value) {
+ if (type === 'temporary' && temporaryStartTime.value >= temporaryEndTime.value) {
uni.showToast({
title: '失效时间要大于生效时间',
icon: 'none'
diff --git a/pages/createPassword/createPassword.vue b/pages/createPassword/createPassword.vue
index 0eb10a0..121dceb 100644
--- a/pages/createPassword/createPassword.vue
+++ b/pages/createPassword/createPassword.vue
@@ -5,7 +5,7 @@
:list="tabs"
lineWidth="40rpx"
lineHeight="5rpx"
- :current="currnetIndex"
+ :current="currentIndex"
lineColor="#63b8af"
@click="clickTab"
:inactiveStyle="{ color: '#a3a3a3', fontSize: '32rpx', fontWeight: 'bold' }"
@@ -19,7 +19,7 @@
:list="tabs"
:autoplay="false"
:circular="true"
- :current="currnetIndex"
+ :current="currentIndex"
@change="changeSwiper"
>
@@ -27,17 +27,17 @@
:value="permanentName"
title="姓名"
placeholder="请给密码命名"
- @change-input="changePermanentInput"
+ @change-input="changeName('permanent', $event)"
>
{{ text }}
获取密码
-
+
{{ text }}
获取密码
+
+
+ 密码有效期为6个小时,只能使用一次
+ 获取密码
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 手动输入6-9位数字作为密码。可在锁旁边通过手机蓝牙添加,也可通过网关远程添加
+
+ 获取密码
+
+
+
+
+
+ 有效日
+
+ {{ cycleOptions[0][defaultIndex].name }}
+
+
+
+
+
+
+
+ 生效时间
+
+ {{ hoursStart }}:00
+
+
+
+
+
+
+
+ 失效时间
+
+
+ {{ hoursEnd }}:00
+
+
+
+
+ {{ text }}
+ 获取密码
+
+
+
+
+ 清空密码当日23:59前有效
+
+ 清空内容1:当日0点前生成的所有密码(当日0点后生成的密码,不受清空密码影响,可继续使用)
+
+ 清空内容2:清空密码使用后,立即清除所有自定义密码(含使用过和未使用过的)
+ 如需彻底清除所有密码,请使用重置所有密码功能
+ 获取密码
+
+
+
+
-
diff --git a/pages/createRemote/createRemote.vue b/pages/createRemote/createRemote.vue
index 037ce89..90f6cdd 100644
--- a/pages/createRemote/createRemote.vue
+++ b/pages/createRemote/createRemote.vue
@@ -176,7 +176,7 @@
return
}
- if (type === 'temporary' && temporaryStartTime.value > temporaryEndTime.value) {
+ if (type === 'temporary' && temporaryStartTime.value >= temporaryEndTime.value) {
uni.showToast({
title: '失效时间要大于生效时间',
icon: 'none'
diff --git a/pages/cycleDate/cycleDate.vue b/pages/cycleDate/cycleDate.vue
index 4df14db..ea47fc0 100644
--- a/pages/cycleDate/cycleDate.vue
+++ b/pages/cycleDate/cycleDate.vue
@@ -137,10 +137,23 @@
import { timeFormat } from 'uview-plus'
import { computed, getCurrentInstance, ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
+ import { updateCardRequest } from '@/api/card'
+ import { useBluetoothStore } from '@/stores/bluetooth'
+ import { useUserStore } from '@/stores/user'
+ import { useBasicStore } from '@/stores/basic'
+ import { updateFingerprintRequest } from '@/api/fingerprint'
+ import { updateRemoteRequest } from '@/api/remote'
+ import { updatePalmVeinRequest } from '@/api/palmVein'
+ import { updateFaceRequest } from '@/api/face'
+ import { updateKeyDateRequest } from '@/api/key'
const instance = getCurrentInstance().proxy
const eventChannel = instance.getOpenerEventChannel()
+ const $bluetooth = useBluetoothStore()
+ const $user = useUserStore()
+ const $basic = useBasicStore()
+
const showStartDate = ref(false)
const showEndDate = ref(false)
const showStartTime = ref(false)
@@ -150,6 +163,8 @@
const endDate = ref(null)
const weekDays = ref([])
+ const info = ref(null)
+
const startTimeText = ref(null)
const endTimeText = ref(null)
@@ -158,6 +173,8 @@
const defaultStartDate = ref(0)
const defaultEndDate = ref(0)
+ const pending = ref(false)
+
const list = ['一', '二', '三', '四', '五', '六', '日']
const canSubmit = computed(() => {
@@ -172,16 +189,24 @@
onLoad(options => {
if (options.info) {
- const info = JSON.parse(options.info)
- if (info.startDate) {
- weekDays.value = info.weekDays
- startDate.value = info.startDate
- endDate.value = info.endDate
+ const data = JSON.parse(options.info)
+ info.value = data
+ if (info.value.type) {
+ uni.setNavigationBarTitle({
+ title: '修改有效期'
+ })
+ }
+ if (data.startDate) {
+ weekDays.value = data.weekDays || data.weekDay
+ startDate.value = data.startDate
+ endDate.value = data.endDate
- defaultStartDate.value = info.startDate
- defaultEndDate.value = info.endDate
- startTimeText.value = timeFormat(info.startDate, 'h:M')
- endTimeText.value = timeFormat(info.endDate, 'h:M')
+ defaultStartDate.value = data.startDate
+ defaultEndDate.value = data.endDate
+ startTimeText.value = timeFormat(data.startDate, 'h:M')
+ endTimeText.value = timeFormat(data.endDate, 'h:M')
+ defaultStartTime.value = timeFormat(data.startDate, 'h:M')
+ defaultEndTime.value = timeFormat(data.endDate, 'h:M')
} else {
defaultStartTime.value = timeFormat(new Date(), 'h:M')
defaultEndTime.value = timeFormat(new Date(), 'h:M')
@@ -204,7 +229,7 @@
return date1 - date2
}
- const save = () => {
+ const save = async () => {
if (!canSubmit.value) {
return
}
@@ -222,16 +247,156 @@
})
return
}
- const data = {
- startDate: updateTime(startDate.value, startTimeText.value),
- endDate: updateTime(endDate.value, endTimeText.value),
- weekDays: weekDays.value.sort()
- }
- uni.navigateBack({
- success() {
- eventChannel.emit('change', data)
+ if (!info.value.type) {
+ const data = {
+ startDate: updateTime(startDate.value, startTimeText.value),
+ endDate: updateTime(endDate.value, endTimeText.value),
+ weekDays: weekDays.value.sort()
}
- })
+ uni.navigateBack({
+ success() {
+ eventChannel.emit('change', data)
+ }
+ })
+ } else {
+ if (pending.value) {
+ return
+ }
+ pending.value = true
+ uni.showLoading({
+ title: '更新中'
+ })
+ if (info.value.type === 'key') {
+ const data = await updateKeyDateRequest({
+ lockId: $bluetooth.currentLockInfo.lockId,
+ keyId: info.value.keyId,
+ keyType: 4,
+ weekDays: weekDays.value.sort(),
+ startDate: updateTime(startDate.value, startTimeText.value),
+ endDate: updateTime(endDate.value, endTimeText.value),
+ startTime: updateTime(startDate.value, startTimeText.value),
+ endTime: updateTime(endDate.value, endTimeText.value)
+ })
+ uni.hideLoading()
+ pending.value = false
+ if (data.code === 0) {
+ eventChannel.emit('refresh', {})
+ $basic.backAndToast('更新成功')
+ uni.showToast({
+ title: '更新成功',
+ icon: 'none'
+ })
+ } else {
+ uni.showToast({
+ title: data.message,
+ icon: 'none'
+ })
+ }
+ } else {
+ const { code } = await $bluetooth.registerAuthentication({
+ type: info.value.type,
+ operate: 1,
+ isAdmin: info.value.type,
+ isForce: info.value.isForce,
+ isRound: 1,
+ weekDays: weekDays.value.sort(),
+ no: info.value[`${info.value.type}Number`],
+ userCountLimit: 0xffff,
+ keyId: $bluetooth.keyId.toString(),
+ uid: $user.userInfo.uid.toString(),
+ startDate: updateTime(startDate.value, startTimeText.value),
+ endDate: updateTime(endDate.value, endTimeText.value),
+ startTime: startTimeText.value,
+ endTime: endTimeText.value
+ })
+ if (code === 0) {
+ let data
+ if (info.value.type === 'card') {
+ data = await updateCardRequest({
+ lockId: $bluetooth.currentLockInfo.lockId,
+ cardId: info.value.cardId,
+ cardType: 4,
+ weekDay: weekDays.value.sort(),
+ startDate: updateTime(startDate.value, startTimeText.value),
+ endDate: updateTime(endDate.value, endTimeText.value),
+ startTime: updateTime(startDate.value, startTimeText.value),
+ endTime: updateTime(endDate.value, endTimeText.value),
+ changeType: 1
+ })
+ } else if (info.value.type === 'fingerprint') {
+ data = await updateFingerprintRequest({
+ lockId: $bluetooth.currentLockInfo.lockId,
+ fingerprintId: info.value.fingerprintId,
+ fingerprintType: 4,
+ weekDay: weekDays.value.sort(),
+ startDate: updateTime(startDate.value, startTimeText.value),
+ endDate: updateTime(endDate.value, endTimeText.value),
+ startTime: updateTime(startDate.value, startTimeText.value),
+ endTime: updateTime(endDate.value, endTimeText.value),
+ changeType: 1
+ })
+ } else if (info.value.type === 'remote') {
+ data = await updateRemoteRequest({
+ lockId: $bluetooth.currentLockInfo.lockId,
+ remoteId: info.value.remoteId,
+ remoteType: 4,
+ weekDay: weekDays.value.sort(),
+ startDate: updateTime(startDate.value, startTimeText.value),
+ endDate: updateTime(endDate.value, endTimeText.value),
+ startTime: updateTime(startDate.value, startTimeText.value),
+ endTime: updateTime(endDate.value, endTimeText.value),
+ changeType: 1
+ })
+ } else if (info.value.type === 'face') {
+ data = await updateFaceRequest({
+ lockId: $bluetooth.currentLockInfo.lockId,
+ faceId: info.value.faceId,
+ faceType: 4,
+ weekDay: weekDays.value.sort(),
+ startDate: updateTime(startDate.value, startTimeText.value),
+ endDate: updateTime(endDate.value, endTimeText.value),
+ startTime: updateTime(startDate.value, startTimeText.value),
+ endTime: updateTime(endDate.value, endTimeText.value),
+ changeType: 1
+ })
+ } else if (info.value.type === 'palmVein') {
+ data = await updatePalmVeinRequest({
+ lockId: $bluetooth.currentLockInfo.lockId,
+ palmVeinId: info.value.palmVeinId,
+ palmVeinType: 4,
+ weekDay: weekDays.value.sort(),
+ startDate: updateTime(startDate.value, startTimeText.value),
+ endDate: updateTime(endDate.value, endTimeText.value),
+ startTime: updateTime(startDate.value, startTimeText.value),
+ endTime: updateTime(endDate.value, endTimeText.value),
+ changeType: 1
+ })
+ }
+ pending.value = false
+ uni.hideLoading()
+ if (data.code === 0) {
+ eventChannel.emit('refresh', {})
+ $basic.backAndToast('更新成功')
+ uni.showToast({
+ title: '更新成功',
+ icon: 'none'
+ })
+ } else {
+ uni.showToast({
+ title: data.message,
+ icon: 'none'
+ })
+ }
+ } else {
+ pending.value = false
+ uni.hideLoading()
+ uni.showToast({
+ title: '操作失败,请重试',
+ icon: 'none'
+ })
+ }
+ }
+ }
}
const updateTime = (datetime, timeStr) => {
diff --git a/pages/faceDetail/faceDetail.vue b/pages/faceDetail/faceDetail.vue
index df2e70c..f134e6f 100644
--- a/pages/faceDetail/faceDetail.vue
+++ b/pages/faceDetail/faceDetail.vue
@@ -5,30 +5,44 @@
人脸号
{{ info.faceNumber }}
-
+ $refs.modalInput.open()">
姓名
- {{ info.faceName }}
+
+ {{ info.faceName }}
+
+
-
+
有效期
- 永久
-
- {{ 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') }}
+
+ 永久
+
+ {{ 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) }}
+
+ {{
+ $lock.convertWeekDaysToChineseString(info.weekDay)
+ }}
+
+
-
+
有效时间
-
- {{ timeFormat(info.startDate, 'h:M') }} - {{ timeFormat(info.endDate, 'h:M') }}
+
+
+ {{ timeFormat(info.startDate, 'h:M') }} - {{ timeFormat(info.endDate, 'h:M') }}
+
+
@@ -39,11 +53,30 @@
添加时间
{{ timeFormat(info.createDate, 'yyyy-mm-dd h:M') }}
+
+
+ 是否为管理员
+
+
操作记录
删除
+
@@ -54,15 +87,83 @@
import { timeFormat } from 'uview-plus'
import { useLockStore } from '@/stores/lock'
import { useBasicStore } from '@/stores/basic'
+ import { useBluetoothStore } from '@/stores/bluetooth'
+ import { getFaceRequest, updateFaceRequest } from '@/api/face'
const instance = getCurrentInstance().proxy
const eventChannel = instance.getOpenerEventChannel()
const $lock = useLockStore()
const $basic = useBasicStore()
+ const $bluetooth = useBluetoothStore()
const info = ref(null)
+ const modalInput = ref(null)
+
+ const pending = ref(false)
+
+ const changeName = async name => {
+ if (!name) {
+ uni.showToast({
+ title: '请输入姓名',
+ icon: 'none'
+ })
+ return
+ }
+ if (pending.value) return
+ pending.value = true
+ const { code, message } = await updateFaceRequest({
+ lockId: $bluetooth.currentLockInfo.lockId,
+ faceId: info.value.faceId,
+ faceType: info.value.faceType,
+ faceName: name,
+ changeType: 1
+ })
+ pending.value = false
+ if (code === 0) {
+ modalInput.value.close()
+ eventChannel.emit('refresherList', {})
+ info.value.faceName = name
+ uni.showToast({
+ title: '更新成功',
+ icon: 'none'
+ })
+ } else {
+ uni.showToast({
+ title: message,
+ icon: 'none'
+ })
+ }
+ }
+
+ const updateTime = () => {
+ $basic.routeJump({
+ name: info.value.faceType === 1 || info.value.faceType === 2 ? 'temporaryDate' : 'cycleDate',
+ params: {
+ info: JSON.stringify({ ...info.value, type: 'face' })
+ },
+ events: {
+ refresh() {
+ eventChannel.emit('refresherList', {})
+ getFaceRequest({
+ lockId: $bluetooth.currentLockInfo.lockId,
+ faceId: info.value.faceId
+ }).then(res => {
+ info.value = res.data
+ })
+ }
+ }
+ })
+ }
+
+ const disabled = () => {
+ uni.showToast({
+ title: '暂不支持修改',
+ icon: 'none'
+ })
+ }
+
onLoad(options => {
if (options.info) {
info.value = JSON.parse(options.info)
diff --git a/pages/faceList/faceList.vue b/pages/faceList/faceList.vue
index fa65ee1..fd466a4 100644
--- a/pages/faceList/faceList.vue
+++ b/pages/faceList/faceList.vue
@@ -354,6 +354,12 @@
events: {
delete() {
deleteItem({ ...item, back: true })
+ },
+ refresherList() {
+ pageNo.value = 1
+ getList({
+ pageNo: pageNo.value
+ })
}
}
})
diff --git a/pages/fingerprintDetail/fingerprintDetail.vue b/pages/fingerprintDetail/fingerprintDetail.vue
index 4e3ad61..dd98602 100644
--- a/pages/fingerprintDetail/fingerprintDetail.vue
+++ b/pages/fingerprintDetail/fingerprintDetail.vue
@@ -5,30 +5,54 @@
指纹号
{{ info.fingerprintNumber }}
-
+ $refs.modalInput.open()">
姓名
- {{ info.fingerprintName }}
+
+ {{ 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') }}
+
+ 永久
+
+ {{ 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) }}
+
+ {{
+ $lock.convertWeekDaysToChineseString(info.weekDay)
+ }}
+
+
-
+
有效时间
-
- {{ timeFormat(info.startDate, 'h:M') }} - {{ timeFormat(info.endDate, 'h:M') }}
+
+
+ {{ timeFormat(info.startDate, 'h:M') }} - {{ timeFormat(info.endDate, 'h:M') }}
+
+
@@ -39,11 +63,40 @@
添加时间
{{ timeFormat(info.createDate, 'yyyy-mm-dd h:M') }}
+
+
+ 胁迫指纹
+
+
+
+ 是否为管理员
+
+
操作记录
删除
+
@@ -54,6 +107,9 @@
import { timeFormat } from 'uview-plus'
import { useLockStore } from '@/stores/lock'
import { useBasicStore } from '@/stores/basic'
+ import { useBluetoothStore } from '@/stores/bluetooth'
+ import { useUserStore } from '@/stores/user'
+ import { getFingerprintRequest, updateFingerprintRequest } from '@/api/fingerprint'
const $basic = useBasicStore()
@@ -61,9 +117,134 @@
const eventChannel = instance.getOpenerEventChannel()
const $lock = useLockStore()
+ const $user = useUserStore()
+ const $bluetooth = useBluetoothStore()
const info = ref(null)
+ const modalInput = ref(null)
+
+ const pending = ref(false)
+
+ const disabled = () => {
+ uni.showToast({
+ title: '暂不支持修改',
+ icon: 'none'
+ })
+ }
+
+ const changeCoerced = async () => {
+ if (pending.value) return
+ pending.value = true
+ uni.showLoading({
+ title: '更新中'
+ })
+ const { code } = await $bluetooth.registerAuthentication({
+ type: 'fingerprint',
+ operate: 1,
+ isAdmin: info.value.isAdmin,
+ isForce: info.value.isCoerced === 2 ? 0 : 1,
+ isRound: info.value.fingerprintType === 4 ? 1 : 0,
+ weekDays: info.value.weekDay,
+ no: info.value.fingerprintNumber,
+ userCountLimit: 0xffff,
+ keyId: $bluetooth.keyId.toString(),
+ uid: $user.userInfo.uid.toString(),
+ startDate: info.value.startDate,
+ endDate: info.value.endDate,
+ startTime:
+ info.value.fingerprintType === 4 ? timeFormat(info.value.startDate, 'h:M') : '00:00',
+ endTime: info.value.fingerprintType === 4 ? timeFormat(info.value.endDate, 'h:M') : '00:00'
+ })
+ if (code === 0) {
+ const { code, message } = await updateFingerprintRequest({
+ lockId: $bluetooth.currentLockInfo.lockId,
+ fingerprintId: info.value.fingerprintId,
+ fingerprintType: info.value.fingerprintType,
+ isCoerced: info.value.isCoerced === 2 ? 1 : 2,
+ changeType: 1
+ })
+ pending.value = false
+ uni.hideLoading()
+ if (code === 0) {
+ info.value.isCoerced = info.value.isCoerced === 2 ? 1 : 2
+ eventChannel.emit('refresherList', {})
+ uni.showToast({
+ title: '更新成功',
+ icon: 'none'
+ })
+ } else {
+ uni.showToast({
+ title: message,
+ icon: 'none'
+ })
+ }
+ } else {
+ pending.value = false
+ uni.hideLoading()
+ uni.showToast({
+ title: '操作失败,请重试',
+ icon: 'none'
+ })
+ }
+ }
+
+ const changeName = async name => {
+ if (!name) {
+ uni.showToast({
+ title: '请输入姓名',
+ icon: 'none'
+ })
+ return
+ }
+ if (pending.value) return
+ pending.value = true
+ const { code, message } = await updateFingerprintRequest({
+ lockId: $bluetooth.currentLockInfo.lockId,
+ fingerprintId: info.value.fingerprintId,
+ fingerprintType: info.value.fingerprintType,
+ fingerprintName: name,
+ changeType: 1
+ })
+ pending.value = false
+ if (code === 0) {
+ modalInput.value.close()
+ eventChannel.emit('refresherList', {})
+ info.value.fingerprintName = name
+ uni.showToast({
+ title: '更新成功',
+ icon: 'none'
+ })
+ } else {
+ uni.showToast({
+ title: message,
+ icon: 'none'
+ })
+ }
+ }
+
+ const updateTime = () => {
+ $basic.routeJump({
+ name:
+ info.value.fingerprintType === 1 || info.value.fingerprintType === 2
+ ? 'temporaryDate'
+ : 'cycleDate',
+ params: {
+ info: JSON.stringify({ ...info.value, type: 'fingerprint' })
+ },
+ events: {
+ refresh() {
+ eventChannel.emit('refresherList', {})
+ getFingerprintRequest({
+ fingerprintId: info.value.fingerprintId
+ }).then(res => {
+ info.value = res.data
+ })
+ }
+ }
+ })
+ }
+
const toRecordList = async () => {
$basic.routeJump({
name: 'typeRecordList',
diff --git a/pages/fingerprintList/fingerprintList.vue b/pages/fingerprintList/fingerprintList.vue
index df9a781..2c4b910 100644
--- a/pages/fingerprintList/fingerprintList.vue
+++ b/pages/fingerprintList/fingerprintList.vue
@@ -353,6 +353,12 @@
events: {
delete() {
deleteItem({ ...item, back: true })
+ },
+ refresherList() {
+ pageNo.value = 1
+ getList({
+ pageNo: pageNo.value
+ })
}
}
})
diff --git a/pages/keyDetail/keyDetail.vue b/pages/keyDetail/keyDetail.vue
index 131ceae..7b8e3da 100644
--- a/pages/keyDetail/keyDetail.vue
+++ b/pages/keyDetail/keyDetail.vue
@@ -1,49 +1,89 @@
-
+ $refs.modalInput.open()">
姓名
- {{ currentKeyInfo.keyName }}
+
+ {{ $lock.currentKeyInfo.keyName }}
+
+
-
+
有效期
- 永久
- 单次
-
- {{ timeFormat(currentKeyInfo.startDate, 'yyyy-mm-dd') }}
- {{ timeFormat(currentKeyInfo.endDate, 'yyyy-mm-dd') }}
-
-
- {{
- timeFormat(currentKeyInfo.startDate, 'yyyy-mm-dd h:M')
- }}
- {{ timeFormat(currentKeyInfo.endDate, 'yyyy-mm-dd h:M') }}
+
+ 永久
+ 单次
+
+ {{
+ timeFormat($lock.currentKeyInfo.startDate, 'yyyy-mm-dd')
+ }}
+ {{
+ timeFormat($lock.currentKeyInfo.endDate, 'yyyy-mm-dd')
+ }}
+
+
+ {{
+ timeFormat($lock.currentKeyInfo.startDate, 'yyyy-mm-dd h:M')
+ }}
+ {{
+ timeFormat($lock.currentKeyInfo.endDate, 'yyyy-mm-dd h:M')
+ }}
+
+
-
+
有效日
- {{
- convertWeekDaysToChineseString(currentKeyInfo.weekDays)
- }}
+
+ {{
+ $lock.convertWeekDaysToChineseString($lock.currentKeyInfo.weekDays)
+ }}
+
+
-
+
有效时间
-
- {{ timeFormat(currentKeyInfo.startDate, 'h:M') }}~{{
- timeFormat(currentKeyInfo.endDate, 'h:M')
- }}
+
+
+ {{ timeFormat($lock.currentKeyInfo.startDate, 'h:M') }}~{{
+ timeFormat($lock.currentKeyInfo.endDate, 'h:M')
+ }}
+
接收者
- {{ currentKeyInfo.username }}
+ {{ $lock.currentKeyInfo.username }}
发送人
- {{ currentKeyInfo.senderUsername }}
+ {{ $lock.currentKeyInfo.senderUsername }}
发送时间
- {{ timeFormat(currentKeyInfo.sendDate, 'yyyy-mm-dd h:M') }}
+ {{
+ timeFormat($lock.currentKeyInfo.sendDate, 'yyyy-mm-dd h:M')
+ }}
+
+
+ 仅管理自己创建的用户
+
操作记录
@@ -65,116 +105,231 @@
+
-
diff --git a/pages/palmVeinDetail/palmVeinDetail.vue b/pages/palmVeinDetail/palmVeinDetail.vue
index e68de89..e3f3332 100644
--- a/pages/palmVeinDetail/palmVeinDetail.vue
+++ b/pages/palmVeinDetail/palmVeinDetail.vue
@@ -5,30 +5,54 @@
掌静脉号
{{ info.palmVeinNumber }}
-
+ $refs.modalInput.open()">
姓名
- {{ info.palmVeinName }}
+
+ {{ info.palmVeinName }}
+
+
-
+
有效期
- 永久
-
- {{ 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') }}
+
+ 永久
+
+ {{ 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) }}
+
+ {{
+ $lock.convertWeekDaysToChineseString(info.weekDay)
+ }}
+
+
-
+
有效时间
-
- {{ timeFormat(info.startDate, 'h:M') }} - {{ timeFormat(info.endDate, 'h:M') }}
+
+
+ {{ timeFormat(info.startDate, 'h:M') }} - {{ timeFormat(info.endDate, 'h:M') }}
+
+
@@ -39,11 +63,40 @@
添加时间
{{ timeFormat(info.createDate, 'yyyy-mm-dd h:M') }}
+
+
+ 胁迫掌静脉
+
+
+
+ 是否为管理员
+
+
操作记录
删除
+
@@ -54,15 +107,142 @@
import { timeFormat } from 'uview-plus'
import { useLockStore } from '@/stores/lock'
import { useBasicStore } from '@/stores/basic'
+ import { useBluetoothStore } from '@/stores/bluetooth'
+ import { useUserStore } from '@/stores/user'
+ import { getPalmVeinRequest, updatePalmVeinRequest } from '@/api/palmVein'
const instance = getCurrentInstance().proxy
const eventChannel = instance.getOpenerEventChannel()
const $lock = useLockStore()
const $basic = useBasicStore()
+ const $user = useUserStore()
+ const $bluetooth = useBluetoothStore()
const info = ref(null)
+ const modalInput = ref(null)
+
+ const pending = ref(false)
+
+ const changeCoerced = async () => {
+ if (pending.value) return
+ pending.value = true
+ uni.showLoading({
+ title: '更新中'
+ })
+ const { code } = await $bluetooth.registerAuthentication({
+ type: 'palmVein',
+ operate: 1,
+ isAdmin: info.value.isAdmin,
+ isForce: info.value.isCoerced === 2 ? 0 : 1,
+ isRound: info.value.palmVeinType === 4 ? 1 : 0,
+ weekDays: info.value.weekDay,
+ no: info.value.palmVeinNumber,
+ userCountLimit: 0xffff,
+ keyId: $bluetooth.keyId.toString(),
+ uid: $user.userInfo.uid.toString(),
+ startDate: info.value.startDate,
+ endDate: info.value.endDate,
+ startTime: info.value.palmVeinType === 4 ? timeFormat(info.value.startDate, 'h:M') : '00:00',
+ endTime: info.value.palmVeinType === 4 ? timeFormat(info.value.endDate, 'h:M') : '00:00'
+ })
+ if (code === 0) {
+ const { code, message } = await updatePalmVeinRequest({
+ lockId: $bluetooth.currentLockInfo.lockId,
+ palmVeinId: info.value.palmVeinId,
+ palmVeinType: info.value.palmVeinType,
+ isCoerced: info.value.isCoerced === 2 ? 1 : 2,
+ changeType: 1
+ })
+ pending.value = false
+ uni.hideLoading()
+ if (code === 0) {
+ info.value.isCoerced = info.value.isCoerced === 2 ? 1 : 2
+ eventChannel.emit('refresherList', {})
+ uni.showToast({
+ title: '更新成功',
+ icon: 'none'
+ })
+ } else {
+ uni.showToast({
+ title: message,
+ icon: 'none'
+ })
+ }
+ } else {
+ pending.value = false
+ uni.hideLoading()
+ uni.showToast({
+ title: '操作失败,请重试',
+ icon: 'none'
+ })
+ }
+ }
+
+ const changeName = async name => {
+ if (!name) {
+ uni.showToast({
+ title: '请输入姓名',
+ icon: 'none'
+ })
+ return
+ }
+ if (pending.value) return
+ pending.value = true
+ const { code, message } = await updatePalmVeinRequest({
+ lockId: $bluetooth.currentLockInfo.lockId,
+ palmVeinId: info.value.palmVeinId,
+ palmVeinType: info.value.palmVeinType,
+ palmVeinName: name,
+ changeType: 1
+ })
+ pending.value = false
+ if (code === 0) {
+ modalInput.value.close()
+ eventChannel.emit('refresherList', {})
+ info.value.palmVeinName = name
+ uni.showToast({
+ title: '更新成功',
+ icon: 'none'
+ })
+ } else {
+ uni.showToast({
+ title: message,
+ icon: 'none'
+ })
+ }
+ }
+
+ const updateTime = () => {
+ $basic.routeJump({
+ name:
+ info.value.palmVeinType === 1 || info.value.palmVeinType === 2
+ ? 'temporaryDate'
+ : 'cycleDate',
+ params: {
+ info: JSON.stringify({ ...info.value, type: 'palmVein' })
+ },
+ events: {
+ refresh() {
+ eventChannel.emit('refresherList', {})
+ getPalmVeinRequest({
+ palmVeinId: info.value.palmVeinId
+ }).then(res => {
+ info.value = res.data
+ })
+ }
+ }
+ })
+ }
+
+ const disabled = () => {
+ uni.showToast({
+ title: '暂不支持修改',
+ icon: 'none'
+ })
+ }
+
onLoad(options => {
if (options.info) {
info.value = JSON.parse(options.info)
diff --git a/pages/palmVeinList/palmVeinList.vue b/pages/palmVeinList/palmVeinList.vue
index 9f409f0..d7164fb 100644
--- a/pages/palmVeinList/palmVeinList.vue
+++ b/pages/palmVeinList/palmVeinList.vue
@@ -358,6 +358,12 @@
events: {
delete() {
deleteItem({ ...item, back: true })
+ },
+ refresherList() {
+ pageNo.value = 1
+ getList({
+ pageNo: pageNo.value
+ })
}
}
})
diff --git a/pages/passwordDetail/passwordDetail.vue b/pages/passwordDetail/passwordDetail.vue
index 734e9eb..b91af60 100644
--- a/pages/passwordDetail/passwordDetail.vue
+++ b/pages/passwordDetail/passwordDetail.vue
@@ -1,141 +1,360 @@
-
+
+ 密码号
+ {{ $lock.currentPasswordInfo.pwdUserNo }}
+
+ $lock.currentPasswordInfo.isCustom === 1 && $refs.modalPassword.open()"
+ >
密码
- {{ currentPasswordInfo.keyboardPwd }}
-
-
- 姓名
- {{ currentPasswordInfo.keyboardPwdName }}
-
-
- 有效期
- 永久
-
- {{
- timeFormat(currentPasswordInfo.startDate, 'yyyy-mm-dd h:M')
- }}
- {{
- timeFormat(currentPasswordInfo.endDate, 'yyyy-mm-dd h:M')
- }}
+
+ {{ $lock.currentPasswordInfo.keyboardPwd }}
+
-
- {{ currentPasswordInfo.timeText.slice(0, -3) }}
+
+ $refs.modalInput.open()">
+ 姓名
+
+ {{ $lock.currentPasswordInfo.keyboardPwdName }}
+
+
+
+
+ 有效期
+
+
+ 永久
+
+ {{
+ timeFormat($lock.currentPasswordInfo.startDate, 'yyyy-mm-dd h:M')
+ }}
+ {{
+ timeFormat($lock.currentPasswordInfo.endDate, 'yyyy-mm-dd h:M')
+ }}
+
+
+ {{ $lock.currentPasswordInfo.timeText.slice(0, -3) }}
+
+
+
发送人
- {{ currentPasswordInfo.senderUsername }}
+ {{ $lock.currentPasswordInfo.senderUsername }}
发送时间
{{
- timeFormat(currentPasswordInfo.sendDate, 'yyyy-mm-dd h:M')
+ timeFormat($lock.currentPasswordInfo.sendDate, 'yyyy-mm-dd h:M')
}}
+
+ 是否为管理员
+
+
操作记录
删除
+
+
-
diff --git a/stores/basic.js b/stores/basic.js
index c0b254d..c6b3f23 100644
--- a/stores/basic.js
+++ b/stores/basic.js
@@ -246,6 +246,11 @@ const pages = [
name: 'cycleDate',
path: '/pages/cycleDate/cycleDate',
tabBar: false
+ },
+ {
+ name: 'temporaryDate',
+ path: '/pages/temporaryDate/temporaryDate',
+ tabBar: false
}
]
diff --git a/stores/bluetooth.js b/stores/bluetooth.js
index fb3b814..1b1d313 100644
--- a/stores/bluetooth.js
+++ b/stores/bluetooth.js
@@ -336,9 +336,9 @@ export const useBluetoothStore = defineStore('ble', {
restoreCount: decrypted[134] * 256 + decrypted[135],
restoreDate: this.arrayToTimestamp(decrypted.slice(136, 140)),
icPartNo: that.uint8ArrayToString(decrypted.slice(140, 150)),
- indate: this.arrayToTimestamp(decrypted.slice(150, 154)),
+ indate: this.arrayToTimestamp(decrypted.slice(150, 154)) * 1000,
mac: that.uint8ArrayToString(decrypted.slice(154, 174)),
- timezoneOffset: new Date().getTimezoneOffset() * 60
+ timezoneOffset: new Date().getTimezoneOffset() * -60
}
that.updateCurrentLockInfo({
...that.currentLockInfo,
@@ -402,6 +402,7 @@ export const useBluetoothStore = defineStore('ble', {
characteristicValueCallback({
code: decrypted[2],
data: {
+ no: decrypted[9] * 256 + decrypted[10],
status: decrypted[11]
}
})
diff --git a/stores/lock.js b/stores/lock.js
index 7c2c8c5..b6c18da 100644
--- a/stores/lock.js
+++ b/stores/lock.js
@@ -196,7 +196,7 @@ export const useLockStore = defineStore('lock', {
`${timeFormat(new Date(data.list[i].startDate), 'yyyy-mm-dd h:M')} 单次`
} else if (data.list[i].keyboardPwdType === 2) {
data.list[i].timeText =
- `${timeFormat(new Date(data.list[i].startDate), 'yyyy-mm-dd h:M')} 永久`
+ `${timeFormat(new Date(data.list[i].created_at), 'yyyy-mm-dd h:M')} 永久`
} else if (data.list[i].keyboardPwdType === 3) {
data.list[i].timeText = `${data.list[i].validTimeStr} 限时`
} else if (data.list[i].keyboardPwdType === 4) {