From 60f5296dcbdcdc1203984a2598977b10cb511316 Mon Sep 17 00:00:00 2001
From: Han <1655466387@qq.com>
Date: Mon, 24 Feb 2025 18:27:49 +0800
Subject: [PATCH] =?UTF-8?q?=20=E4=BC=98=E5=8C=96=E2=9C=85?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/Aside.astro | 14 ++++++++------
src/styles/components/ArticleCard.less | 9 +++++++++
src/utils/index.ts | 21 +++++----------------
3 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/src/components/Aside.astro b/src/components/Aside.astro
index db7816f..1107ff7 100644
--- a/src/components/Aside.astro
+++ b/src/components/Aside.astro
@@ -42,12 +42,14 @@ import "../styles/components/Aside.less";
分类
diff --git a/src/styles/components/ArticleCard.less b/src/styles/components/ArticleCard.less
index 5ca24c3..02bbe9e 100644
--- a/src/styles/components/ArticleCard.less
+++ b/src/styles/components/ArticleCard.less
@@ -110,6 +110,15 @@ section.article-list {
/* 默认渐变色结束 */
--gradient-color-3: #66ff99;
}
+
+ &.vh-categories-Share {
+ /* 默认渐变色起始 */
+ --gradient-color-1: rgb(240, 45, 133);
+ /* 默认渐变色中间 */
+ --gradient-color-2: #f95ba5;
+ /* 默认渐变色结束 */
+ --gradient-color-3: #f4bdd0;
+ }
}
&>.title {
diff --git a/src/utils/index.ts b/src/utils/index.ts
index aa22639..736c427 100644
--- a/src/utils/index.ts
+++ b/src/utils/index.ts
@@ -9,7 +9,7 @@ dayjs.locale('zh-cn');
// 获取文章的描述
const getDescription = (post: any, num: number = 150) => (post.rendered ? post.rendered.html.replace(/<[^>]+>/g, "").replace(/\s+/g, "") : post.body.replace(/\n/g, "").replace(/#/g, "")).slice(0, num) || '暂无简介'
//处理时间
-const fmtTime = (time: any, fmt: string = 'MMMM D, YYYY') => dayjs(time).tz('America/New_York').format(fmt)
+const fmtTime = (time: any, fmt: string = 'MMMM D, YYYY') => dayjs(time).utc().format(fmt)
// 处理日期
const fmtDate = (time: string | Date) => {
const now = dayjs();
@@ -81,13 +81,8 @@ const LoadStyle = (href: string): Promise => {
// 请求封装
const $GET = async (url: string, headers: Record = {}): Promise => {
try {
- const res = await fetch(url, {
- method: "GET",
- headers: headers,
- });
- if (!res.ok) {
- throw new Error(`HTTP error! Status: ${res.status}`);
- }
+ const res = await fetch(url, { method: "GET", headers: headers, });
+ if (!res.ok) throw new Error(`HTTP error! Status: ${res.status}`);
return res.json();
} catch (error) {
console.error("GET request failed:", error);
@@ -97,14 +92,8 @@ const $GET = async (url: string, headers: Record = {}): Promise<
const $POST = async (url: string, data: Record, headers: Record = {}): Promise => {
try {
- const res = await fetch(url, {
- method: "POST",
- headers: { ...headers, },
- body: JSON.stringify(data),
- });
- if (!res.ok) {
- throw new Error(`HTTP error! Status: ${res.status}`);
- }
+ const res = await fetch(url, { method: "POST", headers: { ...headers, }, body: JSON.stringify(data), });
+ if (!res.ok) throw new Error(`HTTP error! Status: ${res.status}`);
return res.json(); // 解析 JSON 数据
} catch (error) {
console.error("POST request failed:", error);