Jelajahi Sumber

时钟组件调整

zhangjie 2 tahun lalu
induk
melakukan
102c7ca8d8
1 mengubah file dengan 10 tambahan dan 5 penghapusan
  1. 10 5
      src/features/invigilation/common/TextClock.vue

+ 10 - 5
src/features/invigilation/common/TextClock.vue

@@ -45,11 +45,16 @@ export default {
       if (this.showWeek) infos.push(weekDay);
 
       const hourNum = now.getHours();
-      const val = hourNum > 12 ? hourNum - 12 : hourNum;
-      const hour = ("00" + val).substr(("" + val).length);
-      const apm = hourNum < 12 ? "上午" : "下午";
-      if (this.showApm) infos.push(apm);
-      infos.push(`${hour}:${timeStr[1]}`);
+      if (this.showApm) {
+        const val = hourNum > 12 ? hourNum - 12 : hourNum;
+        const hour = ("00" + val).substr(("" + val).length);
+        const apm = hourNum < 12 ? "上午" : "下午";
+        infos.push(apm);
+        infos.push(`${hour}:${timeStr[1]}`);
+      } else {
+        const hour = ("00" + hourNum).substr(("" + hourNum).length);
+        infos.push(`${hour}:${timeStr[1]}`);
+      }
 
       this.text = infos.join(" ");
     },