From 8d42fd0eaeaf86074029603e5726bab6a4641e51 Mon Sep 17 00:00:00 2001
From: chenyc <501753378@qq.com>
Date: 星期五, 25 七月 2025 15:07:32 +0800
Subject: [PATCH] Merge branch 'test' of http://dh.leon056.com:7499/r/data2/Single_application into test

---
 src/views/mobile/bedsideAuxiliaryScreen/components/TimePicker.vue |   48 ++++++++++++++++++++++++++++++++++--------------
 1 files changed, 34 insertions(+), 14 deletions(-)

diff --git a/src/views/mobile/bedsideAuxiliaryScreen/components/TimePicker.vue b/src/views/mobile/bedsideAuxiliaryScreen/components/TimePicker.vue
index 4a18241..61b1444 100644
--- a/src/views/mobile/bedsideAuxiliaryScreen/components/TimePicker.vue
+++ b/src/views/mobile/bedsideAuxiliaryScreen/components/TimePicker.vue
@@ -46,7 +46,7 @@
 const hourRef = ref<HTMLElement | null>(null);
 const minuteRef = ref<HTMLElement | null>(null);
 
-const ITEM_REM = 0.4;
+const ITEM_REM = 0.26;
 const itemHeight = remToPx(ITEM_REM);
 
 const selectedIndexHour = ref(2);
@@ -86,6 +86,27 @@
       .padStart(2, "0")}`,
   (val) => {
     emit("update:modelValue", val);
+  }
+);
+
+watch(
+  () => props.modelValue,
+  (newVal) => {
+    const [h, m] = newVal.split(":").map(Number);
+    const hourIdx = hours.indexOf(h);
+    const minuteIdx = minutes.indexOf(m);
+
+    if (hourIdx !== -1) {
+      selectedIndexHour.value = hourIdx + 2;
+      selectedHour.value = h;
+      scrollToSelected("hour", selectedIndexHour.value);
+    }
+
+    if (minuteIdx !== -1) {
+      selectedIndexMinute.value = minuteIdx + 2;
+      selectedMinute.value = m;
+      scrollToSelected("minute", selectedIndexMinute.value);
+    }
   }
 );
 
@@ -162,12 +183,12 @@
   display: flex;
   align-items: center;
   justify-content: center;
-  height: 2rem; // 5 * 0.4rem 每个item高度0.4rem
+  height: 1.3rem; // 5 * 0.4rem 每个item高度0.4rem
   overflow: hidden;
 
   .picker-column {
-    height: 2rem;
-    width: 0.9rem;
+    height: 1.3rem;
+    width: 0.7rem;
     overflow-y: scroll;
     scroll-snap-type: y mandatory;
     -webkit-overflow-scrolling: touch;
@@ -178,18 +199,17 @@
     }
 
     .picker-item {
-      height: 0.4rem;
-      line-height: 0.4rem;
+      height: 0.26rem;
+      line-height: 0.26rem;
       text-align: center;
-      font-size: 0.24rem;
+      font-size: 0.2rem;
       scroll-snap-align: center;
       user-select: none;
       cursor: pointer;
       transition: color 0.3s ease, font-size 0.3s ease;
 
-
       &.active {
-        font-size: 0.5rem;
+        font-size: 0.28rem;
         font-weight: 700;
         color: #111;
         &.hours {
@@ -200,26 +220,26 @@
         }
       }
       &.medium {
-        font-size: 0.3rem;
+        font-size: 0.22rem;
         color: #666;
         &.hours {
           text-align: left;
-          padding-left: 0.2rem;
+          padding-left: 0.16rem;
         }
         &.minutes {
           text-align: right;
-          padding-right: 0.2rem;
+          padding-right: 0.16rem;
         }
       }
       &.small {
-        font-size: 0.24rem;
+        font-size: 0.18rem;
         color: #aaa;
       }
     }
   }
 
   .colon {
-    font-size: 0.5rem;
+    font-size: 0.28rem;
     font-weight: 600;
     color: #444;
     user-select: none;

--
Gitblit v1.8.0