feat: add March summary post and sponsor page
- Created a new post summarizing activities in March 2025, including learning SpringBoot and social interactions. - Added a new sponsor page with support for displaying sponsorship methods, QR codes, and a list of sponsors. - Implemented comment functionality on the sponsor page, with checks for configuration settings. - Enhanced layout and styling for better user experience on the sponsor page.
This commit is contained in:
@@ -423,18 +423,6 @@ async function generatePoster() {
|
||||
);
|
||||
}
|
||||
|
||||
// Site Info (Left of QR)
|
||||
const siteInfoX = qrX - 16 * scale;
|
||||
ctx.textAlign = "right";
|
||||
|
||||
ctx.fillStyle = "#9ca3af";
|
||||
ctx.font = `${12 * scale}px 'Roboto', sans-serif`;
|
||||
ctx.fillText(i18n(I18nKey.scanToRead), siteInfoX, textCenterY - 20 * scale);
|
||||
|
||||
ctx.fillStyle = "#1f2937";
|
||||
ctx.font = `700 ${20 * scale}px 'Roboto', sans-serif`;
|
||||
ctx.fillText(siteTitle, siteInfoX, textCenterY + 4 * scale);
|
||||
|
||||
// Finalize
|
||||
posterImage = canvas.toDataURL("image/png");
|
||||
generating = false;
|
||||
|
||||
@@ -76,8 +76,7 @@ export const backgroundWallpaper: BackgroundWallpaperConfig = {
|
||||
titleSize: "3.8rem",
|
||||
// 主页横幅副标题
|
||||
subtitle: [
|
||||
"Vivo de mis sueños, porque la realidad es muy corta.",
|
||||
"No por mucho madrugar amanece más temprano."
|
||||
"爱能克服远距离 多远都要在一起"
|
||||
],
|
||||
// 主页横幅副标题字体大小
|
||||
subtitleSize: "1.5rem",
|
||||
|
||||
@@ -241,7 +241,7 @@ export const sidebarLayoutConfig: SidebarLayoutConfig = {
|
||||
// 组件类型:音乐播放器
|
||||
type: "music",
|
||||
// 是否启用该组件
|
||||
enable: true,
|
||||
enable: false,
|
||||
// 是否在文章详情页显示
|
||||
showOnPostPage: true,
|
||||
},
|
||||
|
||||
@@ -96,7 +96,7 @@ export const siteConfig: SiteConfig = {
|
||||
// 页面开关配置
|
||||
pages: {
|
||||
friends: true,
|
||||
sponsor: false,
|
||||
sponsor: true,
|
||||
guestbook: false,
|
||||
bangumi: false,
|
||||
gallery: false,
|
||||
|
||||
+15
-15
@@ -26,7 +26,7 @@ export const sponsorConfig: SponsorConfig = {
|
||||
name: "支付宝",
|
||||
icon: "fa7-brands:alipay",
|
||||
// 收款码图片路径(需要放在 public 目录下)
|
||||
qrCode: "/assets/images/sponsor/alipay.png",
|
||||
qrCode: "/assets/images/sponsor/alipay.jpg",
|
||||
link: "",
|
||||
description: "使用 支付宝 扫码打赏",
|
||||
enabled: true,
|
||||
@@ -43,7 +43,7 @@ export const sponsorConfig: SponsorConfig = {
|
||||
name: "ko-fi",
|
||||
icon: "simple-icons:kofi",
|
||||
qrCode: "",
|
||||
link: "https://ko-fi.com/cuteleaf",
|
||||
link: "https://ko-fi.com/blackcyan",
|
||||
description: "Buy a Coffee for Firefly",
|
||||
enabled: true,
|
||||
},
|
||||
@@ -60,20 +60,20 @@ export const sponsorConfig: SponsorConfig = {
|
||||
// 打赏者列表(可选)
|
||||
sponsors: [
|
||||
// 示例:已实名打赏者
|
||||
{
|
||||
name: "夏叶",
|
||||
avatar:
|
||||
"https://weavatar.com/avatar/d252655d40d6874417a720bad0a6c5f77f8f6a1fd2f882f8f338402dc37e4190?s=640",
|
||||
amount: "¥50",
|
||||
date: "2025-10-01",
|
||||
},
|
||||
// {
|
||||
// name: "夏叶",
|
||||
// avatar:
|
||||
// "https://weavatar.com/avatar/d252655d40d6874417a720bad0a6c5f77f8f6a1fd2f882f8f338402dc37e4190?s=640",
|
||||
// amount: "¥50",
|
||||
// date: "2025-10-01",
|
||||
// },
|
||||
|
||||
// 示例:匿名打赏者
|
||||
{
|
||||
name: "匿名用户",
|
||||
// avatar: "",
|
||||
amount: "¥20",
|
||||
date: "2025-10-01",
|
||||
},
|
||||
// {
|
||||
// name: "匿名用户",
|
||||
// // avatar: "",
|
||||
// amount: "¥20",
|
||||
// date: "2025-10-01",
|
||||
// },
|
||||
],
|
||||
};
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
---
|
||||
title: 关于 5 月 14 日在写博客时发现的代码高亮显示问题
|
||||
title: Prism.js C++ 代码高亮不生效的解决方法
|
||||
published: 2025-05-15
|
||||
tags: ["博客", "代码高亮"]
|
||||
tags: ["博客", "代码高亮", "Prism.js", "前端", "踩坑"]
|
||||
category: 技术
|
||||
description: 关于 5 月 14 日在写博客时发现的代码高亮显示问题
|
||||
description: 使用 Prism.js 实现 C++ 代码高亮时发现需要先引入 prism-c.min.js 才能生效,记录一次博客开发中的踩坑经历
|
||||
---
|
||||
|
||||
昨天在写博客的时候,调用了 Prism 的 cpp 代码高亮显示:
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
---
|
||||
title: C++ 输入输出流的 operator
|
||||
title: C++ 输入输出流运算符重载为什么用友元函数
|
||||
published: 2025-05-14
|
||||
tags: ["C++", "IO流"]
|
||||
tags: ["C++", "运算符重载", "友元函数", "IO流", "C++基础"]
|
||||
category: 技术
|
||||
description: C++ 输入输出流的 operator
|
||||
description: 深入理解 C++ 中 std::ostream 和 std::istream 的 << >> 运算符重载必须使用友元函数而非成员函数的原因,涉及 this 指针与左操作数绑定机制。
|
||||
---
|
||||
|
||||
今天是朝鲜主体历114年5月14日 (喜)
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
---
|
||||
title: 在 Fedora 上启用 ntfs3 文件系统驱动
|
||||
title: Fedora 启用 ntfs3 内核驱动提升 NTFS 读写性能
|
||||
published: 2026-07-24
|
||||
tags: ["Linux", "文件系统"]
|
||||
updated: 2026-09-03
|
||||
pinned: true
|
||||
tags: ["Linux", "文件系统", "NTFS", "ntfs3", "Fedora", "内核模块", "NVMe"]
|
||||
category: 技术
|
||||
description: 让 NTFS 在 Fedora 上的读写速度更上一层楼
|
||||
description: 在 Fedora 上启用 Linux 内核原生 ntfs3 驱动以替代 ntfs-3g,大幅提升 NTFS 移动硬盘读写速度,包含内核模块检查、mount 配置及双系统注意事项。
|
||||
image: "./ensure-ntfs3-on-fedora/paragon-ntfs3.avif"
|
||||
---
|
||||
|
||||
前几天突然想起来自己还有一个 256G 的 NVMe SSD,是大一的时候买来当移动硬盘用的,可惜之前两次由于对这方面知识的欠缺,购买的硬盘盒都比较差劲,硬盘就一直搁置着。现如今,我还是认为自己需要一个移动硬盘,于是又新购入了一个硬盘盒。组装好后,我尝试在 Fedora 上测试它的读写速度,发现原本理论上是 10 Gbps 的传输速度,在使用 `dd` 测试顺序写入时,平均速度只有约 142 MB/s!我查阅了大量资料,发现貌似是文件系统的原因,我的硬盘使用的文件系统是 NTFS,而我并不想改用别的文件系统,所以只能找找看有没有两全其美的办法。
|
||||
@@ -18,9 +21,8 @@ description: 让 NTFS 在 Fedora 上的读写速度更上一层楼
|
||||
|
||||
`ntfs3` 是 Linux 内核中的一个原生 ntfs 读写文件系统驱动,由 [Paragon Software Group](https://www.paragon-software.com/about/) 开发并贡献给 Linux 内核,在 Linux v5.15-rc1 的 commit [f746406](https://github.com/torvalds/linux/commit/f7464060f7ab9a2424428008f0ee9f1e267e410f) 中正式合并。它的目标是替代早期 Linux 内核中功能有限的只读 ntfs 驱动以及基于 FUSE 的 ntfs-3g。
|
||||
|
||||
## 注意事项
|
||||
|
||||
如果你的电脑是 Windows 与 Linux 双系统,那么请[关闭 Windows 的快速启动](https://learn.microsoft.com/zh-cn/troubleshoot/windows-client/setup-upgrade-and-drivers/wake-on-lan-feature?utm_source=chatgpt.com#more-information)。Windows 的快速启动本质上是休眠,即将完整的内存快照写入到磁盘,在下次启动 Windows 时再将其还原到内存,从而达到快速启动的效果。使用 ntfs3 挂载 Windows 系统盘并写入数据时,有可能会破坏这部分数据,进而造成 Windows 系统在启动时出现不同程度的异常。
|
||||
> [!WARNING]
|
||||
> 如果你的电脑是 Windows 与 Linux 双系统,那么请[关闭 Windows 的快速启动](https://learn.microsoft.com/zh-cn/troubleshoot/windows-client/setup-upgrade-and-drivers/wake-on-lan-feature?utm_source=chatgpt.com#more-information)。Windows 的快速启动本质上是休眠,即将完整的内存快照写入到磁盘,在下次启动 Windows 时再将其还原到内存,从而达到快速启动的效果。使用 ntfs3 挂载 Windows 系统盘并写入数据时,有可能会破坏这部分数据,进而造成 Windows 系统在启动时出现不同程度的异常。
|
||||
|
||||
## 开始使用
|
||||
|
||||
@@ -38,7 +40,8 @@ grep ntfs3 /proc/filesystems
|
||||
sudo modprobe ntfs3
|
||||
```
|
||||
|
||||
> 注意:Linux 内核从 5.15 开始正式合并 ntfs3 驱动,如果不确定你的内核版本,可使用 `uname -r` 来确认。
|
||||
> [!NOTE]
|
||||
> Linux 内核从 5.15 开始正式合并 ntfs3 驱动,如果不确定你的内核版本,可使用 `uname -r` 来确认。
|
||||
|
||||
### 挂载
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 6.4 KiB |
@@ -1,9 +1,9 @@
|
||||
---
|
||||
title: 高斯-约旦消元法的 Kotlin 实现
|
||||
title: 高斯-约旦消元法的 Kotlin 实现:矩阵行最简形式与秩的计算
|
||||
published: 2025-06-24
|
||||
tags: ["Kotlin", "算法", "线性代数"]
|
||||
tags: ["Kotlin", "算法", "线性代数", "矩阵", "高斯消元"]
|
||||
category: 技术
|
||||
description: 高斯-约旦消元法的 Kotlin 实现
|
||||
description: 使用 Kotlin 实现高斯-约旦消元法(Gauss-Jordan Elimination),将矩阵化为行最简阶梯形矩阵(RREF),并计算矩阵的秩,附完整代码。
|
||||
---
|
||||
|
||||
最让我头疼的几门课已经考完试了,讲讲前几天复习线性代数的时候学到的东西
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
---
|
||||
title: Kotlin 输出 HelloWorld
|
||||
title: Kotlin 入门:Hello World 与基础语法
|
||||
published: 2025-01-18
|
||||
tags: ["Kotlin", "入门"]
|
||||
tags: ["Kotlin", "入门", "JVM", "Kotlin基础"]
|
||||
category: 技术
|
||||
description: Kotlin 输出 HelloWorld
|
||||
description: Kotlin 语言入门第一篇,介绍如何用 Kotlin 输出 Hello World,涵盖 main 函数、println、集合遍历等基础语法,适合零基础新手。
|
||||
---
|
||||
|
||||
以下是Kotlin输出"Hello, world!"的简单代码:
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
---
|
||||
title: Kruskal 算法与 Prim 算法
|
||||
title: Kruskal 与 Prim 最小生成树算法详解(Kotlin 实现)
|
||||
published: 2025-06-25
|
||||
tags: ["算法", "图论", "Kruskal", "Prim", "Kotlin"]
|
||||
tags: ["算法", "图论", "最小生成树", "Kruskal", "Prim", "Kotlin", "并查集"]
|
||||
category: 技术
|
||||
description: Kruskal 算法与 Prim 算法
|
||||
description: 图论经典算法 Kruskal 和 Prim 求解最小生成树(MST)的原理与 Kotlin 实现,包含贪心策略、并查集、邻接矩阵等核心知识点。
|
||||
---
|
||||
|
||||
Kruskal 算法与 Prim 算法是图论中经典的算法,用于求解最小生成树问题。
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
---
|
||||
title: 在 Linux 上配置树莓派 4B OpenCV 交叉编译
|
||||
title: 树莓派 4B OpenCV 交叉编译完整指南(Linux + Docker)
|
||||
published: 2026-07-18
|
||||
tags: ["Linux", "交叉编译", "C++", "树莓派", "OpenCV", "Docker"]
|
||||
tags: ["Linux", "交叉编译", "C++", "树莓派", "OpenCV", "Docker", "CMake", "ARM"]
|
||||
category: 技术
|
||||
description: 在 Linux 上配置树莓派 4B OpenCV 交叉编译,包含非 Debian 系发行版的容器化方案
|
||||
description: 在 x86 Linux 上为树莓派 4B 配置 OpenCV C++ 交叉编译环境的完整教程,涵盖根文件系统同步、交叉工具链配置、Docker 容器化方案及 CMake 集成。
|
||||
---
|
||||
|
||||
这两天大家都在火热地准备电赛,我也不例外。去年我使用的摄像头是 [MaixCam Pro](https://wiki.sipeed.com/hardware/zh/maixcam/maixcam_pro.html),编程语言我选择了 Python,使用了 [MaixPy](https://github.com/sipeed/MaixPy) 和 [Python OpenCV](https://github.com/opencv/opencv-python) 库。苦于性能瓶颈,今年我打算用 C++ 重写图像处理逻辑,目标平台是[树莓派 4B](https://www.raspberrypi.com/products/raspberry-pi-4-model-b/)。
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
---
|
||||
title: Sipeed 麦克风阵列获取声源角度
|
||||
title: Sipeed 麦克风阵列声源定位:MicroPython 获取声源角度
|
||||
published: 2025-07-06
|
||||
tags: ["Sipeed", "麦克风阵列", "声源定位"]
|
||||
tags: ["Sipeed", "麦克风阵列", "声源定位", "MicroPython", "MaixPy", "嵌入式", "DOA"]
|
||||
category: 技术
|
||||
description: Sipeed 麦克风阵列获取声源角度
|
||||
description: 使用 Sipeed MicArray 麦克风阵列模块进行声源定位(DOA),通过 MicroPython / MaixPy 获取声源方向角度并驱动 RGB LED 显示,附官方示例代码。
|
||||
---
|
||||
|
||||
官方文档:[MicArray 麦克风阵列 - Sipeed Wiki](https://wiki.sipeed.com/hardware/zh/modules/micarray.html)
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
---
|
||||
title: 一年了
|
||||
published: 2026-01-10
|
||||
tags: ["博客", "周年"]
|
||||
category: 杂谈
|
||||
description: 大学生活过得真快啊
|
||||
---
|
||||
|
||||
时间过得真快啊,网站不知不觉已经要一年了
|
||||
|
||||
前不久申请了宝塔砺行计划,最近给老师发邮件的时候才发现申请通过了,于是我马上为我的云服务器部署了宝塔面板(嘻嘻)
|
||||
|
||||
宝塔面板确实十分方便,他们推出的砺行计划对学生用户也十分有帮助,如果大家有条件的话,推荐大家都去申请一下
|
||||
|
||||
在 2026 年,我决定先修一下算法,然后尽量掌握 Jetpack Compose 安卓开发。看见网上很多人说学这个没用,国内没啥公司用这个写安卓,我想说的是,技术从来不应该通过有没有被广泛使用来衡量其必要性。不管是什么技术栈,其在传播时肯定不是第一天无人问津而第二天就做到家喻户晓的。有许多人愿意学习这门技术并且传播,就说明这门技术有前景有希望,并不会被一两盆冷水淹没。总之就一句话:程序员要多学、多练,而不是整天卖弄自己的才华,嘴里蹦出几个高级的专业词汇来唬人,然后对某门技术栈评头论足,去争个高低贵贱。
|
||||
@@ -5,8 +5,8 @@
|
||||
- **昵称:** 墨青 / BlackCyan / Cyanus Nigrius
|
||||
- **专业:** 软件工程
|
||||
- **语言:** 中文 / English
|
||||
- **编程语言:** Java, Kotlin, Python, HTML/CSS, C++
|
||||
- **技术栈:** Android 开发,KMP
|
||||
- **编程语言:** <img src="/assets/images/badge-java.svg" alt="Java" style="display:inline;vertical-align:middle;margin:2px" /> <img src="/assets/images/badge-kotlin.svg" alt="Kotlin" style="display:inline;vertical-align:middle;margin:2px" /> <img src="/assets/images/badge-python.svg" alt="Python" style="display:inline;vertical-align:middle;margin:2px" /> <img src="/assets/images/badge-c.svg" alt="C" style="display:inline;vertical-align:middle;margin:2px" />
|
||||
- **技术栈:** <img src="/assets/images/badge-android.svg" alt="Android" style="display:inline;vertical-align:middle;margin:2px" /> <img src="/assets/images/badge-kmp.svg" alt="KMP" style="display:inline;vertical-align:middle;margin:2px" />
|
||||
- **兴趣爱好:** 编程, 游戏, 音乐, 美食
|
||||
|
||||
---
|
||||
@@ -21,16 +21,15 @@
|
||||
|
||||
---
|
||||
|
||||
## 标签
|
||||
## 印象标签
|
||||
|
||||
- 二次元
|
||||
- Furry
|
||||
- Minecraft
|
||||
- 火影忍者
|
||||
- 时光代理人
|
||||
- 开源
|
||||
- 反对内卷
|
||||
- 反对 AI 绘画、音乐
|
||||
- 反内卷
|
||||
- 反 AI (画作、乐曲)
|
||||
|
||||
---
|
||||
|
||||
@@ -40,7 +39,7 @@
|
||||
|
||||
我喜欢捣鼓各种编程语言,容易写码上瘾,一写就是几小时甚至一天。最喜欢的语言是能够在 JVM 上运行的语言,如 Java 与 Kotlin。
|
||||
|
||||
我不喜欢 AI 绘画与 AI 音乐,请不要随意地将 AI 创作的艺术作品分享给我鉴赏。
|
||||
我不喜欢 AI 画作与 AI 乐曲,请不要随意地将 AI ~~创作~~ 融合的尸块作品分享给我鉴赏。
|
||||
|
||||
我不喜欢内卷,也不喜欢被人说内卷。我学习的目的并不是为了将任何人比下去,而是拓展自己的知识储备,让自己能够更好地面对这个世界;又或者仅仅是为了应付考试。
|
||||
|
||||
|
||||
@@ -39,9 +39,12 @@ interface Props {
|
||||
lang?: string;
|
||||
setOGTypeArticle?: boolean;
|
||||
postSlug?: string;
|
||||
articlePublishedTime?: string;
|
||||
articleModifiedTime?: string;
|
||||
articleTags?: string[];
|
||||
}
|
||||
|
||||
let { title, description, lang, setOGTypeArticle, postSlug } = Astro.props;
|
||||
let { title, description, lang, setOGTypeArticle, postSlug, articlePublishedTime, articleModifiedTime, articleTags } = Astro.props;
|
||||
|
||||
// apply a class to the body element to decide the height of the banner, only used for initial page load
|
||||
// Swup can update the body for each page visit, but it's after the page transition, causing a delay for banner height change
|
||||
@@ -153,9 +156,20 @@ const siteLang = lang.replace("_", "-");
|
||||
name="twitter:description"
|
||||
content={description || siteConfig.description || pageTitle}
|
||||
/>
|
||||
{ogImageUrl && <meta name="twitter:image" content={ogImageUrl} />}
|
||||
{setOGTypeArticle && articlePublishedTime && (
|
||||
<meta property="article:published_time" content={articlePublishedTime} />
|
||||
)}
|
||||
{setOGTypeArticle && articleModifiedTime && (
|
||||
<meta property="article:modified_time" content={articleModifiedTime} />
|
||||
)}
|
||||
{setOGTypeArticle && articleTags && articleTags.map((tag) => (
|
||||
<meta property="article:tag" content={tag} />
|
||||
))}
|
||||
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<meta name="generator" content={Astro.generator} />
|
||||
<link rel="canonical" href={new URL(Astro.url.pathname, Astro.site).href} />
|
||||
{
|
||||
favicons.map((favicon) => (
|
||||
<link
|
||||
|
||||
@@ -116,16 +116,23 @@ const jsonLd = {
|
||||
headline: entry.data.title,
|
||||
description: entry.data.description || entry.data.title,
|
||||
keywords: entry.data.tags,
|
||||
url: Astro.url.href,
|
||||
author: {
|
||||
"@type": "Person",
|
||||
name: profileConfig.name,
|
||||
url: Astro.site,
|
||||
},
|
||||
publisher: {
|
||||
"@type": "Person",
|
||||
name: profileConfig.name,
|
||||
url: Astro.site,
|
||||
},
|
||||
datePublished: formatDateToYYYYMMDD(entry.data.published),
|
||||
dateModified: formatDateToYYYYMMDD(entry.data.updated || entry.data.published),
|
||||
...(processedImage ? { image: new URL(processedImage.startsWith("/") ? processedImage : `/${processedImage}`, Astro.site).href } : {}),
|
||||
inLanguage: entry.data.lang
|
||||
? entry.data.lang.replace("_", "-")
|
||||
: siteConfig.lang.replace("_", "-"),
|
||||
// TODO include cover image here
|
||||
};
|
||||
|
||||
const relatedPosts = await getRelatedPosts(entry, 5);
|
||||
@@ -142,6 +149,9 @@ const relatedPosts = await getRelatedPosts(entry, 5);
|
||||
headings={headings}
|
||||
encrypted={!!entry.data.password}
|
||||
bannerPostMeta={bannerPostMeta}
|
||||
articlePublishedTime={formatDateToYYYYMMDD(entry.data.published)}
|
||||
articleModifiedTime={formatDateToYYYYMMDD(entry.data.updated || entry.data.published)}
|
||||
articleTags={entry.data.tags}
|
||||
>
|
||||
<!-- KaTeX 按需加载 - 仅在文章页面 -->
|
||||
<KatexManager slot="head" />
|
||||
|
||||
@@ -0,0 +1,215 @@
|
||||
---
|
||||
import Comment from "@components/comment/index.astro";
|
||||
import { Icon } from "astro-icon/components";
|
||||
import { commentConfig, siteConfig, sponsorConfig } from "@/config";
|
||||
import I18nKey from "@/i18n/i18nKey";
|
||||
import { i18n } from "@/i18n/translation";
|
||||
import MainGridLayout from "@/layouts/MainGridLayout.astro";
|
||||
import { getLqipProps } from "@/utils/lqip-utils";
|
||||
import { url } from "@/utils/url-utils";
|
||||
|
||||
// 检查页面是否启用
|
||||
if (!siteConfig.pages.sponsor) {
|
||||
return Astro.redirect("/404/");
|
||||
}
|
||||
|
||||
// 检查评论系统是否启用
|
||||
const isCommentEnabled =
|
||||
commentConfig?.type &&
|
||||
commentConfig.type !== "none" &&
|
||||
sponsorConfig.showComment !== false;
|
||||
|
||||
const title = sponsorConfig.title || i18n(I18nKey.sponsorTitle);
|
||||
const description =
|
||||
sponsorConfig.description || i18n(I18nKey.sponsorDescription);
|
||||
const enabledMethods = sponsorConfig.methods.filter((method) => method.enabled);
|
||||
const sponsors = sponsorConfig.sponsors || [];
|
||||
const showSponsorsList = sponsorConfig.showSponsorsList !== false;
|
||||
|
||||
// LQIP 渐变占位
|
||||
function getQrLqipProps(qrCode: string) {
|
||||
return getLqipProps(qrCode, undefined, true);
|
||||
}
|
||||
---
|
||||
|
||||
<MainGridLayout title={title} description={description}>
|
||||
<div class="flex w-full rounded-(--radius-large) overflow-hidden relative min-h-32">
|
||||
<div class="card-base z-10 px-9 py-6 relative w-full">
|
||||
<!-- 页面标题和描述 -->
|
||||
<div class="mb-8">
|
||||
<div class="flex items-center gap-3 mb-3">
|
||||
<div class="h-8 w-8 rounded-lg bg-(--primary) flex items-center justify-center text-white dark:text-black/70">
|
||||
<Icon name="material-symbols:favorite" class="text-[1.5rem]"></Icon>
|
||||
</div>
|
||||
<div class="text-3xl font-bold text-neutral-900 dark:text-neutral-100">
|
||||
{title}
|
||||
</div>
|
||||
</div>
|
||||
{description && (
|
||||
<p class="text-base text-neutral-600 dark:text-neutral-400 leading-relaxed mb-4">
|
||||
{description}
|
||||
</p>
|
||||
)}
|
||||
{sponsorConfig.usage && (
|
||||
<div class="mb-8 p-4 rounded-lg bg-(--primary)/8 dark:bg-(--btn-regular-bg) border border-(--primary)/30 dark:border-none backdrop-blur-xs shadow-xs usage-info-box">
|
||||
<div class="flex items-start gap-2">
|
||||
<Icon name="material-symbols:info-outline" class="text-(--primary) text-lg shrink-0 mt-0.5" />
|
||||
<p class="text-sm text-neutral-700 dark:text-neutral-200 leading-relaxed">
|
||||
<span class="font-semibold text-(--primary)"></span>
|
||||
{sponsorConfig.usage}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<!-- 打赏方式 -->
|
||||
<div class="mb-8">
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-6">
|
||||
{enabledMethods.map((method) => (
|
||||
<div class="flex flex-col items-center card-base p-6 rounded-lg bg-neutral-50 dark:bg-neutral-900/50 border border-neutral-200 dark:border-neutral-800 hover:border-(--primary) transition-colors">
|
||||
<!-- 图标和名称 -->
|
||||
<div class="flex items-center gap-3 mb-4">
|
||||
{method.icon && (
|
||||
<Icon name={method.icon} class="text-2xl text-neutral-900 dark:text-neutral-100 transition-colors" />
|
||||
)}
|
||||
<h3 class="text-xl font-semibold text-neutral-900 dark:text-neutral-100">
|
||||
{method.name}
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
<!-- 描述 -->
|
||||
{method.description && (
|
||||
<p class="text-sm text-neutral-600 dark:text-neutral-400 mb-4 text-center">
|
||||
{method.description}
|
||||
</p>
|
||||
)}
|
||||
|
||||
<!-- 二维码或链接 -->
|
||||
{method.qrCode && (
|
||||
<div class="relative w-full max-w-[200px] aspect-square bg-white rounded-lg p-4 shadow-md mb-4 overflow-hidden">
|
||||
<div class="lqip-placeholder absolute inset-0 rounded-lg pointer-events-none" style={getQrLqipProps(method.qrCode).style} aria-hidden="true"></div>
|
||||
<img
|
||||
src={url(method.qrCode)}
|
||||
alt={`${method.name} ${i18n(I18nKey.scanToSponsor)}`}
|
||||
class="relative w-full h-full object-contain opacity-0 transition-opacity duration-500 ease-out"
|
||||
loading="lazy"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{method.link && (
|
||||
<a
|
||||
href={method.link}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="inline-flex items-center gap-2 px-4 py-2 bg-(--primary) text-white dark:text-black/70 rounded-lg font-medium hover:bg-(--primary)/90 active:scale-95 transition-all"
|
||||
>
|
||||
<span>{i18n(I18nKey.sponsorGoTo)}</span>
|
||||
<Icon name="fa7-solid:arrow-up-right-from-square" class="text-sm" />
|
||||
</a>
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 打赏者列表 -->
|
||||
{showSponsorsList && (
|
||||
<div class="flex w-full rounded-(--radius-large) overflow-hidden relative mt-4">
|
||||
<div class="card-base z-10 px-9 py-6 relative w-full">
|
||||
<div class="flex items-center justify-between mb-6">
|
||||
<div class="flex items-center gap-3">
|
||||
<div class="h-8 w-8 rounded-lg bg-(--primary)/10 flex items-center justify-center">
|
||||
<Icon name="material-symbols:emoji-people-rounded" class="text-[1.25rem] text-(--primary)" />
|
||||
</div>
|
||||
<h2 class="text-xl font-bold text-neutral-900 dark:text-neutral-100">
|
||||
{i18n(I18nKey.sponsorList)}
|
||||
</h2>
|
||||
</div>
|
||||
{sponsors.length > 0 && (
|
||||
<span class="text-xs text-neutral-400 dark:text-neutral-500">
|
||||
{sponsors.length}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
{sponsors.length > 0 ? (
|
||||
<div class="sponsor-grid">
|
||||
{sponsors.map((sponsor) => (
|
||||
<div class="group flex items-center gap-3 p-3 rounded-xl border border-(--line-divider) hover:border-(--primary) transition-all duration-200">
|
||||
{/* 头像占位 */}
|
||||
<!-- 新的头像逻辑:有头像用图片,没有用首字母 -->
|
||||
{sponsor.avatar ? (
|
||||
<img
|
||||
src={url(sponsor.avatar)}
|
||||
alt={sponsor.name}
|
||||
class="w-9 h-9 rounded-full object-cover shrink-0"
|
||||
loading="lazy"
|
||||
onerror="this.style.display='none'; this.nextElementSibling.style.display='flex';"
|
||||
/>
|
||||
) : null}
|
||||
|
||||
<!-- 首字母头像(作为兜底,图片加载失败也会显示这个) -->
|
||||
<div
|
||||
class={`w-9 h-9 rounded-full bg-(--primary)/10 flex items-center justify-center shrink-0 group-hover:bg-(--primary)/20 transition-colors ${sponsor.avatar ? 'hidden' : ''}`}
|
||||
>
|
||||
<span class="text-sm font-bold text-(--primary)">{sponsor.name.charAt(0)}</span>
|
||||
</div>
|
||||
|
||||
{/* 信息 */}
|
||||
<div class="flex-1 min-w-0">
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="font-semibold text-sm text-neutral-900 dark:text-neutral-100 truncate">
|
||||
{sponsor.name}
|
||||
</span>
|
||||
{sponsor.amount && (
|
||||
<span class="shrink-0 text-xs font-bold text-(--primary)">
|
||||
{sponsor.amount}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
{sponsor.date && (
|
||||
<span class="text-[0.65rem] text-neutral-400 dark:text-neutral-500">
|
||||
{new Date(sponsor.date).toLocaleDateString()}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<div class="text-center py-12 text-neutral-500 dark:text-neutral-500">
|
||||
<p>{i18n(I18nKey.sponsorEmpty)}</p>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
<!-- 评论区 -->
|
||||
{isCommentEnabled && (
|
||||
<div class="mt-4">
|
||||
<Comment customPath="/sponsor/" title="sponsor" />
|
||||
</div>
|
||||
)}
|
||||
</MainGridLayout>
|
||||
|
||||
<style>
|
||||
/* 透明模式下使用半透明背景 */
|
||||
:global(body.wallpaper-transparent .usage-info-box) {
|
||||
background-color: rgba(var(--primary-rgb, 70, 130, 180), 0.15) !important;
|
||||
}
|
||||
|
||||
:global(:root.dark body.wallpaper-transparent .usage-info-box) {
|
||||
background-color: oklch(from var(--primary) l c h / 0.15) !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style is:global>
|
||||
.sponsor-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
|
||||
gap: 0.75rem;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user