添加开关门电量上报
This commit is contained in:
parent
f40d0477d9
commit
8581513b09
12
api/room.js
Normal file
12
api/room.js
Normal file
@ -0,0 +1,12 @@
|
||||
import request from '../utils/request'
|
||||
|
||||
// room 房间模块
|
||||
|
||||
// 更新锁电量
|
||||
export function updateElectricQuantityRequest(data) {
|
||||
return request({
|
||||
url: '/room/uploadElectricQuantity',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
}
|
||||
@ -23,4 +23,4 @@ const PROD = {
|
||||
}
|
||||
|
||||
// 更换环境的时候 切换导出就行
|
||||
export default PRE
|
||||
export default DEV
|
||||
|
||||
@ -89,9 +89,11 @@ export default {
|
||||
...mapActions(useBasicStore, ['routeJump']),
|
||||
powerTip() {
|
||||
const that = this
|
||||
const time = timeFormat(that.currentLockInfo.electricQuantityDate, 'yyyy-mm-dd h:M')
|
||||
console.log('更新时间', that.currentLockInfo.electricQuantityDate, time)
|
||||
uni.showModal({
|
||||
title: '锁电量更新时间',
|
||||
content: `${timeFormat(that.currentLockInfo.electricQuantityDate, 'yyyy-mm-dd h:M')}`,
|
||||
content: time,
|
||||
showCancel: false
|
||||
})
|
||||
},
|
||||
|
||||
@ -7,6 +7,7 @@ import { sm4 } from 'sm-crypto'
|
||||
import { md5 } from 'js-md5'
|
||||
import { getServerDatetime } from '@/api/check'
|
||||
import { getUserNoListRequest, updateLockUserNoRequest } from '@/api/key'
|
||||
import { updateElectricQuantityRequest } from '@/api/room'
|
||||
|
||||
// 定时器
|
||||
let timer
|
||||
@ -325,6 +326,29 @@ export const useBluetoothStore = defineStore('ble', {
|
||||
break
|
||||
}
|
||||
break
|
||||
case cmdIds.openDoor:
|
||||
that.updateCurrentLockInfo({
|
||||
...that.currentLockInfo,
|
||||
token: decrypted.slice(2,6)
|
||||
})
|
||||
console.log('开门', decrypted[6], that.currentLockInfo.token)
|
||||
characteristicValueCallback({
|
||||
code: decrypted[6]
|
||||
})
|
||||
if(decrypted[6] === 0) {
|
||||
updateElectricQuantityRequest({
|
||||
lockId: that.currentLockInfo.lockId,
|
||||
electricQuantity: decrypted[7],
|
||||
electricQuantityStandby: decrypted[9]
|
||||
}).then(res => {
|
||||
if(res.code === 0) {
|
||||
that.updateCurrentLockInfo({
|
||||
...that.currentLockInfo,
|
||||
electricQuantityDate: res.data.electricQuantityDate
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
default:
|
||||
that.updateCurrentLockInfo({
|
||||
...that.currentLockInfo,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user