feat: 1. 完成锁列表相关功能 2. 完成绑定锁相关功能

This commit is contained in:
范鹏 2024-11-21 14:50:43 +08:00
parent d4d7f9e89f
commit fff16d1213

View File

@ -561,7 +561,7 @@ export const useStarCloudStore = defineStore('starCloud', {
this.searchDeviceList = list this.searchDeviceList = list
callback( callback(
new Result(Result.Success, { new Result(Result.Success.code, {
list list
}) })
) )
@ -666,10 +666,17 @@ export const useStarCloudStore = defineStore('starCloud', {
if (bindLockResult.code === Result.Success.code) { if (bindLockResult.code === Result.Success.code) {
this.updateLockInfo({ this.updateLockInfo({
lockId: bindLockResult.data.lockId, lockId: bindLockResult.data.lockId,
keyId: bindLockResult.data.keyId keyId: bindLockResult.data.keyId,
adminPwd: password
}) })
} }
return bindLockResult return new Result(
bindLockResult.code,
{
lock: this.lockInfo
},
bindLockResult.message
)
} }
return connectResult return connectResult
}, },
@ -806,19 +813,19 @@ export const useStarCloudStore = defineStore('starCloud', {
username: accountInfo.username, username: accountInfo.username,
password: accountInfo.password, password: accountInfo.password,
token: userInfo.access_token, token: userInfo.access_token,
uid: userInfo.cloudUid uid: userInfo.uid
} }
setStorage('starCloudToken', userInfo.access_token) setStorage('starCloudToken', userInfo.access_token)
accounts[userInfo.cloudUid] = { accounts[userInfo.uid] = {
uid: userInfo.cloudUid, uid: userInfo.uid,
username: accountInfo.username, username: accountInfo.username,
password: accountInfo.password, password: accountInfo.password,
token: userInfo.access_token token: userInfo.access_token
} }
setStorage('starCloudAccount', accounts) setStorage('starCloudAccount', accounts)
userInfos[userInfo.cloudUid] = userInfo userInfos[userInfo.uid] = userInfo
setStorage('starCloudUser', userInfo) setStorage('starCloudUser', userInfo)
// 获取服务器时间 // 获取服务器时间
@ -929,7 +936,7 @@ export const useStarCloudStore = defineStore('starCloud', {
await this.getServerTimestamp() await this.getServerTimestamp()
const nowTime = this.serverTimestamp const nowTime = this.serverTimestamp
const date = new Date() const date = new Date()
const localTime = Math.floor(date.getTime() / 1000) - date.getTimezoneOffset() * 60 const localTime = this.serverTimestamp - date.getTimezoneOffset() * 60
for (let i = 0; i < name.length; i++) { for (let i = 0; i < name.length; i++) {
contentArray[i + 2] = name.charCodeAt(i) contentArray[i + 2] = name.charCodeAt(i)