diff --git a/pages/home/home.vue b/pages/home/home.vue index b24d3a2..627264a 100644 --- a/pages/home/home.vue +++ b/pages/home/home.vue @@ -33,8 +33,8 @@ - - {{lock.electricQuantity}}% + + {{ lock.electricQuantity }}% {{getRole(lock.userType, lock.keyRight)}} @@ -147,7 +147,7 @@ methods: { timeFormat, ...mapActions(useUserStore, ['updateUserInfo', 'updateLoginStatus', 'phoneLogin', 'getUserInfo']), - ...mapActions(useLockStore, ['getLockList', 'getRole', 'getTimeLimit', 'updateLockSearch']), + ...mapActions(useLockStore, ['getLockList', 'getRole', 'getTimeLimit', 'updateLockSearch', 'getPowerIcon']), ...mapActions(useBluetoothStore, ['getBluetoothStatus', 'initAndListenBluetooth', 'updateCurrentLockInfo', 'checkSetting', 'updateKeyId', 'resetDevice']), ...mapActions(useBasicStore, ['routeJump', 'getDeviceInfo']), @@ -548,7 +548,7 @@ page { .lock-top-right-power-image { width: 40rpx; - height: 40rpx; + height: 24rpx; margin-right: 10rpx; } } diff --git a/pages/lockDetail/lockDetail.vue b/pages/lockDetail/lockDetail.vue index 83b91d2..d4befbc 100644 --- a/pages/lockDetail/lockDetail.vue +++ b/pages/lockDetail/lockDetail.vue @@ -6,7 +6,7 @@ - + {{ currentLockInfo.electricQuantity }}% @@ -85,7 +85,7 @@ export default { this.getServeTime() }, methods: { - ...mapActions(useLockStore, ['getRole', 'updateLockSearch', 'getLockList']), + ...mapActions(useLockStore, ['getRole', 'updateLockSearch', 'getLockList', 'getPowerIcon']), ...mapActions(useBluetoothStore, ['openDoor', 'updateServerTimestamp']), ...mapActions(useBasicStore, ['routeJump', 'backAndToast']), powerTip() { @@ -246,7 +246,7 @@ export default { .power-icon { width: 50rpx; margin-right: 10rpx; - height: 50rpx; + height: 30rpx; } .power-text { diff --git a/static/images/icon_power.png b/static/images/icon_power.png deleted file mode 100755 index ceeeb8d..0000000 Binary files a/static/images/icon_power.png and /dev/null differ diff --git a/static/images/icon_power_1.png b/static/images/icon_power_1.png new file mode 100755 index 0000000..54a9924 Binary files /dev/null and b/static/images/icon_power_1.png differ diff --git a/static/images/icon_power_2.png b/static/images/icon_power_2.png new file mode 100755 index 0000000..e9eb362 Binary files /dev/null and b/static/images/icon_power_2.png differ diff --git a/static/images/icon_power_3.png b/static/images/icon_power_3.png new file mode 100755 index 0000000..c105488 Binary files /dev/null and b/static/images/icon_power_3.png differ diff --git a/static/images/icon_power_4.png b/static/images/icon_power_4.png new file mode 100755 index 0000000..f57b60a Binary files /dev/null and b/static/images/icon_power_4.png differ diff --git a/static/images/icon_power_5.png b/static/images/icon_power_5.png new file mode 100755 index 0000000..eef3c9c Binary files /dev/null and b/static/images/icon_power_5.png differ diff --git a/stores/lock.js b/stores/lock.js index 27b541a..7215160 100644 --- a/stores/lock.js +++ b/stores/lock.js @@ -51,6 +51,21 @@ export const useLockStore = defineStore('lock', { } }, actions: { + // 获取电量icon + getPowerIcon(power) { + if(power >= 80) { + return '/static/images/icon_power_5.png' + } else if(power >= 60) { + return '/static/images/icon_power_4.png' + } else if(power >= 40) { + return '/static/images/icon_power_3.png' + } else if(power >= 20) { + return '/static/images/icon_power_2.png' + } else { + return '/static/images/icon_power_1.png' + } + }, + // 将星期转换为中文字符串 convertWeekDaysToChineseString(weekDays) { const dayMap = { 1: '一',