feat: 支持主题系统Logo与欢迎页开关

This commit is contained in:
fengxiangdebaozi committed 2026-07-16 22:31:22 +08:00
1 parent b97aa77adc
commit 82dd9fb08f
12 files changed
+178 -22

No files matched your search

@@ -1,4 +1,4 @@
import { Bell, ChevronDown, FileText, User } from "lucide-react";
import { Bell, ChevronDown, User } from "lucide-react";
import { useState } from "react";
import { useLocation, useNavigate } from "react-router-dom";
@@ -12,6 +12,7 @@ import {
import { NotificationDialog } from "@/components/workspace/notification-dialog";
import { getStoredAuth } from "@/core/auth";
import { useLiveAccount } from "@/core/auth/use-live-account";
import { getHeaderBrandAsset, getHeaderBrandFallback } from "@/core/branding/brand-assets";
import { isWujieEnv } from "@/core/embed/wujie";
import { useUnreadCount } from "@/core/notifications";
import { useMyPosition } from "@/core/positions";
@@ -46,6 +47,17 @@ type HeaderProps = {
const Header = ({ collapsed }: HeaderProps) => {
const { theme } = useTheme();
const isDark = theme === "dark";
const brandTheme = theme;
const configuredBrandLogo = getHeaderBrandAsset(brandTheme);
const fallbackBrandLogo = getHeaderBrandFallback(brandTheme);
const [failedBrandLogo, setFailedBrandLogo] = useState<string | null>(null);
const brandLogo =
failedBrandLogo === configuredBrandLogo ? fallbackBrandLogo : configuredBrandLogo;
const handleBrandLogoError = () => {
if (brandLogo !== fallbackBrandLogo) {
setFailedBrandLogo(brandLogo);
}
};
const [notificationOpen, setNotificationOpen] = useState(false);
const { data: unreadCount = 0 } = useUnreadCount();
const navigate = useNavigate();
@@ -227,7 +239,19 @@ const Header = ({ collapsed }: HeaderProps) => {
{showTopNav ? (
<>
{/* 左分区(flex-1):菜单靠右贴近中间基座 */}
<div className="flex h-full min-w-0 flex-1 items-center justify-end">
<div className="flex h-full min-w-0 flex-1 items-center justify-between">
<div
className="flex h-10 w-10 shrink-0 items-center justify-center rounded-lg border border-cyan-300/25 bg-blue-950/55"
title="系统 Logo"
>
<img
src={brandLogo}
alt=""
aria-hidden="true"
className="h-[35px] w-[35px] object-contain"
onError={handleBrandLogoError}
/>
</div>
<nav
className="top-submenu-bar top-submenu-bar--group"
aria-label="左侧菜单"
@@ -238,8 +262,12 @@ const Header = ({ collapsed }: HeaderProps) => {
</nav>
</div>
{/* 中:CM助手(落在背景图发光基座上,纯文字无图标) */}
<div className="header-center-title">{desensitizeText("CM业务中心")}</div>
{/* 中:系统 logo + 名称,落在背景图发光基座上。 */}
<div className="header-center-title">
<span className="header-center-title__label">
{desensitizeText("CM业务中心")}
</span>
</div>
{/* 右分区(flex-1):菜单靠左贴近中间基座,操作区靠最右 */}
<div className="flex h-full min-w-0 flex-1 items-center justify-between">
@@ -261,10 +289,16 @@ const Header = ({ collapsed }: HeaderProps) => {
{/* 浅色顶栏:logo + 一级导航横排(白字落在 banner 上) */}
<div className="flex h-full min-w-0 flex-1 items-center">
<div className="flex flex-shrink-0 items-center gap-2 pr-1">
<div className="flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-lg bg-white/20">
<FileText className="h-4 w-4 text-white" />
<div className="flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-lg bg-white/20">
<img
src={brandLogo}
alt=""
aria-hidden="true"
className="h-[35px] w-[35px] object-contain"
onError={handleBrandLogoError}
/>
</div>
<span className="whitespace-nowrap text-base font-semibold text-white">
<span className="whitespace-nowrap text-lg font-semibold text-white">
{desensitizeText("CM业务中心")}
</span>
</div>
@@ -288,7 +322,13 @@ const Header = ({ collapsed }: HeaderProps) => {
: "bg-white/20",
)}
>
<FileText className="h-4 w-4 text-white" />
<img
src={brandLogo}
alt=""
aria-hidden="true"
className="h-7 w-7 object-contain"
onError={handleBrandLogoError}
/>
</div>
{!collapsed && (
<span className="text-sm font-semibold text-white">