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 },