fix: 修复自定义密码相关bug
This commit is contained in:
parent
d028bbca1b
commit
8fb4aadfa6
9
api.js
9
api.js
@ -170,3 +170,12 @@ export function getLockSettingDataRequest(data) {
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 检查密码和密码名称是否已存在
|
||||
export function checkPasswordRequest(data) {
|
||||
return request({
|
||||
url: '/v1/keyboardPwd/checkKeyboardpwdName',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
25
starCloud.js
25
starCloud.js
@ -5,6 +5,7 @@ import {
|
||||
addCustomPasswordRequest,
|
||||
bindLockRequest,
|
||||
changeAdminKeyboardPwdRequest,
|
||||
checkPasswordRequest,
|
||||
deleteLockRequest,
|
||||
deletePasswordRequest,
|
||||
getLastRecordTimeRequest,
|
||||
@ -551,6 +552,23 @@ export const useStarCloudStore = defineStore('starCloud', {
|
||||
if (result.code !== Result.Success.code) {
|
||||
return result
|
||||
}
|
||||
|
||||
requestParams = password
|
||||
let { pwdNo, operate, keyboardPwd, startDate, endDate, pwdRight } = password
|
||||
|
||||
if (operate === 0 || operate === 1) {
|
||||
const checkPasswordResult = await this.checkPasswordRequest({
|
||||
lockId: this.lockInfo.lockId,
|
||||
keyboardPwd
|
||||
})
|
||||
if (checkPasswordResult.code === -3) {
|
||||
return Result.ReadyHasPassword
|
||||
}
|
||||
if (checkPasswordResult.code !== Result.Success.code) {
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
// 确认设备连接正常
|
||||
if (!params.connected) {
|
||||
const searchResult = await searchAndConnectDevice(
|
||||
@ -568,9 +586,6 @@ export const useStarCloudStore = defineStore('starCloud', {
|
||||
return checkResult
|
||||
}
|
||||
|
||||
requestParams = password
|
||||
let { pwdNo, operate, keyboardPwd, startDate, endDate, pwdRight } = password
|
||||
|
||||
const uid = this.accountInfo.uid.toString()
|
||||
const keyId = this.lockInfo.keyId.toString()
|
||||
const isAdmin = pwdRight
|
||||
@ -2079,6 +2094,10 @@ export const useStarCloudStore = defineStore('starCloud', {
|
||||
// 断开与设备的连接
|
||||
async disconnectDevice() {
|
||||
return await closeBLEConnection(this.lockInfo.deviceId)
|
||||
},
|
||||
// 检查密码名称与密码是否已存在
|
||||
async checkPasswordRequest(params) {
|
||||
return await checkPasswordRequest(params)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user