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 及以上) */}