From 8ed2031c45cf2c078360201f1266e7246112f3cc Mon Sep 17 00:00:00 2001 From: kkfluous Date: Thu, 2 Apr 2026 18:12:48 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B0=B4=E5=8D=B0=E7=A7=BB=E5=88=B0?= =?UTF-8?q?=E5=85=A8=E5=B1=80Shell=EF=BC=8C=E8=B5=84=E4=BA=A7=E5=92=8C?= =?UTF-8?q?=E9=87=8C=E7=A8=8B=E9=A1=B5=E9=9D=A2=E9=83=BD=E6=9C=89=E6=B0=B4?= =?UTF-8?q?=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.6 (1M context) --- src/components/Shell.tsx | 17 ++++++++++++++++- src/modules/assets/AssetsModule.tsx | 10 ---------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/components/Shell.tsx b/src/components/Shell.tsx index 8d952df..b94d355 100644 --- a/src/components/Shell.tsx +++ b/src/components/Shell.tsx @@ -1,4 +1,5 @@ -import { useState, useEffect, type ComponentType } from 'react'; +import { useState, useEffect, useMemo, type ComponentType } from 'react'; +import { useAuth } from '../auth/useAuth'; export interface ModuleConfig { id: string; @@ -55,8 +56,22 @@ export function Shell({ modules }: { modules: ModuleConfig[] }) { const ActiveComponent = modules.find((m) => m.id === activeModule)?.component ?? modules[0]?.component; + const { user } = useAuth(); + const watermarkText = useMemo(() => { + const name = user?.userName || '未登录'; + const time = new Date().toLocaleString('zh-CN', { year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit', second: '2-digit', hour12: false }).replace(/\//g, '-'); + return `${name}-${time}`; + }, [user]); + return (
+ {/* 全局水印 */} +
+
${watermarkText}`)}")`, + backgroundRepeat: 'repeat', + }} /> +
{/* Web 侧边栏 (md 及以上) */}