feat: 可视化大屏展示

This commit is contained in:
2025-12-26 19:50:46 +08:00
parent 9fd7e0c656
commit 02f9b46b22
453 changed files with 70777 additions and 130 deletions
@@ -0,0 +1,383 @@
.blank-layout {
min-height: 100vh;
background: var(--bg-primary);
}
.blank-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 24px;
height: 56px;
line-height: 56px;
background: linear-gradient(180deg, rgba(19, 26, 61, 0.98) 0%, rgba(10, 14, 39, 0.95) 100%) !important;
border-bottom: 1px solid var(--border-color);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
position: sticky;
top: 0;
z-index: 100;
}
.header-left {
display: flex;
align-items: center;
}
.logo {
display: flex;
align-items: center;
cursor: pointer;
transition: opacity 0.2s;
&:hover {
opacity: 0.85;
}
}
.logo-icon {
font-size: 24px;
color: var(--accent-blue);
margin-right: 10px;
}
.logo-text {
font-size: 18px;
font-weight: 600;
color: var(--text-primary);
background: linear-gradient(135deg, #00d4ff 0%, #00ff88 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
.header-center {
flex: 1;
display: flex;
justify-content: center;
padding: 0 24px;
}
.header-right {
display: flex;
align-items: center;
gap: 24px;
}
.current-time {
color: var(--text-secondary);
font-size: 14px;
font-family: 'Courier New', monospace;
}
.user-info {
cursor: pointer;
padding: 4px 12px;
border-radius: 20px;
transition: background 0.2s;
&:hover {
background: rgba(0, 212, 255, 0.1);
}
}
.user-name {
color: var(--text-primary);
font-size: 14px;
}
.blank-content {
height: calc(100vh - 56px);
overflow: auto;
background: var(--bg-primary);
}
.blank-content--dashboard {
height: calc(100vh - 80px);
overflow: hidden;
}
.blank-content--map3d {
height: calc(100vh - 72px);
overflow: hidden;
}
.blank-header--map3d {
display: grid;
grid-template-columns: 1fr auto 1fr;
height: 72px;
line-height: 72px;
padding: 0 16px;
background: rgba(10, 20, 30, 0.88) !important;
border-bottom: 1px solid rgba(0, 240, 255, 0.12);
box-shadow: 0 2px 16px rgba(0, 0, 0, 0.45);
backdrop-filter: blur(10px);
.header-left,
.header-center,
.header-right {
display: flex;
align-items: center;
}
.header-left {
min-width: 260px;
}
.header-center {
justify-content: center;
padding: 0 10px;
}
.header-right {
justify-content: flex-end;
gap: 10px;
}
.map3d-header-slot {
display: flex;
align-items: center;
min-height: 1px;
}
#map3d-header-left {
justify-content: flex-start;
gap: 10px;
}
#map3d-header-center {
justify-content: center;
width: 100%;
}
#map3d-header-right {
justify-content: flex-end;
gap: 10px;
}
.user-info {
padding: 4px 10px;
border-radius: 999px;
border: 1px solid rgba(0, 240, 255, 0.14);
background: rgba(255, 255, 255, 0.04);
&:hover {
background: rgba(0, 240, 255, 0.10);
border-color: rgba(0, 240, 255, 0.28);
}
}
.user-name {
color: rgba(255, 255, 255, 0.9);
}
}
.blank-header--dashboard {
height: 80px;
line-height: 80px;
padding: 0 22px;
background: linear-gradient(180deg, rgba(7, 10, 26, 0.92) 0%, rgba(7, 10, 26, 0.66) 100%) !important;
border-bottom: none;
overflow: hidden;
box-shadow:
0 2px 12px rgba(0, 0, 0, 0.28),
inset 0 -1px 0 rgba(0, 212, 255, 0.18);
position: sticky;
&::before {
content: '';
position: absolute;
left: 0;
right: 0;
top: 0;
height: 1px;
background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.55), transparent);
opacity: 0.45;
pointer-events: none;
}
&::after {
content: '';
position: absolute;
top: 0;
left: -30%;
width: 30%;
height: 100%;
background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.12), transparent);
transform: skewX(-18deg);
animation: headerSweep 5.2s linear infinite;
opacity: 0.65;
pointer-events: none;
}
.header-left {
flex: 1.2;
justify-content: flex-start;
}
.header-center {
flex: 1.6;
justify-content: center;
padding: 0 12px;
}
.header-right {
flex: 1.2;
justify-content: flex-end;
gap: 12px;
}
.dashboard-title {
position: relative;
display: flex;
align-items: center;
justify-content: center;
width: 100%;
max-width: 920px;
padding: 0 18px;
&::before,
&::after {
content: '';
flex: 1;
height: 1px;
background: linear-gradient(90deg, rgba(0, 212, 255, 0), rgba(0, 212, 255, 0.55));
opacity: 0.55;
}
&::after {
background: linear-gradient(90deg, rgba(0, 212, 255, 0.55), rgba(0, 212, 255, 0));
}
.dashboard-title__text {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 10px 28px;
margin: 0 14px;
border-radius: 999px;
border: 1px solid rgba(0, 212, 255, 0.28);
background: rgba(19, 26, 61, 0.42);
font-size: 28px;
font-weight: 800;
letter-spacing: 8px;
line-height: 1.1;
font-family: 'DIN Alternate', 'HarmonyOS Sans', 'Microsoft YaHei', 'PingFang SC', 'Segoe UI', sans-serif;
color: #fff;
text-shadow: 0 0 18px rgba(0, 212, 255, 0.35);
background-image: linear-gradient(180deg, #ffffff 0%, #aeeeff 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
.dashboard-title__deco {
position: absolute;
bottom: 14px;
left: 50%;
transform: translateX(-50%);
width: 320px;
height: 2px;
background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.9), transparent);
filter: drop-shadow(0 0 8px rgba(0, 212, 255, 0.35));
opacity: 0.75;
}
}
.dashboard-filter {
display: flex;
align-items: center;
gap: 10px;
padding: 10px 12px;
border-radius: 10px;
border: 1px solid rgba(0, 212, 255, 0.22);
background: rgba(19, 26, 61, 0.42);
backdrop-filter: blur(8px);
.dashboard-filter__label {
color: rgba(255, 255, 255, 0.72);
font-size: 12px;
letter-spacing: 2px;
white-space: nowrap;
}
:global(.ant-space) {
gap: 8px !important;
}
:global(.ant-checkbox-wrapper) {
color: rgba(255, 255, 255, 0.68) !important;
font-size: 12px;
user-select: none;
}
:global(.ant-tree-select) {
min-width: 260px;
}
:global(.ant-select-selector) {
background: rgba(0, 212, 255, 0.04) !important;
border: 1px solid rgba(0, 212, 255, 0.22) !important;
color: #fff !important;
border-radius: 8px !important;
}
:global(.ant-select-arrow) {
color: rgba(255, 255, 255, 0.55);
}
}
.dashboard-user--dashboard {
padding: 6px 10px;
border-radius: 999px;
border: 1px solid rgba(0, 212, 255, 0.22);
background: rgba(19, 26, 61, 0.42);
backdrop-filter: blur(8px);
}
:global(.ant-tree-select) {
:global(.ant-select-selector) {
background: rgba(0, 212, 255, 0.05) !important;
border: 1px solid rgba(0, 212, 255, 0.2) !important;
color: #fff !important;
border-radius: 6px;
}
}
}
@keyframes headerSweep {
0% { transform: translateX(0) skewX(-18deg); opacity: 0; }
8% { opacity: 0.65; }
55% { opacity: 0.35; }
100% { transform: translateX(520%) skewX(-18deg); opacity: 0; }
}
@media (max-width: 768px) {
.blank-header {
padding: 0 12px;
}
.blank-header:not(.blank-header--map3d) .header-center {
display: none;
}
.blank-header--map3d {
padding: 0 12px;
.header-left {
min-width: 0;
}
.header-center {
display: flex;
justify-content: center;
}
}
.current-time {
display: none;
}
.logo-text {
font-size: 16px;
}
}
+130
View File
@@ -0,0 +1,130 @@
import React, { useState, useEffect } from 'react';
import { history, useLocation } from 'umi';
import { Layout, Space, Avatar, Dropdown, message } from 'antd';
import { LogoutOutlined, UserOutlined, EnvironmentOutlined } from '@ant-design/icons';
import type { MenuProps } from 'antd';
import TenantScopeFilter from '@/components/TenantScopeFilter';
import { outLogin, currentUser } from '@/services/login';
import { clearTenantCache } from '@/utils/tenantCache';
import './BlankLayout.less';
const { Header, Content } = Layout;
// UmiJS 3.x 使用 props.children 渲染子路由
const BlankLayout: React.FC<{ children?: React.ReactNode }> = ({ children }) => {
const location = useLocation();
const isDashboard = location.pathname === '/dashboard';
const isMap3d = location.pathname === '/map3d' || location.pathname.startsWith('/map3d/');
const [currentTime, setCurrentTime] = useState<string>('');
const [userName, setUserName] = useState<string>('');
useEffect(() => {
if (isDashboard || isMap3d) return;
// 更新时间
const updateTime = () => {
const now = new Date();
setCurrentTime(now.toLocaleString('zh-CN', {
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
hour12: false
}));
};
updateTime();
const timer = setInterval(updateTime, 1000);
return () => clearInterval(timer);
}, [isDashboard]);
useEffect(() => {
// 获取当前用户
(async () => {
try {
const user = await currentUser();
if (user?.username || user?.nickname) {
setUserName(user.nickname || user.username);
}
} catch {}
})();
}, []);
const handleLogout = async () => {
try {
await outLogin();
} catch {}
sessionStorage.removeItem('access_token');
sessionStorage.removeItem('current_user');
clearTenantCache();
message.success('已退出登录');
history.push('/user/login');
};
const userMenuItems: MenuProps['items'] = [
{
key: 'logout',
icon: <LogoutOutlined />,
label: '退出登录',
onClick: handleLogout,
},
];
const handleTenantChange = (tenantId: string, includeChildren: boolean) => {
// 租户变更后刷新页面数据(通过事件通知)
window.dispatchEvent(new CustomEvent('tenant-change', {
detail: { tenantId, includeChildren }
}));
};
return (
<Layout className="blank-layout">
<Header className={`blank-header${isDashboard ? ' blank-header--dashboard' : ''}${isMap3d ? ' blank-header--map3d' : ''}`}>
<div className="header-left">
{isDashboard ? (
<div className="dashboard-filter">
<div className="dashboard-filter__label">租户范围</div>
<TenantScopeFilter onChanged={handleTenantChange} autoApply size="small" />
</div>
) : isMap3d ? (
<div id="map3d-header-left" className="map3d-header-slot" />
) : (
<div className="logo" onClick={() => history.push('/dashboard')}>
<EnvironmentOutlined className="logo-icon" />
<span className="logo-text">鹰眼管控平台</span>
</div>
)}
</div>
<div className="header-center">
{isDashboard ? (
<div className="dashboard-title">
<span className="dashboard-title__text">鹰眼管控平台 -运营总览</span>
<span className="dashboard-title__deco" />
</div>
) : isMap3d ? (
<div id="map3d-header-center" className="map3d-header-slot" />
) : (
<TenantScopeFilter onChanged={handleTenantChange} autoApply />
)}
</div>
<div className="header-right">
{!isDashboard && !isMap3d && <span className="current-time">{currentTime}</span>}
{isMap3d && <div id="map3d-header-right" className="map3d-header-slot" />}
<div className={`dashboard-user${isDashboard ? ' dashboard-user--dashboard' : ''}`}>
<Dropdown menu={{ items: userMenuItems }} placement="bottomRight">
<Space className="user-info">
<Avatar size="small" icon={<UserOutlined />} />
<span className="user-name">{userName || '用户'}</span>
</Space>
</Dropdown>
</div>
</div>
</Header>
<Content className={`blank-content${isDashboard ? ' blank-content--dashboard' : ''}${isMap3d ? ' blank-content--map3d' : ''}`}>
{children}
</Content>
</Layout>
);
};
export default BlankLayout;