diff --git a/.env.development b/.env.development index 29d85a3..360b3b4 100644 --- a/.env.development +++ b/.env.development @@ -3,3 +3,9 @@ NEXT_PUBLIC_API_BASE_URL=/api # Used by Server Components and the development rewrite target. SERVER_API_BASE_URL=http://localhost:8080/api + +# --- 自建网易云增强 API(可选,留空 = 关闭)--- +# 本地开发时若本机未运行自建 API,保持注释即可。 +# NCM_API_URL=http://127.0.0.1:3000 +# NCM_API_COOKIE_FILE=/www/wwwroot/ncm-api/.netease_cookie +# NCM_API_COOKIE=... diff --git a/.env.production b/.env.production index e8faefb..c46bffa 100644 --- a/.env.production +++ b/.env.production @@ -3,3 +3,11 @@ NEXT_PUBLIC_API_BASE_URL=/api # Internal address used only by the Next.js server on the production host. SERVER_API_BASE_URL=http://127.0.0.1:8080/api + +# --- 自建网易云增强 API(可选,留空 = 关闭,网易云走 gdstudio 原通道)--- +# 博客迁到宝塔服务器后启用即可享受会员音质/解灰;本机未部署时请保持注释。 +# NCM_API_URL=http://127.0.0.1:3000 +# 会员 cookie 存服务器文件(推荐,cookie 不进仓库): +# NCM_API_COOKIE_FILE=/www/wwwroot/ncm-api/.netease_cookie +# 或直接写入环境变量(二选一): +# NCM_API_COOKIE=... diff --git a/next-env.d.ts b/next-env.d.ts index 9edff1c..c4b7818 100644 --- a/next-env.d.ts +++ b/next-env.d.ts @@ -1,6 +1,6 @@ /// /// -import "./.next/types/routes.d.ts"; +import "./.next/dev/types/routes.d.ts"; // NOTE: This file should not be edited // see https://nextjs.org/docs/app/api-reference/config/typescript for more information. diff --git a/package-lock.json b/package-lock.json index 9462c0a..8146da2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,6 +14,7 @@ "framer-motion": "^12.40.0", "gsap": "^3.15.0", "highlight.js": "^11.11.1", + "katex": "^0.18.9", "leaflet": "^1.9.4", "lenis": "^1.3.23", "lucide-react": "^1.21.0", @@ -2882,6 +2883,15 @@ "node": ">= 0.8" } }, + "node_modules/commander": { + "version": "15.0.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-15.0.0.tgz", + "integrity": "sha512-z67u4ZhzCL/Tydu1lJARtEZYWbWaN7oYLHbsuzocr6y4N6WZAagG3RQ4FW61V1/0+jImpj293XfrcYnd1qxtPg==", + "license": "MIT", + "engines": { + "node": ">=22.12.0" + } + }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmmirror.com/concat-map/-/concat-map-0.0.1.tgz", @@ -4887,6 +4897,22 @@ "node": ">=4.0" } }, + "node_modules/katex": { + "version": "0.18.9", + "resolved": "https://registry.npmjs.org/katex/-/katex-0.18.9.tgz", + "integrity": "sha512-8ad9RyoKsb/g8/yLFE+KAlP+DhbCTRUNi/V9XGsxn0R+trJJltNwzcDNo0q/DEkOy5fQUQTAQyCXCYSE+OakTQ==", + "funding": [ + "https://opencollective.com/katex", + "https://github.com/sponsors/katex" + ], + "license": "MIT", + "dependencies": { + "commander": "^15.0.0" + }, + "bin": { + "katex": "cli.js" + } + }, "node_modules/keyv": { "version": "4.5.4", "resolved": "https://registry.npmmirror.com/keyv/-/keyv-4.5.4.tgz", diff --git a/package.json b/package.json index d685a8f..c57f439 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "framer-motion": "^12.40.0", "gsap": "^3.15.0", "highlight.js": "^11.11.1", + "katex": "^0.18.9", "leaflet": "^1.9.4", "lenis": "^1.3.23", "lucide-react": "^1.21.0", diff --git a/src/api/config.ts b/src/api/config.ts index 74228d4..7d92c68 100644 --- a/src/api/config.ts +++ b/src/api/config.ts @@ -6,13 +6,124 @@ export interface PublicConfigItem { configValue: string } -export function getPublicConfig() { - return request.get('/config/public') +/** 主题强类型字段 → page.theme.* 后缀(与 theme_config 表列一一对应) */ +const THEME_KEYS = [ + 'accentColor', + 'accentSoftColor', + 'bgColor', + 'bgSoftColor', + 'darkAccentColor', + 'darkAccentSoftColor', + 'darkBgColor', + 'darkBgSoftColor', + 'grainOpacity', + 'glowsEnabled', + 'bgImageUrl', + 'bgImageStyle', + 'bgImageBlur', + 'bgImageOpacity', + 'darkBgImageOpacity', + 'customCss' +] as const + +/** site_access 强类型字段 → page.*.enable 遗留键 */ +const PAGE_KEYS: Array<[string, string]> = [ + ['love', 'page.love.enable'], + ['letter', 'page.letter.enable'], + ['now', 'page.now.enable'], + ['about', 'page.about.enable'], + ['footprints', 'page.footprints.enable'], + ['pond', 'page.pond.enable'] +] + +/** 统一转字符串:null/undefined → '',布尔 → 'true'/'false',其余 String() */ +function toText(value: unknown): string { + if (value === null || value === undefined) return '' + if (typeof value === 'boolean') return value ? 'true' : 'false' + return String(value) +} + +/** JSON 型键:内容为空时输出空串,复现“配置缺失”语义以触发前端兜底 */ +function toJson(value: unknown, isEmpty: (parsed: any) => boolean): string { + if (!isEmpty(value)) return JSON.stringify(value) + return '' +} + +/** 把 /config/bootstrap 的强类型聚合摊平为遗留 {configKey, configValue} 字符串数组 */ +function flattenBootstrap(payload: any): PublicConfigItem[] { + const data = payload?.data ?? {} + const site = data.site ?? {} + const beian = site.beian ?? {} + const amap = site.amap ?? {} + const theme = data.theme ?? {} + const pages = data.pages ?? {} + const love = data.love ?? {} + const couple = love.couple ?? {} + const stats = love.stats ?? {} + + const items: PublicConfigItem[] = [] + const push = (configKey: string, configValue: unknown) => { + items.push({ configKey, configValue: toText(configValue) }) + } + + // 站点品牌与全局文案 + push('site.logo.url', site.logoUrl) + push('site.logo.text', site.logoText) + push('site.favicon.url', site.faviconUrl) + push('site.title.default', site.titleDefault) + push('site.title.about', site.titleAbout) + push('page.home.welcomeText', site.welcomeText) + push('page.home.welcomeSubtitle', site.welcomeSubtitle) + push('page.home.heroTitle', site.heroTitle) + push('page.home.eyebrowTag', site.eyebrowTag) + push('page.home.heroDescription', site.heroDescription) + push('page.home.heroBgUrl', site.heroBgUrl) + push('site.beian.icp', beian.icp) + push('site.beian.icpUrl', beian.icpUrl) + push('site.beian.police', beian.police) + push('site.beian.policeUrl', beian.policeUrl) + push('page.footprint.amap.key', amap.key) + push('page.footprint.amap.securityJsCode', amap.securityJsCode) + + // 外观主题 + push('page.theme.enabled', theme.enabled) + THEME_KEYS.forEach((key) => push(`page.theme.${key}`, theme[key])) + + // 页面可见性(口令不回传:由后端 /config/verify-passcode 单独校验,避免泄露) + PAGE_KEYS.forEach(([field, configKey]) => push(configKey, pages[field])) + + // 关于作者 / 此时此刻(由关系表实时拼装,保持 JSON 字符串形态) + push('page.about.profile', toJson(data.about, (v) => !v || Object.keys(v).length === 0)) + push('now.content.json', toJson(data.now, (v) => !v || Object.keys(v).length === 0)) + + // 恋爱域(伴侣信息未配置时输出空串,前端按空态渲染,不做兜底) + push('love.couple.info', toJson(couple, (v) => !v.name && !v.avatar)) + push('love.stats.startDate', stats.startDate) + push('love.stats.citiesCount', stats.citiesCount) + push('love.stats.flightDistance', stats.flightDistance) + push('love.stats.movieCount', stats.movieCount) + push('love.stats.mealCount', stats.mealCount) + push('page.love.heroBgUrl', love.heroBgUrl) + push('page.love.atmospheres', toJson(love.atmospheres, (v) => !Array.isArray(v) || v.length === 0)) + + return items +} + +export async function getPublicConfig() { + const response = await request.get('/config/bootstrap') + return { + ...response, + data: { + code: response.data?.code, + msg: response.data?.msg, + data: flattenBootstrap(response.data) + } + } } export async function fetchPublicConfigForServer(init?: Parameters[1]) { try { - const response = await fetch(getServerApiURL('/config/public'), { + const response = await fetch(getServerApiURL('/config/bootstrap'), { ...init, // 容错超时防刷屏 signal: AbortSignal.timeout(3000) @@ -20,7 +131,8 @@ export async function fetchPublicConfigForServer(init?: Parameters if (!response.ok) { return { code: response.status, data: [] } } - return await response.json() + const payload = await response.json() + return { ...payload, data: flattenBootstrap(payload) } } catch { // 静默兜底,避免打印庞大的 Socket 异常日志 return { code: 500, data: [] } @@ -36,3 +148,13 @@ export const getPublicConfigSnapshot = cache(async (): Promise { + try { + const response = await request.post('/config/verify-passcode', { code }) + return response.data ?? { code: 500 } + } catch { + return { code: 500, msg: '口令校验服务暂不可用' } + } +} \ No newline at end of file diff --git a/src/api/music.ts b/src/api/music.ts index 750ebb7..f9eb407 100644 --- a/src/api/music.ts +++ b/src/api/music.ts @@ -270,3 +270,19 @@ export async function fetchPlaylist( throw normalizeMusicError(error); } } + +/** 网易云热歌榜歌单 ID(默认播放列表数据源) */ +const NETEASE_HOT_PLAYLIST_ID = "3778678"; + +/** + * 拉取网易云热歌榜作为默认播放列表。 + * 复用现有歌单导入接口(music.163.com 直连,不依赖 gdstudio),失败返回空数组由调用方兜底。 + */ +export async function fetchHotPlaylist(count = 20): Promise { + try { + const items = await fetchPlaylist(NETEASE_HOT_PLAYLIST_ID, "netease"); + return items.slice(0, count); + } catch { + return []; + } +} diff --git a/src/app/about/page.tsx b/src/app/about/page.tsx index d0ff5c7..8e19f70 100644 --- a/src/app/about/page.tsx +++ b/src/app/about/page.tsx @@ -7,6 +7,7 @@ import { aboutProfile } from "@/mock/about"; export async function generateMetadata(): Promise { let title = "春风不解别离意,今日方知我是春。"; + let authorName = "RRTiamo"; try { const response = await getPublicConfig(); const configs = response.data?.data; @@ -18,6 +19,19 @@ export async function generateMetadata(): Promise { if (titleConfig?.configValue) { title = titleConfig.configValue; } + // 作者名取自身份档案聚合键(about_* 关系表拼装),缺失时回退默认值 + const profileConfig = configs.find( + (item: { configKey?: string; configValue?: string }) => + item.configKey === "page.about.profile" + ); + if (profileConfig?.configValue) { + try { + const profile = JSON.parse(profileConfig.configValue); + if (profile?.name) authorName = profile.name; + } catch { + // blob 解析失败时保持默认名 + } + } } } catch (error) { console.warn("Failed to generate About page metadata:", error); @@ -25,7 +39,7 @@ export async function generateMetadata(): Promise { return { title, - description: "我在代码、文字和生活的缝隙里,慢慢搭建一个属于自己的小宇宙。关于 RRTiamo,此间主人。", + description: `我在代码、文字和生活的缝隙里,慢慢搭建一个属于自己的小宇宙。关于 ${authorName},此间主人。`, }; } diff --git a/src/app/api/music/route.ts b/src/app/api/music/route.ts index 6729406..2a99458 100644 --- a/src/app/api/music/route.ts +++ b/src/app/api/music/route.ts @@ -1,8 +1,16 @@ +import { readFileSync } from 'node:fs'; import { isIP } from 'node:net'; import { NextResponse } from 'next/server'; -import type { MusicApiErrorCode, MusicSource } from '@/interface/music'; +import type { ApiSearchResult, MusicApiErrorCode, MusicSource } from '@/interface/music'; const MUSIC_API_URL = 'https://music-api.gdstudio.xyz/api.php'; + +/** + * 自建网易云增强 API(NeteaseCloudMusicApi Enhanced) + * 配置 NCM_API_URL 后,网易云源将优先走自建服务(携带会员 cookie,支持 VIP 音质与解灰),失败自动回退 gdstudio。 + * 留空 = 关闭,网易云走原有 gdstudio 通道。 + */ +const NCM_API_URL = (process.env.NCM_API_URL || '').replace(/\/+$/, ''); const ALLOWED_SOURCES = new Set(['netease', 'tencent', 'kugou', 'kuwo', 'bilibili', 'joox']); const ALLOWED_TYPES = new Set(['search', 'url', 'pic', 'lyric', 'stream', 'playlist']); @@ -188,6 +196,146 @@ async function resolveLyricWithFallback(source: MusicSource, id: string, name?: return { lyric: '', tlyric: '', from: 'music.gdstudio.xyz' }; } +/* ==================== 自建网易云增强 API(NCM_API_URL) ==================== */ + +let ncmCookieCache: { value: string; time: number } | null = null; + +/** 解析自建 API 所需的会员 cookie:优先环境变量,其次读取服务器上的 cookie 文件(缓存 60s) */ +function getNcmCookie(): string { + if (process.env.NCM_API_COOKIE) return process.env.NCM_API_COOKIE; + const file = process.env.NCM_API_COOKIE_FILE; + if (!file) return ''; + const now = Date.now(); + if (ncmCookieCache && now - ncmCookieCache.time < 60_000) return ncmCookieCache.value; + try { + const value = readFileSync(file, 'utf-8').trim(); + ncmCookieCache = { value, time: now }; + return value; + } catch { + return ''; + } +} + +function ncmCookieParam(): string { + const ck = getNcmCookie(); + return ck ? `cookie=${encodeURIComponent(ck)}` : ''; +} + +/** 请求自建 API 并解析 JSON,失败抛错(交由上层回退 gdstudio) */ +async function ncmFetch(path: string): Promise> { + if (!NCM_API_URL) throw new Error('NCM_API_URL 未配置'); + const response = await fetch(`${NCM_API_URL}${path}`, { + headers: { + Accept: 'application/json, text/plain, */*', + 'Accept-Language': 'zh-CN,zh;q=0.9', + 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36', + }, + signal: AbortSignal.timeout(8_000), + }); + if (!response.ok) throw new Error(`自建网易云接口响应失败 (${response.status})`); + const text = await response.text(); + if (!text.trim()) throw new Error('自建网易云接口返回无内容'); + const data = JSON.parse(text) as Record; + if (typeof data.code === 'number' && data.code !== 200 && data.code !== 0) { + throw new Error(String(data.message || data.msg || data.code)); + } + return data; +} + +/** 码率 -> 音质等级(增强 API 参数) */ +function ncmLevel(br: number): string { + if (br >= 900000) return 'lossless'; + if (br >= 320000) return 'exhigh'; + if (br >= 192000) return 'high'; + return 'standard'; +} + +/** 网易云搜索(返回与 gdstudio 一致的结构,前端零改动) */ +async function ncmSearch(name: string, count: number): Promise { + const data = await ncmFetch( + `/search?keywords=${encodeURIComponent(name)}&limit=${count}&type=1&${ncmCookieParam()}`, + ); + const songs = (data.result as { songs?: unknown[] } | undefined)?.songs; + if (!Array.isArray(songs)) return []; + const ids = songs + .map((raw) => String((raw as { id?: number | string }).id ?? '')) + .filter(Boolean); + // 批量拉取封面 URL,避免依赖 gdstudio 的 types=pic 通道(gdstudio 挂了封面也不裂) + let picMap = new Map(); + if (ids.length > 0) { + try { + picMap = await ncmSongDetailPicUrls(ids); + } catch { + // 拿不到封面则回退到数字 pic_id,由前端走 gdstudio 兜底 + } + } + return songs.map((raw) => { + const s = raw as { + id?: number | string; + name?: string; + artists?: { name?: string }[]; + album?: { name?: string; picUrl?: string; pic_str?: string; picId?: number | string }; + }; + const artistList = Array.isArray(s.artists) + ? s.artists.map((a) => a.name ?? '').filter(Boolean) + : []; + const album = s.album?.name || '单曲'; + const pic = + picMap.get(String(s.id ?? '')) || + s.album?.picUrl || + s.album?.pic_str || + s.album?.picId || + String(s.id ?? ''); + return { + id: String(s.id ?? ''), + name: s.name || '未知曲目', + artist: artistList.length > 0 ? artistList : '未知歌手', + album, + pic_id: String(pic), + url_id: String(s.id ?? ''), + lyric_id: String(s.id ?? ''), + source: 'netease' as MusicSource, + }; + }); +} + +/** 批量获取歌曲封面 URL(/song/detail 一次查询多首),返回 id -> 完整封面 URL */ +async function ncmSongDetailPicUrls(ids: string[]): Promise> { + const map = new Map(); + const data = await ncmFetch( + `/song/detail?ids=${encodeURIComponent(ids.join(','))}&${ncmCookieParam()}`, + ); + const songs = data.songs as + | Array<{ id?: number | string; al?: { picUrl?: string; pic_str?: string } }> + | undefined; + if (Array.isArray(songs)) { + for (const s of songs) { + if (s?.id == null) continue; + const pic = s.al?.picUrl || s.al?.pic_str; + if (pic) map.set(String(s.id), pic); + } + } + return map; +} + +/** 网易云播放地址(VIP 音质,支持解灰:unblock=true) */ +async function ncmSongUrl(id: string, br: number): Promise { + const data = await ncmFetch( + `/song/url/v1?id=${encodeURIComponent(id)}&level=${ncmLevel(br)}&unblock=true&${ncmCookieParam()}`, + ); + const item = (data.data as { url?: string }[] | undefined)?.[0]; + return item?.url && isSafeStreamUrl(item.url) ? item.url : ''; +} + +/** 网易云歌词(含翻译) */ +async function ncmLyric(id: string): Promise<{ lyric: string; tlyric: string }> { + const data = await ncmFetch(`/lyric?id=${encodeURIComponent(id)}&${ncmCookieParam()}`); + return { + lyric: toSimplifiedChinese((data.lrc as { lyric?: string } | undefined)?.lyric || ''), + tlyric: toSimplifiedChinese((data.tlyric as { lyric?: string } | undefined)?.lyric || ''), + }; +} + export async function GET(request: Request) { const { searchParams } = new URL(request.url); const requestType = searchParams.get('types') || 'search'; @@ -208,6 +356,15 @@ export async function GET(request: Request) { try { if (requestType === 'search') { + // 网易云优先走自建增强 API(会员搜索),失败回退 gdstudio + if (source === 'netease' && NCM_API_URL) { + try { + const ncmItems = await ncmSearch(name, Number(count) || 12); + if (ncmItems.length > 0) return NextResponse.json(ncmItems); + } catch { + // 回退到 gdstudio + } + } let data = await requestMusicApi('search', params); if (Array.isArray(data) && data.length === 0) { const fallbackSource: MusicSource = source === 'netease' ? 'kuwo' : 'netease'; @@ -217,11 +374,29 @@ export async function GET(request: Request) { } if (requestType === 'lyric') { + if (source === 'netease' && NCM_API_URL) { + try { + const ncmL = await ncmLyric(id); + if (ncmL.lyric) { + return NextResponse.json({ ...ncmL, from: 'ncm-api.self-hosted' }); + } + } catch { + // 回退到 gdstudio + } + } const lyricData = await resolveLyricWithFallback(source, id, name); return NextResponse.json(lyricData); } if (requestType === 'stream') { + if (source === 'netease' && NCM_API_URL) { + try { + const ncmAudio = await ncmSongUrl(id, Number(br) || 320000); + if (ncmAudio) return NextResponse.redirect(ncmAudio, { status: 302 }); + } catch { + // 回退到 gdstudio + } + } const audioUrl = await resolveAudioUrlWithFallback(source, id, name, br); if (!audioUrl) { return errorResponse('TRACK_UNAVAILABLE', '全网暂无可用的音频播放路径', 404); @@ -377,6 +552,15 @@ export async function GET(request: Request) { return NextResponse.json(Array.isArray(data) ? data : []); } + if (requestType === 'url' && source === 'netease' && NCM_API_URL) { + try { + const ncmUrl = await ncmSongUrl(id, Number(br) || 320000); + if (ncmUrl) return NextResponse.json({ url: ncmUrl }); + } catch { + // 回退到 gdstudio + } + } + const data = await requestMusicApi(requestType, params); if (requestType === 'url' && !(data as { url?: string })?.url) { const audioUrl = await resolveAudioUrlWithFallback(source, id, name, br); diff --git a/src/app/archive/page.tsx b/src/app/archive/page.tsx index 5791b7a..81fa7a0 100644 --- a/src/app/archive/page.tsx +++ b/src/app/archive/page.tsx @@ -6,15 +6,15 @@ import Image from "next/image"; import gsap from "gsap"; import { ScrollTrigger } from "gsap/ScrollTrigger"; import { - BookOpen, - Heart, - Camera, - Lock, - EyeSlash, - MapPin, - Smiley, - Funnel, - CalendarBlank + BookOpenIcon as BookOpen, + HeartIcon as Heart, + CameraIcon as Camera, + LockIcon as Lock, + EyeSlashIcon as EyeSlash, + MapPinIcon as MapPin, + SmileyIcon as Smiley, + FunnelIcon as Funnel, + CalendarBlankIcon as CalendarBlank } from "@phosphor-icons/react"; import { writingData } from "@/data/writing"; @@ -320,6 +320,37 @@ const ArchiveCard = ({ item }: { item: ArchiveItem }) => { ); }; +// 归档分类元信息:用于“全部归档”视图中按类别分区展示,避免不同类型卡片相互挤压 +const CATEGORY_META: { + type: ArchiveItem["type"]; + label: string; + en: string; + icon: React.ReactNode; + badgeClass: string; +}[] = [ + { + type: "Writing", + label: "随笔散文", + en: "WRITING", + icon: , + badgeClass: "text-charcoal/50 bg-charcoal/5 dark:text-white/50 dark:bg-white/5 border border-charcoal/10 dark:border-white/10", + }, + { + type: "Love Note", + label: "恋爱纪实", + en: "LOVE", + icon: , + badgeClass: "text-red-800/80 bg-red-50 dark:text-red-300 dark:bg-red-950/30 border border-red-900/10 dark:border-red-900/20", + }, + { + type: "Photo", + label: "影像切片", + en: "PHOTO", + icon: , + badgeClass: "text-sky-700/80 bg-sky-50 dark:text-sky-300 dark:bg-sky-950/30 border border-sky-900/10 dark:border-sky-900/20", + }, +]; + // 预先静态化提取初始年份以供延迟加载状态 const getInitialYears = () => { const dates = [ @@ -566,7 +597,11 @@ export default function ArchivePage() { }); }; - // GSAP 首次加载动画及 ScrollTrigger 物理联动 + // 年份列表稳定标识:years 是每次渲染都新生成的数组引用, + // 直接作为 effect 依赖会导致 ScrollTrigger 与入场动画在每个渲染周期反复重建/重播(表现为页面疯狂闪烁刷新) + const yearsKey = years.join("|"); + + // GSAP 入场动画:仅挂载时执行一次,避免后续渲染(如数据陆续返回、切换分类)反复重播造成页面闪烁 useEffect(() => { const ctx = gsap.context(() => { // 1. 顶部索引卡与便签滑入 (优雅的弹性入场) @@ -595,7 +630,7 @@ export default function ArchivePage() { ease: "elastic.out(1.1, 0.45)" } ); - // 2. 过滤栏滑入 + // 3. 过滤栏滑入 gsap.from(".archive-filter-bar", { opacity: 0, y: 25, @@ -603,7 +638,7 @@ export default function ArchivePage() { delay: 0.15, ease: "power3.out" }); - // 3. 侧边栏时间轴滑入 + // 4. 侧边栏时间轴滑入 gsap.from(".archive-timeline-sidebar", { opacity: 0, x: -30, @@ -611,22 +646,33 @@ export default function ArchivePage() { delay: 0.25, ease: "power3.out" }); + }, pageRef); - // 4. 首次加载卡片 Stagger 物理发牌滑入 - const firstCards = pageRef.current?.querySelectorAll(".archive-card-anim"); - if (firstCards && firstCards.length > 0) { - gsap.from(firstCards, { - opacity: 0, - y: 45, - rotation: () => (Math.random() - 0.5) * 2.5, - duration: 0.9, - stagger: 0.05, - delay: 0.35, - ease: "power4.out" - }); - } + return () => ctx.revert(); + }, []); - // 5. 年份标题横线 ScrollTrigger 动态横向拉伸生长 + // 卡片网格首次数据到达后播放一次 Stagger 物理发牌入场(后续分类切换交给 changeTab 处理动画) + const hasRunCardEntranceRef = useRef(false); + useEffect(() => { + if (hasRunCardEntranceRef.current) return; + const cards = pageRef.current?.querySelectorAll(".archive-card-anim"); + if (!cards || cards.length === 0) return; + hasRunCardEntranceRef.current = true; + gsap.from(cards, { + opacity: 0, + y: 45, + rotation: () => (Math.random() - 0.5) * 2.5, + duration: 0.9, + stagger: 0.05, + delay: 0.35, + ease: "power4.out" + }); + }, [yearsKey]); + + // ScrollTrigger 物理联动:仅在年份列表内容或分类页签真正变化时安全重建,保证坐标绝对精准 + useEffect(() => { + const ctx = gsap.context(() => { + // 1. 年份标题横线 ScrollTrigger 动态横向拉伸生长 years.forEach((year) => { gsap.fromTo(`#divider-${year}`, { scaleX: 0, opacity: 0 }, @@ -644,7 +690,7 @@ export default function ArchivePage() { ); }); - // 6. 滚动联动高亮左侧年份刻度 + // 2. 滚动联动高亮左侧年份刻度 years.forEach((year) => { ScrollTrigger.create({ trigger: `#year-${year}`, @@ -658,7 +704,7 @@ export default function ArchivePage() { }); }); - // 7. 时光轴流逝线滚动比例拉伸 (只在桌面端 sticky sidebar 启用,避免移动端计算报错) + // 3. 时光轴流逝线滚动比例拉伸 (只在桌面端 sticky sidebar 启用,避免移动端计算报错) if (window.innerWidth >= 1024) { gsap.to(".timeline-progress-fill", { scaleY: 1, @@ -675,7 +721,7 @@ export default function ArchivePage() { }, pageRef); return () => ctx.revert(); - }, [years, activeTab]); // 过滤引起 years 变动时,安全重建 ScrollTrigger 保证坐标绝对精准 + }, [yearsKey, activeTab]); // 锚点滚动 const scrollToYear = (year: string) => { @@ -892,17 +938,45 @@ export default function ArchivePage() { /> - {/* 卡片网格 */} -
- {groups[year].map((item) => ( -
- -
- ))} -
+ {/* 卡片网格:全部归档时按类别分区展示,避免不同类型卡片相互挤压 */} + {activeTab === "all" ? ( +
+ {CATEGORY_META.map((cat) => { + const catItems = groups[year].filter((item) => item.type === cat.type); + if (catItems.length === 0) return null; + return ( +
+ {/* 类别小标题:图标 + 中英文名 + 数量 + 细分隔线 */} +
+ + {cat.icon} + {cat.label} + + + {cat.en} · {catItems.length} + +
+
+
+ {catItems.map((item) => ( +
+ +
+ ))} +
+
+ ); + })} +
+ ) : ( +
+ {groups[year].map((item) => ( +
+ +
+ ))} +
+ )} )) )} diff --git a/src/app/gallery/page.tsx b/src/app/gallery/page.tsx index eb927e3..41b3151 100644 --- a/src/app/gallery/page.tsx +++ b/src/app/gallery/page.tsx @@ -112,7 +112,7 @@ export default function GalleryPage() { const columns = getColumnsData(); return ( -
+
{/* 栏目头部 */}
@@ -122,7 +122,7 @@ export default function GalleryPage() { Gallery / 影像档案

- 用镜头与感光胶片物理定格的光影。已升级为极简无界艺术杂志排版,左右侧列辅以不对称顶部偏置与 GSAP 视差,实现顺畅呼吸的观看体验。 + 用镜头与感光胶片物理定格的光影。手账式的拍立得照片墙——每张相纸微微倾斜、画框各不相同,像被认真贴进笔记本里的每一帧。

@@ -151,17 +151,17 @@ export default function GalleryPage() { // 决定不对称顶部偏置,增加版面韵律感 (仅在多列且挂载后应用) let colOffsetClass = ""; if (columnsCount === 3) { - if (colIdx === 1) colOffsetClass = "pt-20"; - if (colIdx === 2) colOffsetClass = "pt-10"; + if (colIdx === 1) colOffsetClass = "pt-14"; + if (colIdx === 2) colOffsetClass = "pt-6"; } else if (columnsCount === 2) { - if (colIdx === 1) colOffsetClass = "pt-12"; + if (colIdx === 1) colOffsetClass = "pt-8"; } return (
{columnItems.map((photo) => { diff --git a/src/app/globals.css b/src/app/globals.css index efbeef9..d679ed3 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -35,6 +35,13 @@ --font-gallery-h-val: var(--font-gallery-heading), var(--font-noto-serif-sc), system-ui, sans-serif; --font-gallery-b-val: var(--font-gallery-body), var(--font-body), sans-serif; --font-quote-h-val: var(--font-quote-heading), var(--font-noto-serif-sc), system-ui, sans-serif; + --font-hero-display-val: var(--font-anton), var(--font-noto-serif-sc), system-ui, sans-serif; + + /* 首页区块(Zentry 标题 × Poetize 内容)描边文字颜色 */ + --stroke-soft: rgba(34, 51, 38, 0.28); + --stroke-thin: rgba(34, 51, 38, 0.3); + /* 底片缩略图齿孔带颜色 */ + --film-perf: rgba(34, 51, 38, 0.14); } /* 暗黑模式变量配置 */ @@ -47,6 +54,9 @@ --font-body: var(--font-inter); --accent-color: #F1A77C; --accent-light-color: #F5C6A8; + --stroke-soft: rgba(247, 248, 241, 0.32); + --stroke-thin: rgba(247, 248, 241, 0.3); + --film-perf: rgba(247, 248, 241, 0.16); } @theme { @@ -70,6 +80,7 @@ --font-gallery-h: var(--font-gallery-h-val); --font-gallery-b: var(--font-gallery-b-val); --font-quote-h: var(--font-quote-h-val); + --font-display: var(--font-hero-display-val); } /* ========================================================================== @@ -296,6 +307,27 @@ html.lenis, html.lenis body { -webkit-mask-image: linear-gradient(to right, transparent, white 15%, white 85%, transparent); } +/* Zentry 式横幅 Marquee 滚动字幕条(轨道需复制两份等宽内容,平移 -50% 实现无缝无限循环) */ +@keyframes atlas-marquee-scroll { + from { + transform: translateX(0); + } + to { + transform: translateX(-50%); + } +} + +.atlas-marquee-track { + display: flex; + width: max-content; + will-change: transform; + animation: atlas-marquee-scroll 28s linear infinite; +} + +.atlas-marquee-track:hover { + animation-play-state: paused; +} + /* 首页开屏底部的低矮动态波浪 */ .home-hero-wave { height: clamp(5rem, 10vw, 8.5rem); @@ -311,7 +343,9 @@ html.lenis, html.lenis body { } .wave-parallax > use { - animation: atlas-wave-drift 25s cubic-bezier(0.55, 0.5, 0.45, 0.5) infinite; + animation-name: atlas-wave-drift; + animation-timing-function: cubic-bezier(0.55, 0.5, 0.45, 0.5); + animation-iteration-count: infinite; will-change: transform; } @@ -417,6 +451,15 @@ html.lenis, html.lenis body { } } +/* 手账点阵纸背景(拍立得相纸的衬底) */ +.notebook-dots { + background-image: radial-gradient(circle, rgba(34, 51, 38, 0.06) 1px, transparent 1.4px); + background-size: 22px 22px; +} +.dark .notebook-dots { + background-image: radial-gradient(circle, rgba(247, 248, 241, 0.05) 1px, transparent 1.4px); +} + @media (prefers-reduced-motion: reduce) { .wave-parallax > use { animation: none; @@ -596,3 +639,226 @@ nextjs-portal, #__next-prerender-indicator { animation: spin-linear 20s linear infinite; } +/* ========================================================================== + 首页开屏巨字(Zentry 风格 Hero,HomeHero 专用) + ========================================================================== */ + +/* 遮罩垂直余量防裁切:padding 撑大裁剪区,负 margin 抵消保持布局不变 */ +.giant-title .char-mask { + padding: 0.12em 0; + margin: -0.12em 0; +} + +.giant-title .char-inner { + animation: hero-char-rise 1.1s cubic-bezier(0.16, 1, 0.3, 1) both; + animation-delay: calc(0.15s + var(--i, 0) * 0.05s); +} + +.giant-title .char-inner.accent { + color: var(--color-gold); + text-shadow: 0 0 32px rgba(217, 134, 95, 0.35); +} + +/* 次级描边巨行:clip 展开进场,滚动视差由 GSAP ScrollTrigger 驱动 */ +.giant-outline { + color: transparent; + -webkit-text-stroke: 1.5px rgba(247, 248, 241, 0.38); + clip-path: inset(0 100% 0 0); + animation: hero-outline-reveal 1s cubic-bezier(0.22, 1, 0.36, 1) 0.75s both; + will-change: transform; +} + +/* 开屏内容块淡入上移(时序由内联 animation-delay 控制) */ +.hero-fade { + opacity: 0; + animation: hero-fade-up 0.7s cubic-bezier(0.22, 1, 0.36, 1) both; +} + +/* 沉浸式滚动提示竖线 */ +.hero-scroll-line { + width: 1px; + height: 42px; + background: linear-gradient(180deg, transparent, var(--color-gold-light) 45%, var(--color-cream)); + transform-origin: top; + animation: hero-scroll-line 2.2s cubic-bezier(0.55, 0.5, 0.45, 0.5) infinite; +} + +@keyframes hero-char-rise { + from { + transform: translateY(130%); + filter: blur(8px); + opacity: 0; + } + to { + transform: translateY(0); + filter: blur(0); + opacity: 1; + } +} + +@keyframes hero-outline-reveal { + from { + clip-path: inset(0 100% 0 0); + } + to { + clip-path: inset(0 0 0 0); + } +} + +@keyframes hero-fade-up { + from { + transform: translateY(20px); + opacity: 0; + } + to { + transform: translateY(0); + opacity: 1; + } +} + +@keyframes hero-scroll-line { + 0% { + transform: scaleY(0); + transform-origin: top; + } + 45% { + transform: scaleY(1); + transform-origin: top; + } + 55% { + transform: scaleY(1); + transform-origin: bottom; + } + 100% { + transform: scaleY(0); + transform-origin: bottom; + } +} + +/* ========================================================================== + 首页区块:Zentry 巨字标题 × Poetize 编辑式内容(首屏以下) + ========================================================================== */ + +/* 巨字描边:浅色区块用炭色、暗色区块(含 .gallery-zone)用奶油色,颜色走变量 */ +.text-stroke-soft { + color: transparent; + -webkit-text-stroke: 1.5px var(--stroke-soft); +} + +.text-stroke-thin { + color: transparent; + -webkit-text-stroke: 1px var(--stroke-thin); +} + +/* 编辑式清单的描边序号(固定金色,不随主题翻转) */ +.num-stroke { + color: transparent; + -webkit-text-stroke: 1px rgba(217, 134, 95, 0.75); +} + +/* Poetize 清单行:悬停金色下划线从左侧铺开 */ +.post-underline { + position: relative; +} +.post-underline::after { + content: ""; + position: absolute; + left: 0; + bottom: -1px; + height: 2px; + width: 0; + background: var(--accent-color); + transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1); +} +.post-underline:hover::after { + width: 100%; +} + +/* Zentry 深色反转区块(相册):固定深炭色 + 氛围光 + 细网格,文字固定奶油色 */ +.gallery-zone { + --stroke-soft: rgba(247, 248, 241, 0.32); + --stroke-thin: rgba(247, 248, 241, 0.3); + color: #F7F8F1; + background: + radial-gradient(60% 50% at 85% 0%, rgba(217, 134, 95, 0.18), transparent 55%), + radial-gradient(45% 40% at 5% 60%, rgba(241, 184, 148, 0.08), transparent 50%), + linear-gradient(rgba(247, 248, 241, 0.03) 1px, transparent 1px), + linear-gradient(90deg, rgba(247, 248, 241, 0.03) 1px, transparent 1px), + #17211B; + background-size: auto, auto, 64px 64px, 64px 64px; +} +.dark .gallery-zone { + background: + radial-gradient(60% 50% at 85% 0%, rgba(217, 134, 95, 0.16), transparent 55%), + radial-gradient(45% 40% at 5% 60%, rgba(241, 184, 148, 0.07), transparent 50%), + linear-gradient(rgba(247, 248, 241, 0.028) 1px, transparent 1px), + linear-gradient(90deg, rgba(247, 248, 241, 0.028) 1px, transparent 1px), + #141B16; + background-size: auto, auto, 64px 64px, 64px 64px; +} + +/* Zentry 胶片网格:首图跨 2×2,第四张跨 2 列 */ +.film-grid { + display: grid; + grid-template-columns: 1fr; + gap: 14px; +} +@media (min-width: 720px) { + .film-grid { + grid-template-columns: repeat(4, 1fr); + grid-auto-rows: 290px; + } + .film-grid > :nth-child(1) { + grid-column: span 2; + grid-row: span 2; + } + .film-grid > :nth-child(4) { + grid-column: span 2; + } +} + +/* 底片缩略图:上下胶片齿孔带,孔透出页面背景色(走 --film-perf 变量适配明暗) */ +.film-sprocket { + position: relative; +} +.film-sprocket::before, +.film-sprocket::after { + content: ""; + position: absolute; + left: 0; + right: 0; + height: 7px; + z-index: 2; + background-image: radial-gradient(circle at 4.5px 3.5px, transparent 0 2.4px, var(--film-perf) 2.8px); + background-size: 9px 7px; + background-repeat: repeat-x; + pointer-events: none; +} +.film-sprocket::before { + top: 0; +} +.film-sprocket::after { + bottom: 0; +} + +@media (prefers-reduced-motion: reduce) { + .giant-title .char-inner, + .giant-outline, + .hero-fade { + animation: none; + opacity: 1; + transform: none; + filter: none; + clip-path: none; + } + + .hero-scroll-line { + animation: none; + transform: scaleY(1); + } + + .post-underline::after { + transition: none; + } +} + diff --git a/src/app/layout.tsx b/src/app/layout.tsx index f7ea657..83edd27 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,5 +1,5 @@ import type { Metadata } from "next"; -import { Inter, Cormorant_Garamond, Playfair_Display, Space_Grotesk, Space_Mono, Jost, Noto_Serif_SC, Ma_Shan_Zheng } from "next/font/google"; +import { Inter, Cormorant_Garamond, Playfair_Display, Space_Grotesk, Space_Mono, Jost, Noto_Serif_SC, Ma_Shan_Zheng, Anton } from "next/font/google"; import "./globals.css"; import Navbar from "@/components/Navbar"; import Footer from "@/components/Footer"; @@ -62,6 +62,13 @@ const maShanZheng = Ma_Shan_Zheng({ preload: false, }); +const anton = Anton({ + variable: "--font-anton", + subsets: ["latin"], + weight: "400", + display: "swap", +}); + export async function generateMetadata(): Promise { let title = "春风不解别离 | 个人生活档案馆"; let faviconUrl = "/icon.png"; @@ -92,9 +99,9 @@ export default async function RootLayout({ return ( - + {/* 1. 全局底色层 (z-0) */} @@ -116,7 +123,7 @@ export default async function RootLayout({
{/* 4. 网页主内容容器 (z-10),拥有显式正值 z-index,保证所有文字、按钮绝对不被背景或视频遮挡 */} -
+
{children}
diff --git a/src/app/notes/page.tsx b/src/app/notes/page.tsx index cdd7801..732923e 100644 --- a/src/app/notes/page.tsx +++ b/src/app/notes/page.tsx @@ -1,17 +1,17 @@ -"use client"; +"use client"; import React, { useState, useEffect, useRef, useMemo } from "react"; import { getNotesList, createNote } from "@/api/notes"; import { motion, AnimatePresence } from "framer-motion"; import gsap from "gsap"; import { - Notebook, - Clock, - Funnel, - Sparkle, - PaperPlaneRight, - Database, - TextAlignLeft + NotebookIcon as Notebook, + ClockIcon as Clock, + FunnelIcon as Funnel, + SparkleIcon as Sparkle, + PaperPlaneRightIcon as PaperPlaneRight, + DatabaseIcon as Database, + TextAlignLeftIcon as TextAlignLeft } from "@phosphor-icons/react"; interface Note { diff --git a/src/app/pond/page.tsx b/src/app/pond/page.tsx index c739df0..07fbe92 100644 --- a/src/app/pond/page.tsx +++ b/src/app/pond/page.tsx @@ -2,24 +2,25 @@ import React, { useState, useEffect, useRef, useMemo } from "react"; import { getFeedbackList, createFeedback, likeFeedback, getFeedbackTypes } from "@/api/pond"; +import { useAuthorProfile } from "@/hooks/useSysConfig"; import { motion, AnimatePresence } from "framer-motion"; import gsap from "gsap"; import { - Fish, - Heart, - Lightbulb, - Sparkle, - Bug, - WarningCircle, - CheckCircle, - PushPin, - PaperPlaneRight, - Megaphone, - Globe, - EnvelopeSimple, - CircleNotch, - ChatCircleText, - CaretDown + FishIcon as Fish, + HeartIcon as Heart, + LightbulbIcon as Lightbulb, + SparkleIcon as Sparkle, + BugIcon as Bug, + WarningCircleIcon as WarningCircle, + CheckCircleIcon as CheckCircle, + PushPinIcon as PushPin, + PaperPlaneRightIcon as PaperPlaneRight, + MegaphoneIcon as Megaphone, + GlobeIcon as Globe, + EnvelopeSimpleIcon as EnvelopeSimple, + CircleNotchIcon as CircleNotch, + ChatCircleTextIcon as ChatCircleText, + CaretDownIcon as CaretDown } from "@phosphor-icons/react"; interface PondFeedbackReply { @@ -354,6 +355,7 @@ const FeedbackCard = ({ fb, onLike, dbTypes }: { fb: PondFeedback; onLike: (id: }; export default function PondPage() { + const author = useAuthorProfile(); const [feedbacks, setFeedbacks] = useState([]); const [loading, setLoading] = useState(true); const [activePool, setActivePool] = useState("all"); @@ -449,6 +451,8 @@ export default function PondPage() { }; const getMockFallbackList = (cat: string) => { + const adminNickname = author.name ? `${author.name} (博主)` : "RRTiamo (博主)"; + const adminAvatar = author.avatar || "/life-assets/avatar.jpg"; const mockDbFeedbacks = [ { id: 1, @@ -469,8 +473,8 @@ export default function PondPage() { tags: [{ id: 1, name: "UI", color: "#ec4899" }], replies: [{ id: 1, - nickname: "RRTiamo (博主)", - avatar: "/life-assets/avatar.jpg", + nickname: adminNickname, + avatar: adminAvatar, content: "谢谢你的喜欢!写前端最开心的就是能用代码把心里的想法‘物理显化’出来。流体背景和 3D 卡片确实调了很久,能被你注意到这些细节真的非常欣慰!", isAdmin: true, createdAt: "2026-06-24T14:20:00" @@ -496,8 +500,8 @@ export default function PondPage() { tags: [{ id: 2, name: "后台", color: "#3b82f6" }], replies: [{ id: 2, - nickname: "RRTiamo (博主)", - avatar: "/life-assets/avatar.jpg", + nickname: adminNickname, + avatar: adminAvatar, content: "这个改进点提得太及时了!最近重构了系统配置页面,已经把外观配置、背景切换和视频链接动态绑定的模块都完成了,目前前台已支持一键实时换肤和背景视频渲染,欢迎测试!", isAdmin: true, createdAt: "2026-06-23T11:00:00" diff --git a/src/app/writing/[slug]/page.tsx b/src/app/writing/[slug]/page.tsx index 3db6f41..e79a018 100644 --- a/src/app/writing/[slug]/page.tsx +++ b/src/app/writing/[slug]/page.tsx @@ -7,6 +7,7 @@ import Image from "next/image"; import { ArrowLeft, Lock, Calendar, Tag, Smile, AlignLeft, Compass } from "lucide-react"; import { writingData, Post } from "@/data/writing"; import { getBlogDetailBySlug } from "@/api/blogs"; +import { useAuthorProfile } from "@/hooks/useSysConfig"; import ParallaxImage from "@/components/ui/ParallaxImage"; import PasscodeGate from "@/components/ui/PasscodeGate"; import Markdown from "@/components/ui/Markdown"; @@ -14,6 +15,7 @@ import Markdown from "@/components/ui/Markdown"; export default function PostPage() { const params = useParams(); const slug = params.slug as string; + const author = useAuthorProfile(); const [post, setPost] = useState(null); const [loading, setLoading] = useState(true); @@ -177,7 +179,7 @@ export default function PostPage() { setUnlocked(true)} title={`解锁加密档案:《${post.title}》`} - description="此随笔包含隐私片段。请输入访问口令(默认:2026)解锁查看全站加密内容。" + description="此随笔包含隐私片段。请输入访问口令解锁查看全站加密内容。" /> ); } @@ -323,15 +325,15 @@ export default function PostPage() {
Rrtiamo
-

Rrtiamo

+

{author.name || "Rrtiamo"}

Archivist & Author

diff --git a/src/components/Footer.tsx b/src/components/Footer.tsx index c216693..4b0bb18 100644 --- a/src/components/Footer.tsx +++ b/src/components/Footer.tsx @@ -1,10 +1,11 @@ "use client"; import FooterPeekers from "@/components/ui/FooterPeekers"; -import { useSysConfig } from "@/hooks/useSysConfig"; +import { useSysConfig, useAuthorProfile } from "@/hooks/useSysConfig"; export default function Footer() { const { configs } = useSysConfig(); + const author = useAuthorProfile(); const getConfigValue = (key: string, defaultValue = "") => { const cfg = configs.find((c) => c.configKey === key); @@ -31,7 +32,7 @@ export default function Footer() { {/* 2. 强力驱动与版权声明 */}

- © 2026 Rrtiamo. All rights reserved. + © 2026 {author.name || "Rrtiamo"}. All rights reserved. 本网站由 Spring Breeze 强力驱动

diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx index 56eab4f..c26727e 100644 --- a/src/components/Navbar.tsx +++ b/src/components/Navbar.tsx @@ -253,6 +253,7 @@ export default function Navbar() { > setIsMenuOpen(false)} className={`group flex flex-col justify-center items-start p-2.5 rounded-2xl border border-charcoal/5 dark:border-white/5 bg-cream-dark/20 dark:bg-charcoal/20 hover:bg-cream-dark/60 dark:hover:bg-charcoal/60 hover:border-charcoal/10 dark:hover:border-white/10 transition-all duration-300 active:scale-[0.98] ${ isActive ? "border-gold/30 bg-gold/5 dark:bg-gold/10" : "" diff --git a/src/components/footprints/FootprintsPageClient.tsx b/src/components/footprints/FootprintsPageClient.tsx index a023d71..10390a5 100644 --- a/src/components/footprints/FootprintsPageClient.tsx +++ b/src/components/footprints/FootprintsPageClient.tsx @@ -6,6 +6,7 @@ import { Compass, Calendar, MapPin, X, Info } from "lucide-react"; import * as Icons from "lucide-react"; import gsap from "gsap"; import { DynamicIcon } from "@/icon/love"; +import { useAuthorProfile, useCoupleProfile } from "@/hooks/useSysConfig"; interface FootprintItem { id: string; @@ -89,6 +90,10 @@ export default function FootprintsPageClient({ apiMapCode, categories = defaultCategories, }: FootprintsPageClientProps) { + const author = useAuthorProfile(); + const couple = useCoupleProfile(); + const boyAvatar = author.avatar || "/assets/avtor-boy.jpg"; + const girlAvatar = couple.avatar ?? ""; const [items] = useState(initialItems); const [filter, setFilter] = useState("all"); const [selectedItem, setSelectedItem] = useState(null); @@ -263,20 +268,44 @@ export default function FootprintsPageClient({ filteredItems.forEach((item) => { const markerContent = document.createElement("div"); markerContent.className = "custom-map-marker group/marker"; - - // 男生头像代表光影照片,女生头像代表甜蜜恋爱瞬间 - const avatarSrc = item.type === "love" ? "/assets/avtor-girl.jpg" : "/assets/avtor-boy.jpg"; - markerContent.innerHTML = ` -
-
-
-
- avatar -
-
-
- `; + // 男生头像代表光影照片,女生头像代表甜蜜恋爱瞬间(身份媒体均在管理端配置,未配置时留空) + // 用 DOM API 构建而非 innerHTML 拼接,避免管理端可配置的 URL 造成注入 + const avatarSrc = item.type === "love" ? girlAvatar : boyAvatar; + + const wrapper = document.createElement("div"); + wrapper.className = + "marker-wrapper relative flex items-center justify-center transition-all duration-300"; + + const pulse = document.createElement("div"); + pulse.className = + "marker-pulse-ring absolute inset-0 rounded-full bg-amber-500/30 border border-amber-500/40 animate-ping opacity-60"; + + const glow = document.createElement("div"); + glow.className = + "marker-glow-ring absolute -inset-0.5 rounded-full border border-amber-500/50 bg-cream/90 shadow-lg dark:bg-charcoal"; + + const avatarCircle = document.createElement("div"); + avatarCircle.className = + "marker-avatar-circle relative h-8 w-8 overflow-hidden rounded-full border border-charcoal/10 dark:border-white/15 bg-white"; + if (avatarSrc) { + const img = document.createElement("img"); + img.src = avatarSrc; + img.alt = "avatar"; + img.className = + "h-full w-full object-cover transition-transform duration-300 group-hover/marker:scale-110"; + avatarCircle.appendChild(img); + } + + const dot = document.createElement("div"); + dot.className = + "marker-dot-bottom absolute -bottom-0.5 left-1/2 h-1.5 w-1.5 -translate-x-1/2 rounded-full bg-amber-500 border border-white dark:border-charcoal shadow-sm"; + + wrapper.appendChild(pulse); + wrapper.appendChild(glow); + wrapper.appendChild(avatarCircle); + wrapper.appendChild(dot); + markerContent.appendChild(wrapper); const marker = new AMap.Marker({ position: [item.longitude, item.latitude], @@ -323,7 +352,7 @@ export default function FootprintsPageClient({ map.setFitView(Object.values(markersRef.current), false, [60, 60, 60, 60], 12); } } - }, [filteredItems, mapLoaded]); + }, [filteredItems, mapLoaded, boyAvatar, girlAvatar]); // 6. 列表卡片与地图 Marker 联动 const handleItemHover = (id: string | null) => { diff --git a/src/components/gallery/GalleryCard.tsx b/src/components/gallery/GalleryCard.tsx index 642700c..44d006b 100644 --- a/src/components/gallery/GalleryCard.tsx +++ b/src/components/gallery/GalleryCard.tsx @@ -9,19 +9,30 @@ interface GalleryCardProps { onClick: () => void; } +// 手账拍立得相纸:统一白相纸 + 纸胶带粘贴,仅倾斜角度不同营造随手贴的错落感 +const TILTS = [ + "-rotate-2", + "rotate-[1.6deg]", + "-rotate-[1.2deg]", + "rotate-[2deg]", + "-rotate-[1.8deg]", + "rotate-[0.9deg]", +]; + export default function GalleryCard({ photo, index, onClick }: GalleryCardProps) { const isVideo = photo.type === "video"; const itemNumber = index < 9 ? `0${index + 1}` : `${index + 1}`; + const tilt = TILTS[index % TILTS.length]; - // 根据相机品牌决定渲染何种艺术印戳 + // 手账印章:常驻半透明,悬停加深 const renderDarkroomStamp = () => { const cam = photo.camera.toLowerCase(); - + const base = "absolute top-3 right-3 z-30 pointer-events-none select-none opacity-30 transition-opacity duration-500 group-hover:opacity-70"; + if (cam.includes("leica")) { return ( -
- {/* 红色 Leica 圆戳 */} -
+
+
LEICA LAB WET PROCESS PASS // OK @@ -29,35 +40,29 @@ export default function GalleryCard({ photo, index, onClick }: GalleryCardProps)
); } - if (cam.includes("contax")) { return ( -
- {/* 矩形 Contax 双线印戳 */} -
+
+
CONTAX T2 ZEISS T* COMPACT
); } - if (cam.includes("hasselblad")) { return ( -
- {/* 长条哈苏印戳 */} -
+
+
HASSELBLAD 503CX // 6x6
); } - - // 默认通用暗房戳 return ( -
-
+
+
DARKROOM / SHEET
@@ -67,116 +72,93 @@ export default function GalleryCard({ photo, index, onClick }: GalleryCardProps) return (
- {/* 媒体展示框 - 无卡框极简设计 */} -
- - {/* 精致的物理底片边缘刻度饰线 (仅在悬停时隐约可见) */} -
+ {/* 纸胶带装饰 */} +