From 41efe3ed4708f85f2694152f68c34a190c290578 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8C=83=E9=B9=8F?= Date: Tue, 3 Sep 2024 17:48:26 +0800 Subject: [PATCH] =?UTF-8?q?=E9=94=81=E8=AE=BE=E7=BD=AE=E9=A1=B5=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E7=94=B5=E5=AD=90=E9=92=A5=E5=8C=99=E8=B5=B7=E6=AD=A2?= =?UTF-8?q?=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/keyDetail/keyDetail.vue | 19 ++--------------- pages/setting/setting.vue | 39 ++++++++++++++++++++++++++++++++++- stores/lock.js | 15 ++++++++++++++ 3 files changed, 55 insertions(+), 18 deletions(-) diff --git a/pages/keyDetail/keyDetail.vue b/pages/keyDetail/keyDetail.vue index c6f1a61..9d4752b 100644 --- a/pages/keyDetail/keyDetail.vue +++ b/pages/keyDetail/keyDetail.vue @@ -24,7 +24,7 @@ 有效时间 - {{ timeFormat(currentKeyInfo.startDate, 'h:M') }}-{{ timeFormat(currentKeyInfo.endDate, 'h:M') }} + {{ timeFormat(currentKeyInfo.startDate, 'h:M') }}~{{ timeFormat(currentKeyInfo.endDate, 'h:M') }} @@ -59,7 +59,7 @@ export default { }, methods: { timeFormat, - ...mapActions(useLockStore, ['updateKeySearch', 'getKeyList']), + ...mapActions(useLockStore, ['updateKeySearch', 'getKeyList', 'convertWeekDaysToChineseString']), ...mapActions(useBasicStore, ['backAndToast']), async deleteKey () { const that = this @@ -93,21 +93,6 @@ export default { } } }) - }, - convertWeekDaysToChineseString(weekDays) { - const dayMap = { - 1: '一', - 2: '二', - 3: '三', - 4: '四', - 5: '五', - 6: '六', - 7: '日' - } - - const chineseWeekDays = weekDays.map(day => dayMap[day]) - - return chineseWeekDays.join(',') } } } diff --git a/pages/setting/setting.vue b/pages/setting/setting.vue index bcf9222..866f716 100644 --- a/pages/setting/setting.vue +++ b/pages/setting/setting.vue @@ -7,6 +7,7 @@ {{currentLockInfo.lockAlias}} + 锁编号 @@ -37,6 +38,40 @@ + + + + 有效期 + + {{ timeFormat(currentLockInfo.startDate, 'yyyy-mm-dd h:M') }}~{{ + timeFormat(currentLockInfo.endDate, 'yyyy-mm-dd h:M') }} + + + + + + 有效期 + + {{ timeFormat(currentLockInfo.startDate, 'yyyy-mm-dd') }}~{{ timeFormat(currentLockInfo.endDate, 'yyyy-mm-dd') }} + + + + + 有效日 + + {{ convertWeekDaysToChineseString(currentLockInfo.weekDays) }} + + + + + 有效时间 + + {{ timeFormat(currentLockInfo.startDate, 'h:M') }}~{{ + timeFormat(currentLockInfo.endDate, 'h:M') }} + + + + 删除 @@ -59,6 +94,7 @@ import { useLockStore } from '@/stores/lock' import { updateLockSettingRequest } from '@/api/lockSetting' import { deleteKeyRequest } from '@/api/key' import { useBasicStore } from '@/stores/basic' +import { timeFormat } from 'uview-plus' export default { data () { @@ -77,8 +113,9 @@ export default { this.unlockApp = this.currentLockInfo.lockSetting.appUnlockOnline }, methods: { + timeFormat, ...mapActions(useBluetoothStore, ['resetDevice', 'updateCurrentLockInfo']), - ...mapActions(useLockStore, ['getLockList', 'updateLockSearch']), + ...mapActions(useLockStore, ['getLockList', 'updateLockSearch', 'convertWeekDaysToChineseString']), ...mapActions(useBasicStore, ['backAndToast']), changeRadio() { this.checked = !this.checked diff --git a/stores/lock.js b/stores/lock.js index 22f9482..85fc4aa 100644 --- a/stores/lock.js +++ b/stores/lock.js @@ -51,6 +51,21 @@ export const useLockStore = defineStore('lock', { } }, actions: { + convertWeekDaysToChineseString(weekDays) { + const dayMap = { + 1: '一', + 2: '二', + 3: '三', + 4: '四', + 5: '五', + 6: '六', + 7: '日' + } + + const chineseWeekDays = weekDays.map(day => dayMap[day]) + + return chineseWeekDays.join(',') + }, updateLockSearch(search) { this.lockSearch = search },