From f33003eb04816447521304d75c5c779d1fc58b05 Mon Sep 17 00:00:00 2001 From: liwenhao <1273011930@qq.com> Date: Wed, 28 May 2025 15:22:14 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=82=A1=E7=A5=A8=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/myHome/size1440/index.vue | 46 +++------------------------ src/views/myHome/size1920/index.vue | 43 ++------------------------ src/views/myHome/size375/index.vue | 48 +++-------------------------- src/views/myHome/size768/index.vue | 46 +++------------------------ 4 files changed, 15 insertions(+), 168 deletions(-) diff --git a/src/views/myHome/size1440/index.vue b/src/views/myHome/size1440/index.vue index 574a707..23faba7 100644 --- a/src/views/myHome/size1440/index.vue +++ b/src/views/myHome/size1440/index.vue @@ -99,7 +99,7 @@
Time {{ - formattedDate + formatted }}
@@ -114,8 +114,9 @@ {{ $t("HOME.CONTAINY.STOCK_INFO.CHANGE") }} - {{ stockQuote.change[0] }}{{ stockQuote.change[1] }}{{ stockQuote.change?.[0] || "" }} + {{ stockQuote.change?.[1] || "" }}
@@ -199,45 +200,6 @@ const { getStockQuate, stockQuote, formatted } = useStockQuote(); getStockQuate(); -const formatCustomDate = (dateString, timeZone = "EDT") => { - // 尝试解析日期 - const date = new Date(dateString); - - // 验证日期有效性 - if (isNaN(date.getTime())) { - return "Invalid Date"; - } - - // 从原始字符串提取 AM/PM - const periodMatch = dateString.match(/(AM|PM)/i); - const period = periodMatch ? periodMatch[0] : "AM"; // 默认 AM(如果没有匹配到) - - // 提取小时和分钟(基于 Date 对象,避免时区影响) - let hours = date.getHours(); - const minutes = date.getMinutes().toString().padStart(2, "0"); - - // 转换为 12 小时制 - let displayHours = hours % 12; - displayHours = displayHours || 12; // 0 显示为 12 - - // 时间部分(如 2:44AM) - const timePart = `${displayHours}:${minutes}${period}`; - - // 日期部分(如 EDT 26/05/25) - const day = date.getDate().toString().padStart(2, "0"); - const month = (date.getMonth() + 1).toString().padStart(2, "0"); - const year = date.getFullYear().toString(); // 取后两位 - - const datePart = `${timeZone} ${day}/${month}/${year}`; - - // 组合最终结果 - return `As of ${timePart} ${datePart}`; -}; - -// 示例数据 -const sampleDate = ref(formatted); -const formattedDate = computed(() => formatCustomDate(sampleDate.value)); - const { t: $t } = useI18n(); const contentRef = ref(null); const isInView = ref(false); diff --git a/src/views/myHome/size1920/index.vue b/src/views/myHome/size1920/index.vue index 83ee6b0..8f394b3 100644 --- a/src/views/myHome/size1920/index.vue +++ b/src/views/myHome/size1920/index.vue @@ -97,7 +97,7 @@
Time - {{ formattedDate }} + {{ sampleDate }}
{{ @@ -110,7 +110,8 @@ $t("HOME.CONTAINY.STOCK_INFO.CHANGE") }} {{ stockQuote.change[0] }}{{ stockQuote.change[1] }}{{ stockQuote.change?.[0] || "" }} + {{ stockQuote.change?.[1] || "" }}
@@ -185,47 +186,9 @@ import { onMounted, ref, onUnmounted, computed } from "vue"; import { useI18n } from "vue-i18n"; import { useStockQuote } from "@/store/stock-quote/index.js"; const { getStockQuate, stockQuote, formatted } = useStockQuote(); - getStockQuate(); - -const formatCustomDate = (dateString, timeZone = "EDT") => { - // 尝试解析日期 - const date = new Date(dateString); - - // 验证日期有效性 - if (isNaN(date.getTime())) { - return "Invalid Date"; - } - - // 从原始字符串提取 AM/PM - const periodMatch = dateString.match(/(AM|PM)/i); - const period = periodMatch ? periodMatch[0] : "AM"; // 默认 AM(如果没有匹配到) - - // 提取小时和分钟(基于 Date 对象,避免时区影响) - let hours = date.getHours(); - const minutes = date.getMinutes().toString().padStart(2, "0"); - - // 转换为 12 小时制 - let displayHours = hours % 12; - displayHours = displayHours || 12; // 0 显示为 12 - - // 时间部分(如 2:44AM) - const timePart = `${displayHours}:${minutes}${period}`; - - // 日期部分(如 EDT 26/05/25) - const day = date.getDate().toString().padStart(2, "0"); - const month = (date.getMonth() + 1).toString().padStart(2, "0"); - const year = date.getFullYear().toString(); // 取后两位 - - const datePart = `${timeZone} ${day}/${month}/${year}`; - - // 组合最终结果 - return `As of ${timePart} ${datePart}`; -}; - // 示例数据 const sampleDate = ref(formatted); -const formattedDate = computed(() => formatCustomDate(sampleDate.value)); const { t: $t } = useI18n(); const contentRef = ref(null); diff --git a/src/views/myHome/size375/index.vue b/src/views/myHome/size375/index.vue index 574a707..616404e 100644 --- a/src/views/myHome/size375/index.vue +++ b/src/views/myHome/size375/index.vue @@ -99,7 +99,7 @@
Time {{ - formattedDate + formatted }}
@@ -114,8 +114,9 @@ {{ $t("HOME.CONTAINY.STOCK_INFO.CHANGE") }} - {{ stockQuote.change[0] }}{{ stockQuote.change[1] }}{{ stockQuote.change?.[0] || "" }} + {{ stockQuote.change?.[1] || "" }}
@@ -196,48 +197,7 @@ import { onMounted, ref, onUnmounted, computed } from "vue"; import { useI18n } from "vue-i18n"; import { useStockQuote } from "@/store/stock-quote/index.js"; const { getStockQuate, stockQuote, formatted } = useStockQuote(); - getStockQuate(); - -const formatCustomDate = (dateString, timeZone = "EDT") => { - // 尝试解析日期 - const date = new Date(dateString); - - // 验证日期有效性 - if (isNaN(date.getTime())) { - return "Invalid Date"; - } - - // 从原始字符串提取 AM/PM - const periodMatch = dateString.match(/(AM|PM)/i); - const period = periodMatch ? periodMatch[0] : "AM"; // 默认 AM(如果没有匹配到) - - // 提取小时和分钟(基于 Date 对象,避免时区影响) - let hours = date.getHours(); - const minutes = date.getMinutes().toString().padStart(2, "0"); - - // 转换为 12 小时制 - let displayHours = hours % 12; - displayHours = displayHours || 12; // 0 显示为 12 - - // 时间部分(如 2:44AM) - const timePart = `${displayHours}:${minutes}${period}`; - - // 日期部分(如 EDT 26/05/25) - const day = date.getDate().toString().padStart(2, "0"); - const month = (date.getMonth() + 1).toString().padStart(2, "0"); - const year = date.getFullYear().toString(); // 取后两位 - - const datePart = `${timeZone} ${day}/${month}/${year}`; - - // 组合最终结果 - return `As of ${timePart} ${datePart}`; -}; - -// 示例数据 -const sampleDate = ref(formatted); -const formattedDate = computed(() => formatCustomDate(sampleDate.value)); - const { t: $t } = useI18n(); const contentRef = ref(null); const isInView = ref(false); diff --git a/src/views/myHome/size768/index.vue b/src/views/myHome/size768/index.vue index 574a707..23faba7 100644 --- a/src/views/myHome/size768/index.vue +++ b/src/views/myHome/size768/index.vue @@ -99,7 +99,7 @@
Time {{ - formattedDate + formatted }}
@@ -114,8 +114,9 @@ {{ $t("HOME.CONTAINY.STOCK_INFO.CHANGE") }} - {{ stockQuote.change[0] }}{{ stockQuote.change[1] }}{{ stockQuote.change?.[0] || "" }} + {{ stockQuote.change?.[1] || "" }}
@@ -199,45 +200,6 @@ const { getStockQuate, stockQuote, formatted } = useStockQuote(); getStockQuate(); -const formatCustomDate = (dateString, timeZone = "EDT") => { - // 尝试解析日期 - const date = new Date(dateString); - - // 验证日期有效性 - if (isNaN(date.getTime())) { - return "Invalid Date"; - } - - // 从原始字符串提取 AM/PM - const periodMatch = dateString.match(/(AM|PM)/i); - const period = periodMatch ? periodMatch[0] : "AM"; // 默认 AM(如果没有匹配到) - - // 提取小时和分钟(基于 Date 对象,避免时区影响) - let hours = date.getHours(); - const minutes = date.getMinutes().toString().padStart(2, "0"); - - // 转换为 12 小时制 - let displayHours = hours % 12; - displayHours = displayHours || 12; // 0 显示为 12 - - // 时间部分(如 2:44AM) - const timePart = `${displayHours}:${minutes}${period}`; - - // 日期部分(如 EDT 26/05/25) - const day = date.getDate().toString().padStart(2, "0"); - const month = (date.getMonth() + 1).toString().padStart(2, "0"); - const year = date.getFullYear().toString(); // 取后两位 - - const datePart = `${timeZone} ${day}/${month}/${year}`; - - // 组合最终结果 - return `As of ${timePart} ${datePart}`; -}; - -// 示例数据 -const sampleDate = ref(formatted); -const formattedDate = computed(() => formatCustomDate(sampleDate.value)); - const { t: $t } = useI18n(); const contentRef = ref(null); const isInView = ref(false); From caf62145a0c67cbacbe6e1b216fa1f96ea0bb4f2 Mon Sep 17 00:00:00 2001 From: liwenhao <1273011930@qq.com> Date: Wed, 28 May 2025 15:23:47 +0800 Subject: [PATCH 2/2] =?UTF-8?q?change=20=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/myHome/size1440/index.vue | 4 ++-- src/views/myHome/size1920/index.vue | 4 ++-- src/views/myHome/size375/index.vue | 4 ++-- src/views/myHome/size768/index.vue | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/views/myHome/size1440/index.vue b/src/views/myHome/size1440/index.vue index 23faba7..3130ead 100644 --- a/src/views/myHome/size1440/index.vue +++ b/src/views/myHome/size1440/index.vue @@ -115,8 +115,8 @@ $t("HOME.CONTAINY.STOCK_INFO.CHANGE") }} {{ stockQuote.change?.[0] || "" }} - {{ stockQuote.change?.[1] || "" }}{{ stockQuote.change?.[0] || "--" }} + {{ stockQuote.change?.[1] || "--" }}
diff --git a/src/views/myHome/size1920/index.vue b/src/views/myHome/size1920/index.vue index 8f394b3..05d43be 100644 --- a/src/views/myHome/size1920/index.vue +++ b/src/views/myHome/size1920/index.vue @@ -110,8 +110,8 @@ $t("HOME.CONTAINY.STOCK_INFO.CHANGE") }} {{ stockQuote.change?.[0] || "" }} - {{ stockQuote.change?.[1] || "" }}{{ stockQuote.change?.[0] || "--" }} + {{ stockQuote.change?.[1] || "--" }}
diff --git a/src/views/myHome/size375/index.vue b/src/views/myHome/size375/index.vue index 616404e..cc421dd 100644 --- a/src/views/myHome/size375/index.vue +++ b/src/views/myHome/size375/index.vue @@ -115,8 +115,8 @@ $t("HOME.CONTAINY.STOCK_INFO.CHANGE") }} {{ stockQuote.change?.[0] || "" }} - {{ stockQuote.change?.[1] || "" }}{{ stockQuote.change?.[0] || "--" }} + {{ stockQuote.change?.[1] || "--" }}
diff --git a/src/views/myHome/size768/index.vue b/src/views/myHome/size768/index.vue index 23faba7..3130ead 100644 --- a/src/views/myHome/size768/index.vue +++ b/src/views/myHome/size768/index.vue @@ -115,8 +115,8 @@ $t("HOME.CONTAINY.STOCK_INFO.CHANGE") }} {{ stockQuote.change?.[0] || "" }} - {{ stockQuote.change?.[1] || "" }}{{ stockQuote.change?.[0] || "--" }} + {{ stockQuote.change?.[1] || "--" }}