From 3648e6247f4c76eec661afb8bfcc5f0a9577e55b Mon Sep 17 00:00:00 2001 From: zpc Date: Sun, 14 Sep 2025 00:07:26 +0800 Subject: [PATCH] 333 --- common/system/timeUtile.js | 30 ++- components.d.ts | 3 + components/com/appointment/card-container.vue | 41 ++++ .../com/appointment/label-slect-field.vue | 65 +++++ components/com/appointment/tag-select.vue | 54 +++++ .../com/appointment/time-select-cell.vue | 25 +- components/com/page/container-base.vue | 13 +- pages/appointment/appointment-page.vue | 224 ++++++++++-------- pages/me/me-page.vue | 21 +- 9 files changed, 349 insertions(+), 127 deletions(-) create mode 100644 components/com/appointment/card-container.vue create mode 100644 components/com/appointment/label-slect-field.vue create mode 100644 components/com/appointment/tag-select.vue diff --git a/common/system/timeUtile.js b/common/system/timeUtile.js index d985169..6667bc3 100644 --- a/common/system/timeUtile.js +++ b/common/system/timeUtile.js @@ -80,7 +80,7 @@ function calculateTimeRange(time1, time2) { * @returns {string} - 返回 '今天' | '明天' | '后天' | '其他' */ function getDayDescription(input) { - + if (input == null || input == "" || input == 0) { return "请选择时间"; @@ -103,4 +103,30 @@ function getDayDescription(input) { return target.format('MM-DD ' + tips + ' HH:mm') } -export { parseTimeString, formatTime, calculateTimeRange, getDayDescription } + + +/** + * 将传入的时间的分钟数 向上取整到最近的 5 的倍数 + * 比如:1 → 5,6 → 10,58 → 00(且进位到下一小时),59 → 00(进位) + * @param {Date|number|string|dayjs} inputTime - 可以是时间戳、Date 对象、ISO 字符串、dayjs 对象 + * @returns {dayjs} 返回调整后的 dayjs 对象,分钟是 5 的倍数,且进位正确 + */ +function ceilMinuteToNext5(inputTime) { + const t = dayjs(inputTime) // 支持多种时间格式 + + const m = t.minute() + const s = t.second() + + // 向上取整到最近的 5 的倍数 + const nextMin = Math.ceil(m / 5) * 5 + + if (nextMin === 60) { + // 59 → 60 → 变成下一小时的 00 分 + return t.add(1, 'hour').minute(0).second(0) + } + + // 否则正常设置分钟,并清空秒 + return t.minute(nextMin).second(0) +} + +export { parseTimeString, formatTime, calculateTimeRange, getDayDescription, ceilMinuteToNext5 } diff --git a/components.d.ts b/components.d.ts index faa0764..58ee706 100644 --- a/components.d.ts +++ b/components.d.ts @@ -8,9 +8,11 @@ export {} /* prettier-ignore */ declare module 'vue' { export interface GlobalComponents { + CardContainer: typeof import('./components/com/appointment/card-container.vue')['default'] Container: typeof import('./components/com/page/container.vue')['default'] ContainerBase: typeof import('./components/com/page/container-base.vue')['default'] LabelField: typeof import('./components/com/appointment/label-field.vue')['default'] + LabelSlectField: typeof import('./components/com/appointment/label-slect-field.vue')['default'] MahjongCard: typeof import('./components/index/MahjongCard.vue')['default'] NoData: typeof import('./components/com/page/no-data.vue')['default'] NoEmpty: typeof import('./components/com/index/NoEmpty.vue')['default'] @@ -19,6 +21,7 @@ declare module 'vue' { ReservationPopup: typeof import('./components/com/index/ReservationPopup.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] RouterView: typeof import('vue-router')['RouterView'] + TagSelect: typeof import('./components/com/appointment/tag-select.vue')['default'] TimeSelectCell: typeof import('./components/com/appointment/time-select-cell.vue')['default'] UniNavBar: typeof import('./components/uni-nav-bar/uni-nav-bar.vue')['default'] UniStatusBar: typeof import('./components/uni-nav-bar/uni-status-bar.vue')['default'] diff --git a/components/com/appointment/card-container.vue b/components/com/appointment/card-container.vue new file mode 100644 index 0000000..eaa7103 --- /dev/null +++ b/components/com/appointment/card-container.vue @@ -0,0 +1,41 @@ + + + + + + + diff --git a/components/com/appointment/label-slect-field.vue b/components/com/appointment/label-slect-field.vue new file mode 100644 index 0000000..7b1e50a --- /dev/null +++ b/components/com/appointment/label-slect-field.vue @@ -0,0 +1,65 @@ + + + + + diff --git a/components/com/appointment/tag-select.vue b/components/com/appointment/tag-select.vue new file mode 100644 index 0000000..54aa975 --- /dev/null +++ b/components/com/appointment/tag-select.vue @@ -0,0 +1,54 @@ + + + + + diff --git a/components/com/appointment/time-select-cell.vue b/components/com/appointment/time-select-cell.vue index 20ae530..53e5bb6 100644 --- a/components/com/appointment/time-select-cell.vue +++ b/components/com/appointment/time-select-cell.vue @@ -1,22 +1,19 @@