适配授权管理员相关显示

This commit is contained in:
范鹏 2024-09-02 17:18:14 +08:00
parent a77d39e19a
commit dc68492c0c
7 changed files with 57 additions and 15 deletions

View File

@ -30,7 +30,7 @@
<image class="lock-top-right-power-image" src="/static/images/icon_power.png"></image>
<view class="lock-top-right-power-text">{{lock.electricQuantity}}%</view>
</view>
<view>{{getRole(lock.userType)}}</view>
<view>{{getRole(lock.userType, lock.keyRight)}}</view>
</view>
</view>
<view class="lock-name">{{lock.lockAlias}}</view>

View File

@ -2,11 +2,12 @@
<view>
<view class="item">
<view class="item-title">名称</view>
<view class="item-content">{{ currentKeyInfo.nickname }}</view>
<view class="item-content">{{ currentKeyInfo.keyName }}</view>
</view>
<view class="item" style="margin-top: 2rpx">
<view class="item-title">有效期</view>
<view v-if="currentKeyInfo.keyType === 1">永久</view>
<view v-else-if="currentKeyInfo.keyType === 3">单次</view>
<view v-else>
<view class="item-content">{{ timeFormat(currentKeyInfo.startDate, 'yyyy-mm-dd h:M') }}</view>
<view class="item-content">{{ timeFormat(currentKeyInfo.endDate, 'yyyy-mm-dd h:M') }}</view>

View File

@ -280,7 +280,7 @@ page {
}
.key-right-bottom {
font-size: 26rpx;
font-size: 24rpx;
color: #999999;
}
}

View File

@ -16,7 +16,7 @@
<view class="bottom">
<view class="bottom-side">
<image class="bottom-icon" src="/static/images/icon_role.png" mode="aspectFill"></image>
<view>{{ getRole(currentLockInfo.userType) }}</view>
<view>{{ getRole(currentLockInfo.userType, currentLockInfo.keyRight) }}</view>
</view>
<view class="bottom-side">
<image class="bottom-icon" :src=" currentLockInfo.lockSetting.appUnlockOnline ?
@ -26,18 +26,18 @@
</view>
</view>
</view>
<view class="menu" v-if="currentLockInfo.userType === 110301">
<view class="menu" v-if="currentLockInfo.keyRight === 1">
<view class="menu-title">
<image class="menu-image" src="/static/images/icon_menu.png"></image>
<view>功能</view>
</view>
<view class="menu-main">
<view v-if="currentLockInfo.userType === 110301"
<view v-if="currentLockInfo.keyRight === 1"
class="menu-main-view" @click="routeJump({ name: 'keyList' })">
<image class="menu-main-image" src="/static/images/tabbar_key_select.png"></image>
<view>电子钥匙</view>
</view>
<view v-if="currentLockInfo.lockFeature.password || currentLockInfo.userType === 110301"
<view v-if="currentLockInfo.lockFeature.password || currentLockInfo.keyRight === 1"
class="menu-main-view" @click="routeJump({ name: 'passwordList' })">
<image class="menu-main-image" src="/static/images/icon_lock_transparent.png"></image>
<view>密码</view>

View File

@ -11,10 +11,13 @@
<view class="item" style="margin-top: 2rpx">
<view class="item-title">有效期</view>
<view v-if="currentPasswordInfo.keyboardPwdType === 2">永久</view>
<view v-else>
<view v-else-if="currentPasswordInfo.keyboardPwdType <= 4">
<view class="item-content">{{ timeFormat(currentPasswordInfo.startDate, 'yyyy-mm-dd h:M') }}</view>
<view class="item-content">{{ timeFormat(currentPasswordInfo.endDate, 'yyyy-mm-dd h:M') }}</view>
</view>
<view v-else>
{{ currentPasswordInfo.timeText }}
</view>
</view>
<view class="item" style="margin-top: 20rpx">
<view class="item-title">发送人</view>

View File

