首页列表显示电子钥匙状态
This commit is contained in:
parent
6526c4c120
commit
1a42b7ed25
@ -34,6 +34,10 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="lock-name">{{lock.lockAlias}}</view>
|
<view class="lock-name">{{lock.lockAlias}}</view>
|
||||||
|
<view v-if="lock.keyStatus === 110412" class="lock-status">已过期</view>
|
||||||
|
<view v-if="lock.days" class="lock-status" style="background-color: #63b8af">余{{lock.days}}天</view>
|
||||||
|
<view v-if="lock.keyStatus === 110403" class="lock-status" style="background-color: #63b8af">未生效</view>
|
||||||
|
<view v-if="lock.keyStatus === 110405" class="lock-status">已冻结</view>
|
||||||
<view class="lock-time">
|
<view class="lock-time">
|
||||||
<view v-if="lock.keyType === 1 || lock.keyType === 3" style="font-size: 32rpx">{{
|
<view v-if="lock.keyType === 1 || lock.keyType === 3" style="font-size: 32rpx">{{
|
||||||
getTimeLimit(lock.keyType) }}</view>
|
getTimeLimit(lock.keyType) }}</view>
|
||||||
@ -226,6 +230,20 @@
|
|||||||
this.getBluetoothStatus()
|
this.getBluetoothStatus()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if(lock.keyStatus === 110412) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '钥匙已过期',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if(lock.keyStatus === 110405) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '钥匙已冻结',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
let result = true
|
let result = true
|
||||||
if(!this.isInitBluetooth) {
|
if(!this.isInitBluetooth) {
|
||||||
result = await this.initAndListenBluetooth()
|
result = await this.initAndListenBluetooth()
|
||||||
@ -308,6 +326,7 @@ page {
|
|||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
|
line-height: 38rpx;
|
||||||
|
|
||||||
display: -webkit-box;
|
display: -webkit-box;
|
||||||
-webkit-box-orient: vertical;
|
-webkit-box-orient: vertical;
|
||||||
@ -318,7 +337,7 @@ page {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.lock-time {
|
.lock-time {
|
||||||
padding: 12rpx 24rpx 0 24rpx;
|
padding: 6rpx 24rpx 0 24rpx;
|
||||||
font-size: 22rpx;
|
font-size: 22rpx;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
@ -398,4 +417,16 @@ page {
|
|||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #999999;
|
color: #999999;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.lock-status {
|
||||||
|
margin-left: 24rpx;
|
||||||
|
color: #FFFFFF;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
font-size: 22rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
display: inline-block;
|
||||||
|
padding: 4rpx 8rpx;
|
||||||
|
background-color: #ecab1f;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -101,6 +101,19 @@ export const useLockStore = defineStore('lock', {
|
|||||||
const { code, data, message } = await getLockListRequest(params)
|
const { code, data, message } = await getLockListRequest(params)
|
||||||
if(code === 0) {
|
if(code === 0) {
|
||||||
this.lockTotal = data.total
|
this.lockTotal = data.total
|
||||||
|
for(let i = 0; i < data.groupList.length; i++) {
|
||||||
|
for (let j = 0; j < data.groupList[i].lockList.length; j++) {
|
||||||
|
if(data.groupList[i].lockList[j].keyType === 2 && data.groupList[i].lockList[j].keyStatus === 110401) {
|
||||||
|
const now = new Date().getTime()
|
||||||
|
const diffInMilliseconds = data.groupList[i].lockList[j].endDate - now
|
||||||
|
const millisecondsPerDay = 24 * 60 * 60 * 1000
|
||||||
|
const diffInDays = Math.floor(diffInMilliseconds / millisecondsPerDay)
|
||||||
|
if(diffInDays > 0 && diffInDays <= 15) {
|
||||||
|
data.groupList[i].lockList[j].days = diffInDays
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if(params.pageNo === 1) {
|
if(params.pageNo === 1) {
|
||||||
this.lockList = data.groupList
|
this.lockList = data.groupList
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user