feat: 适配腾讯锁添加发送电子钥匙后在锁板创建用户,开门方式适配wifi锁
This commit is contained in:
parent
baecc976ee
commit
28aac335f9
@ -103,6 +103,7 @@
|
||||
import { useBasicStore } from '@/stores/basic'
|
||||
import { createKeyRequest } from '@/api/key'
|
||||
import { useBluetoothStore } from '@/stores/bluetooth'
|
||||
import { transportType } from '@/utils/constants'
|
||||
|
||||
const instance = getCurrentInstance().proxy
|
||||
const eventChannel = instance.getOpenerEventChannel()
|
||||
@ -246,10 +247,32 @@
|
||||
params.receiverUsername = permanentAccount.value
|
||||
params.isOnlyManageSelf = permanentManageSelf.value ? 1 : 0
|
||||
}
|
||||
const { code, message } = await createKeyRequest(params)
|
||||
const { code, data, message } = await createKeyRequest(params)
|
||||
if (code === 0) {
|
||||
eventChannel.emit('refresherList', {})
|
||||
$basic.backAndToast('添加成功')
|
||||
if ($bluetooth.currentLockInfo.transport_type === transportType.TRANSPORT_TENCENT_YUN) {
|
||||
$bluetooth.addLockUser({
|
||||
name: $bluetooth.currentLockInfo.name,
|
||||
keyId: $bluetooth.keyId,
|
||||
authUid: $bluetooth.currentLockInfo.uid.toString(),
|
||||
uid: data.receiverUid.toString(),
|
||||
openMode: 1,
|
||||
keyType: params.keyType,
|
||||
startDate: params.startDate.toString(),
|
||||
expireDate: params.endDate.toString(),
|
||||
useCountLimit: params.keyType === '3' ? 1 : 0xffff,
|
||||
isRound: params.keyType === '4' ? 1 : 0,
|
||||
weekRound:
|
||||
params.keyType === '4' ? $bluetooth.convertWeekdaysToNumber(params.weekDays) : 0,
|
||||
startHour: params.keyType === '4' ? new Date(params.startDate).getHours() : 0,
|
||||
startMin: params.keyType === '4' ? new Date(params.startDate).getMinutes() : 0,
|
||||
endHour: params.keyType === '4' ? new Date(params.endDate).getHours() : 0,
|
||||
endMin: params.keyType === '4' ? new Date(params.endDate).getMinutes() : 0,
|
||||
role: 1,
|
||||
password: (Math.floor(Math.random() * 900000) + 100000).toString()
|
||||
})
|
||||
}
|
||||
} else if (code === 425) {
|
||||
pending.value = false
|
||||
uni.showModal({
|
||||
@ -324,23 +347,23 @@
|
||||
}
|
||||
|
||||
.text {
|
||||
padding: 0 32rpx;
|
||||
margin-top: 40rpx;
|
||||
margin-bottom: 50rpx;
|
||||
color: #262626;
|
||||
font-size: 26rpx;
|
||||
padding: 0 32rpx;
|
||||
color: #262626;
|
||||
}
|
||||
|
||||
.button {
|
||||
border-radius: 64rpx;
|
||||
width: 686rpx;
|
||||
margin-left: 32rpx;
|
||||
height: 100rpx;
|
||||
line-height: 100rpx;
|
||||
text-align: center;
|
||||
background-color: #63b8af;
|
||||
color: #fff;
|
||||
margin-left: 32rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
line-height: 100rpx;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
background-color: #63b8af;
|
||||
border-radius: 64rpx;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -127,6 +127,7 @@
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { useBluetoothStore } from '@/stores/bluetooth'
|
||||
import { checkCardNameRequest } from '@/api/card'
|
||||
import { transportType } from '@/utils/constants'
|
||||
|
||||
const instance = getCurrentInstance().proxy
|
||||
const eventChannel = instance.getOpenerEventChannel()
|
||||
@ -306,17 +307,29 @@
|
||||
cardName: params.cardName
|
||||
})
|
||||
if (code === 0) {
|
||||
$basic.routeJump({
|
||||
name: 'bindCard',
|
||||
params: {
|
||||
card: JSON.stringify(params)
|
||||
},
|
||||
events: {
|
||||
refresherList() {
|
||||
eventChannel.emit('refresherList', {})
|
||||
}
|
||||
if ($bluetooth.currentLockInfo.transport_type === transportType.TRANSPORT_TENCENT_YUN) {
|
||||
const { code } = await $bluetooth.registerAuthentication(params)
|
||||
if (code === 0) {
|
||||
$basic.backAndToast('请在锁端添加卡片')
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '添加卡片命令下达失败,请重试',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
$basic.routeJump({
|
||||
name: 'bindCard',
|
||||
params: {
|
||||
card: JSON.stringify(params)
|
||||
},
|
||||
events: {
|
||||
refresherList() {
|
||||
eventChannel.emit('refresherList', {})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: message,
|
||||
@ -385,23 +398,23 @@
|
||||
}
|
||||
|
||||
.text {
|
||||
padding: 0 32rpx;
|
||||
margin-top: 40rpx;
|
||||
margin-bottom: 50rpx;
|
||||
color: #262626;
|
||||
font-size: 26rpx;
|
||||
padding: 0 32rpx;
|
||||
color: #262626;
|
||||
}
|
||||
|
||||
.button {
|
||||
border-radius: 64rpx;
|
||||
width: 686rpx;
|
||||
margin-left: 32rpx;
|
||||
height: 100rpx;
|
||||
line-height: 100rpx;
|
||||
text-align: center;
|
||||
background-color: #63b8af;
|
||||
color: #fff;
|
||||
margin-left: 32rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
line-height: 100rpx;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
background-color: #63b8af;
|
||||
border-radius: 64rpx;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -104,6 +104,7 @@
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { useBluetoothStore } from '@/stores/bluetooth'
|
||||
import { checkFaceNameRequest } from '@/api/face'
|
||||
import { transportType } from '@/utils/constants'
|
||||
|
||||
const instance = getCurrentInstance().proxy
|
||||
const eventChannel = instance.getOpenerEventChannel()
|
||||
@ -275,17 +276,29 @@
|
||||
faceName: params.faceName
|
||||
})
|
||||
if (code === 0) {
|
||||
$basic.routeJump({
|
||||
name: 'bindFace',
|
||||
params: {
|
||||
info: JSON.stringify(params)
|
||||
},
|
||||
events: {
|
||||
refresherList() {
|
||||
eventChannel.emit('refresherList', {})
|
||||
}
|
||||
if ($bluetooth.currentLockInfo.transport_type === transportType.TRANSPORT_TENCENT_YUN) {
|
||||
const { code } = await $bluetooth.registerAuthentication(params)
|
||||
if (code === 0) {
|
||||
$basic.backAndToast('请在锁端添加人脸')
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '添加人脸命令下达失败,请重试',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
$basic.routeJump({
|
||||
name: 'bindFace',
|
||||
params: {
|
||||
info: JSON.stringify(params)
|
||||
},
|
||||
events: {
|
||||
refresherList() {
|
||||
eventChannel.emit('refresherList', {})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: message,
|
||||
@ -344,23 +357,23 @@
|
||||
}
|
||||
|
||||
.text {
|
||||
padding: 0 32rpx;
|
||||
margin-top: 40rpx;
|
||||
margin-bottom: 50rpx;
|
||||
color: #262626;
|
||||
font-size: 26rpx;
|
||||
padding: 0 32rpx;
|
||||
color: #262626;
|
||||
}
|
||||
|
||||
.button {
|
||||
border-radius: 64rpx;
|
||||
width: 686rpx;
|
||||
margin-left: 32rpx;
|
||||
height: 100rpx;
|
||||
line-height: 100rpx;
|
||||
text-align: center;
|
||||
background-color: #63b8af;
|
||||
color: #fff;
|
||||
margin-left: 32rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
line-height: 100rpx;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
background-color: #63b8af;
|
||||
border-radius: 64rpx;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -127,6 +127,7 @@
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { useBluetoothStore } from '@/stores/bluetooth'
|
||||
import { checkFingerprintNameRequest } from '@/api/fingerprint'
|
||||
import { transportType } from '@/utils/constants'
|
||||
|
||||
const instance = getCurrentInstance().proxy
|
||||
const eventChannel = instance.getOpenerEventChannel()
|
||||
@ -306,17 +307,29 @@
|
||||
fingerprintName: params.fingerprintName
|
||||
})
|
||||
if (code === 0) {
|
||||
$basic.routeJump({
|
||||
name: 'bindFingerprint',
|
||||
params: {
|
||||
info: JSON.stringify(params)
|
||||
},
|
||||
events: {
|
||||
refresherList() {
|
||||
eventChannel.emit('refresherList', {})
|
||||
}
|
||||
if ($bluetooth.currentLockInfo.transport_type === transportType.TRANSPORT_TENCENT_YUN) {
|
||||
const { code } = await $bluetooth.registerAuthentication(params)
|
||||
if (code === 0) {
|
||||
$basic.backAndToast('请在锁端添加指纹')
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '添加指纹命令下达失败,请重试',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
$basic.routeJump({
|
||||
name: 'bindFingerprint',
|
||||
params: {
|
||||
info: JSON.stringify(params)
|
||||
},
|
||||
events: {
|
||||
refresherList() {
|
||||
eventChannel.emit('refresherList', {})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: message,
|
||||
@ -385,23 +398,23 @@
|
||||
}
|
||||
|
||||
.text {
|
||||
padding: 0 32rpx;
|
||||
margin-top: 40rpx;
|
||||
margin-bottom: 50rpx;
|
||||
color: #262626;
|
||||
font-size: 26rpx;
|
||||
padding: 0 32rpx;
|
||||
color: #262626;
|
||||
}
|
||||
|
||||
.button {
|
||||
border-radius: 64rpx;
|
||||
width: 686rpx;
|
||||
margin-left: 32rpx;
|
||||
height: 100rpx;
|
||||
line-height: 100rpx;
|
||||
text-align: center;
|
||||
background-color: #63b8af;
|
||||
color: #fff;
|
||||
margin-left: 32rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
line-height: 100rpx;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
background-color: #63b8af;
|
||||
border-radius: 64rpx;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -130,6 +130,7 @@
|
||||
import { useBluetoothStore } from '@/stores/bluetooth'
|
||||
import { useLockStore } from '@/stores/lock'
|
||||
import { createKeyRequest } from '@/api/key'
|
||||
import { transportType } from '@/constant/transportType'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@ -173,7 +174,7 @@
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState(useBluetoothStore, ['currentLockInfo']),
|
||||
...mapState(useBluetoothStore, ['currentLockInfo', 'keyId']),
|
||||
...mapState(useLockStore, ['keySearch'])
|
||||
},
|
||||
async onLoad() {
|
||||
@ -182,6 +183,7 @@
|
||||
methods: {
|
||||
...mapActions(useBasicStore, ['getDeviceInfo', 'backAndToast', 'getNetworkType']),
|
||||
...mapActions(useLockStore, ['getKeyList', 'updateKeySearch']),
|
||||
...mapActions(useBluetoothStore, ['addLockUser', 'convertWeekdaysToNumber']),
|
||||
changeCycle(data) {
|
||||
this.cycleStartTime = data.startDate
|
||||
this.cycleEndTime = data.endDate
|
||||
@ -271,7 +273,7 @@
|
||||
params.startTime = this.cycleStartTime
|
||||
params.endTime = this.cycleEndTime
|
||||
}
|
||||
const { code, message } = await createKeyRequest(params)
|
||||
const { code, data, message } = await createKeyRequest(params)
|
||||
if (code === 0) {
|
||||
uni.reportEvent('create_key', {})
|
||||
this.updateKeySearch({
|
||||
@ -280,6 +282,27 @@
|
||||
})
|
||||
this.getKeyList(this.keySearch)
|
||||
this.backAndToast('钥匙已发送')
|
||||
if (this.currentLockInfo.transport_type === transportType.TRANSPORT_TENCENT_YUN) {
|
||||
this.addLockUser({
|
||||
name: this.currentLockInfo.name,
|
||||
keyId: this.keyId,
|
||||
authUid: this.currentLockInfo.uid.toString(),
|
||||
uid: data.receiverUid.toString(),
|
||||
openMode: 1,
|
||||
keyType: params.keyType,
|
||||
startDate: params.startDate.toString(),
|
||||
expireDate: params.endDate.toString(),
|
||||
useCountLimit: params.keyType === '3' ? 1 : 0xffff,
|
||||
isRound: params.keyType === '4' ? 1 : 0,
|
||||
weekRound: params.keyType === '4' ? this.convertWeekdaysToNumber(params.weekDays) : 0,
|
||||
startHour: params.keyType === '4' ? new Date(params.startDate).getHours() : 0,
|
||||
startMin: params.keyType === '4' ? new Date(params.startDate).getMinutes() : 0,
|
||||
endHour: params.keyType === '4' ? new Date(params.endDate).getHours() : 0,
|
||||
endMin: params.keyType === '4' ? new Date(params.endDate).getMinutes() : 0,
|
||||
role: 0,
|
||||
password: (Math.floor(Math.random() * 900000) + 100000).toString()
|
||||
})
|
||||
}
|
||||
} else if (code === 425) {
|
||||
this.pending = false
|
||||
uni.showModal({
|
||||
@ -350,21 +373,21 @@
|
||||
}
|
||||
|
||||
.text {
|
||||
color: #262626;
|
||||
font-size: 26rpx;
|
||||
padding: 0 32rpx;
|
||||
font-size: 26rpx;
|
||||
color: #262626;
|
||||
}
|
||||
|
||||
.button {
|
||||
border-radius: 64rpx;
|
||||
width: 686rpx;
|
||||
margin-left: 32rpx;
|
||||
height: 100rpx;
|
||||
line-height: 100rpx;
|
||||
text-align: center;
|
||||
background-color: #63b8af;
|
||||
color: #fff;
|
||||
margin-left: 32rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
line-height: 100rpx;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
background-color: #63b8af;
|
||||
border-radius: 64rpx;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -128,6 +128,7 @@
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { useBluetoothStore } from '@/stores/bluetooth'
|
||||
import { checkPalmVeinNameRequest } from '@/api/palmVein'
|
||||
import { transportType } from '@/utils/constants'
|
||||
|
||||
const instance = getCurrentInstance().proxy
|
||||
const eventChannel = instance.getOpenerEventChannel()
|
||||
@ -307,17 +308,29 @@
|
||||
palmVeinName: params.palmVeinName
|
||||
})
|
||||
if (code === 0) {
|
||||
$basic.routeJump({
|
||||
name: 'bindPalmVein',
|
||||
params: {
|
||||
info: JSON.stringify(params)
|
||||
},
|
||||
events: {
|
||||
refresherList() {
|
||||
eventChannel.emit('refresherList', {})
|
||||
}
|
||||
if ($bluetooth.currentLockInfo.transport_type === transportType.TRANSPORT_TENCENT_YUN) {
|
||||
const { code } = await $bluetooth.registerAuthentication(params)
|
||||
if (code === 0) {
|
||||
$basic.backAndToast('请在锁端添加掌静脉')
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '添加掌静脉命令下达失败,请重试',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
$basic.routeJump({
|
||||
name: 'bindPalmVein',
|
||||
params: {
|
||||
info: JSON.stringify(params)
|
||||
},
|
||||
events: {
|
||||
refresherList() {
|
||||
eventChannel.emit('refresherList', {})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: message,
|
||||
@ -386,23 +399,23 @@
|
||||
}
|
||||
|
||||
.text {
|
||||
padding: 0 32rpx;
|
||||
margin-top: 40rpx;
|
||||
margin-bottom: 50rpx;
|
||||
color: #262626;
|
||||
font-size: 26rpx;
|
||||
padding: 0 32rpx;
|
||||
color: #262626;
|
||||
}
|
||||
|
||||
.button {
|
||||
border-radius: 64rpx;
|
||||
width: 686rpx;
|
||||
margin-left: 32rpx;
|
||||
height: 100rpx;
|
||||
line-height: 100rpx;
|
||||
text-align: center;
|
||||
background-color: #63b8af;
|
||||
color: #fff;
|
||||
margin-left: 32rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
line-height: 100rpx;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
background-color: #63b8af;
|
||||
border-radius: 64rpx;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -83,6 +83,7 @@
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { useBluetoothStore } from '@/stores/bluetooth'
|
||||
import { checkRemoteNameRequest } from '@/api/remote'
|
||||
import { transportType } from '@/utils/constants'
|
||||
|
||||
const instance = getCurrentInstance().proxy
|
||||
const eventChannel = instance.getOpenerEventChannel()
|
||||
@ -248,17 +249,29 @@
|
||||
remoteName: params.remoteName
|
||||
})
|
||||
if (code === 0) {
|
||||
$basic.routeJump({
|
||||
name: 'bindRemote',
|
||||
params: {
|
||||
info: JSON.stringify(params)
|
||||
},
|
||||
events: {
|
||||
refresherList() {
|
||||
eventChannel.emit('refresherList', {})
|
||||
}
|
||||
if ($bluetooth.currentLockInfo.transport_type === transportType.TRANSPORT_TENCENT_YUN) {
|
||||
const { code } = await $bluetooth.registerAuthentication(params)
|
||||
if (code === 0) {
|
||||
$basic.backAndToast('请在锁端添加远程')
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '添加远程命令下达失败,请重试',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
$basic.routeJump({
|
||||
name: 'bindRemote',
|
||||
params: {
|
||||
info: JSON.stringify(params)
|
||||
},
|
||||
events: {
|
||||
refresherList() {
|
||||
eventChannel.emit('refresherList', {})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: message,
|
||||
@ -307,23 +320,23 @@
|
||||
}
|
||||
|
||||
.text {
|
||||
padding: 0 32rpx;
|
||||
margin-top: 40rpx;
|
||||
margin-bottom: 50rpx;
|
||||
color: #262626;
|
||||
font-size: 26rpx;
|
||||
padding: 0 32rpx;
|
||||
color: #262626;
|
||||
}
|
||||
|
||||
.button {
|
||||
border-radius: 64rpx;
|
||||
width: 686rpx;
|
||||
margin-left: 32rpx;
|
||||
height: 100rpx;
|
||||
line-height: 100rpx;
|
||||
text-align: center;
|
||||
background-color: #63b8af;
|
||||
color: #fff;
|
||||
margin-left: 32rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
line-height: 100rpx;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
background-color: #63b8af;
|
||||
border-radius: 64rpx;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -1275,7 +1275,7 @@ export const useBluetoothStore = defineStore('ble', {
|
||||
this.currentLockInfo.keyType === 4
|
||||
? new Date(this.currentLockInfo.endDate).getMinutes()
|
||||
: 0,
|
||||
role: 0,
|
||||
role: Number(this.currentLockInfo.keyRight),
|
||||
password
|
||||
}
|
||||
const { code: addUserCode } = await this.addLockUser(addUserParams)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user