@ -303,11 +303,11 @@ page {
.password-right-top {
font-size: 32rpx;
font-weight: bold;
padding-bottom: 6rpx;
padding-bottom: 10rpx;
}
.password-right-bottom {
font-size: 26rpx;
font-size: 24rpx;
color: #999999;
}
}

View File

@ -66,9 +66,11 @@ export const useLockStore = defineStore('lock', {
updateCurrentPasswordInfo(info) {
this.currentPasswordInfo = info
},
getRole(userType) {
getRole(userType, keyRight) {
if(userType === 110301) {
return '超级管理员'
} else if(keyRight === 1) {
return '授权管理员'
} else {
return '普通用户'
}
@ -118,10 +120,41 @@ export const useLockStore = defineStore('lock', {
if(code === 0) {
this.passwordTotal = data.total
for(let i = 0; i < data.list.length; i++) {
if(data.list[i].keyboardPwdType === 2) {
data.list[i].timeText = `${timeFormat(new Date(data.list[i].created_at), 'yyyy-mm-dd h:M')} 永久`
if(data.list[i].keyboardPwdType === 1) {
data.list[i].timeText = `${timeFormat(new Date(data.list[i].startDate), 'yyyy-mm-dd h:M')} 单次`
} else if(data.list[i].keyboardPwdType === 2) {
data.list[i].timeText = `${timeFormat(new Date(data.list[i].startDate), 'yyyy-mm-dd h:M')} 永久`
} else if(data.list[i].keyboardPwdType === 3) {
data.list[i].timeText = `${data.list[i].validTimeStr} 限时`
} else if(data.list[i].keyboardPwdType === 4) {
data.list[i].timeText = `${timeFormat(new Date(data.list[i].startDate), 'yyyy-mm-dd h:M')} 清空码`
} else {
let text = ''
if(data.list[i].keyboardPwdType === 5) {
text = '周末'
} else if(data.list[i].keyboardPwdType === 6) {
text = '每日'
} else if(data.list[i].keyboardPwdType === 7) {
text = '工作日'
} else if(data.list[i].keyboardPwdType === 8) {
text = '周一'
} else if(data.list[i].keyboardPwdType === 9) {
text = '周二'
} else if(data.list[i].keyboardPwdType === 10) {
text = '周三'
} else if(data.list[i].keyboardPwdType === 11) {
text = '周四'
} else if(data.list[i].keyboardPwdType === 12) {
text = '周五'
} else if(data.list[i].keyboardPwdType === 13) {
text = '周六'
} else if(data.list[i].keyboardPwdType === 14) {
text = '周日'
}
data.list[i].timeText = `${text} ${data.list[i].hoursStart}:00-${data.list[i].hoursEnd}:00 循环`
}
if(data.list[i].isCustom === 1) {
data.list[i].timeText += ' 自定义'
}
}
if(params.pageNo === 1) {
@ -143,10 +176,15 @@ export const useLockStore = defineStore('lock', {
if(code === 0) {
this.keyTotal = data.total
for(let i = 0; i < data.list.length; i++) {
if(data.list[i].keyType === 2) {
console.log(data.list[i].keyType)
if(data.list[i].keyType === 1) {
data.list[i].timeText = `${timeFormat(new Date(data.list[i].sendDate), 'yyyy-mm-dd h:M')} 永久`
} else if(data.list[i].keyType === 2) {
data.list[i].timeText = `${timeFormat(new Date(data.list[i].startDate), 'yyyy-mm-dd h:M')} - ${timeFormat(new Date(data.list[i].endDate), 'yyyy-mm-dd h:M')} 限时`
} else if(data.list[i].keyType === 3) {
data.list[i].timeText = `${timeFormat(new Date(data.list[i].sendDate), 'yyyy-mm-dd h:M')} 单次`
} else {
data.list[i].timeText = `${timeFormat(new Date(data.list[i].startDate), 'yyyy-mm-dd h:M')} 永久`
data.list[i].timeText = `循环`
}
}
if(params.pageNo === 1) {