This repository has been archived on 2026-01-02. You can view files and clone it, but cannot push or open issues or pull requests.
portal-test/src.html
2025-10-15 01:32:53 +08:00

573 lines
17 KiB
HTML

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Portal 主页</title>
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@600&family=Open+Sans:wght@400;600&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Open Sans', sans-serif;
background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
min-height: 100vh;
color: #2C3E50;
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 20px;
}
/* 顶部导航栏 */
header {
background-color: white;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
padding: 16px 24px;
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 24px;
}
.logo {
display: flex;
align-items: center;
}
.logo h1 {
font-family: 'Montserrat', sans-serif;
font-size: 24px;
color: #2C3E50;
margin-left: 12px;
}
.user-info {
display: flex;
align-items: center;
}
.user-avatar {
width: 40px;
height: 40px;
border-radius: 50%;
background-color: #3498DB;
display: flex;
align-items: center;
justify-content: center;
color: white;
font-weight: bold;
margin-right: 12px;
}
.user-name {
font-weight: 600;
margin-right: 16px;
}
.logout-btn {
background: none;
border: none;
color: #95A5A6;
cursor: pointer;
font-size: 16px;
transition: color 0.3s ease;
}
.logout-btn:hover {
color: #E74C3C;
}
/* Tab导航 */
.tabs {
background-color: white;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
margin-bottom: 24px;
overflow: hidden;
}
.tab-list {
display: flex;
border-bottom: 1px solid #ECF0F1;
}
.tab-item {
padding: 16px 24px;
cursor: pointer;
font-weight: 600;
color: #95A5A6;
transition: all 0.3s ease;
position: relative;
}
.tab-item:hover {
color: #3498DB;
background-color: #f8f9fa;
}
.tab-item.active {
color: #3498DB;
}
.tab-item.active::after {
content: "";
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 3px;
background-color: #3498DB;
}
/* 卡片容器 */
.cards-container {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 24px;
}
/* 卡片样式 */
.card {
background-color: white;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
padding: 24px;
position: relative;
transition: all 0.3s ease;
overflow: hidden;
height: 100%;
display: flex;
flex-direction: column;
}
.card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.12);
}
.card-badge {
position: absolute;
top: 16px;
right: 16px;
padding: 6px 12px;
border-radius: 20px;
font-size: 12px;
font-weight: 600;
cursor: pointer;
transition: all 0.3s ease;
}
.badge-public {
background-color: rgba(46, 204, 113, 0.15);
color: #2ECC71;
}
.badge-internal {
background-color: rgba(231, 76, 60, 0.15);
color: #E74C3C;
}
.card-icon {
width: 60px;
height: 60px;
border-radius: 12px;
background-color: #f8f9fa;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 16px;
font-size: 24px;
color: #3498DB;
}
.card-title {
font-size: 18px;
font-weight: 600;
margin-bottom: 8px;
color: #2C3E50;
}
.card-description {
color: #95A5A6;
font-size: 14px;
margin-bottom: 16px;
flex-grow: 1;
}
.card-action {
display: flex;
justify-content: space-between;
align-items: center;
}
.card-link {
color: #3498DB;
text-decoration: none;
font-weight: 600;
font-size: 14px;
display: flex;
align-items: center;
transition: all 0.3s ease;
}
.card-link:hover {
color: #2980B9;
}
.card-link i {
margin-left: 6px;
transition: transform 0.3s ease;
}
.card-link:hover i {
transform: translateX(3px);
}
.card-stats {
display: flex;
align-items: center;
color: #95A5A6;
font-size: 12px;
}
.card-stats i {
margin-right: 4px;
}
/* 工具提示 */
.tooltip {
position: relative;
}
.tooltip::before {
content: attr(data-tooltip);
position: absolute;
bottom: 125%;
left: 50%;
transform: translateX(-50%);
background-color: #2C3E50;
color: white;
padding: 6px 12px;
border-radius: 6px;
font-size: 12px;
white-space: nowrap;
opacity: 0;
pointer-events: none;
transition: opacity 0.3s ease;
z-index: 10;
}
.tooltip::after {
content: "";
position: absolute;
bottom: 115%;
left: 50%;
transform: translateX(-50%);
border-width: 5px;
border-style: solid;
border-color: #2C3E50 transparent transparent transparent;
opacity: 0;
pointer-events: none;
transition: opacity 0.3s ease;
}
.tooltip:hover::before,
.tooltip:hover::after {
opacity: 1;
}
/* 空状态 */
.empty-state {
text-align: center;
padding: 60px 20px;
color: #95A5A6;
}
.empty-state i {
font-size: 48px;
margin-bottom: 16px;
color: #ECF0F1;
}
.empty-state h3 {
font-size: 18px;
margin-bottom: 8px;
color: #7F8C8D;
}
/* 响应式设计 */
@media (max-width: 768px) {
.tab-list {
overflow-x: auto;
-webkit-overflow-scrolling: touch;
}
.cards-container {
grid-template-columns: 1fr;
}
header {
flex-direction: column;
padding: 16px;
}
.logo {
margin-bottom: 12px;
}
.user-info {
width: 100%;
justify-content: space-between;
}
}
</style>
</head>
<body>
<div class="container">
<!-- 顶部导航栏 -->
<header>
<div class="logo">
<i class="fas fa-cube"></i>
<h1>PORTAL</h1>
</div>
<div class="user-info">
<div class="user-avatar">U</div>
<div class="user-name">用户名</div>
<button class="logout-btn"><i class="fas fa-sign-out-alt"></i></button>
</div>
</header>
<!-- Tab导航 -->
<div class="tabs">
<div class="tab-list">
<div class="tab-item active" data-tab="common">常用应用</div>
<div class="tab-item" data-tab="dev">开发工具</div>
<div class="tab-item" data-tab="office">办公系统</div>
<div class="tab-item" data-tab="resources">资源中心</div>
</div>
</div>
<!-- 卡片容器 -->
<div class="cards-container" id="cards-container">
<!-- 卡片将通过JavaScript动态生成 -->
</div>
</div>
<script>
// 模拟数据
const portalData = {
common: [
{
id: 1,
title: "企业邮箱",
description: "公司官方邮件系统,支持多设备同步",
icon: "fa-envelope",
network: "public",
networkName: "StarNet",
visits: 1280
},
{
id: 2,
title: "内部通讯",
description: "企业内部即时通讯工具,支持群组聊天",
icon: "fa-comments",
network: "internal",
networkName: "IntraNet",
visits: 2450
},
{
id: 3,
title: "云文档",
description: "企业文档协作平台,支持多人实时编辑",
icon: "fa-file-alt",
network: "public",
networkName: "StarNet",
visits: 1876
},
{
id: 4,
title: "项目管理系统",
description: "全流程项目管理工具,支持敏捷开发",
icon: "fa-tasks",
network: "internal",
networkName: "DevNet",
visits: 932
}
],
dev: [
{
id: 5,
title: "代码仓库",
description: "企业级代码版本控制系统",
icon: "fa-code-branch",
network: "internal",
networkName: "DevNet",
visits: 1542
},
{
id: 6,
title: "CI/CD平台",
description: "持续集成与持续部署自动化平台",
icon: "fa-rocket",
network: "internal",
networkName: "DevNet",
visits: 876
},
{
id: 7,
title: "API网关",
description: "统一API管理与监控平台",
icon: "fa-plug",
network: "public",
networkName: "StarNet",
visits: 1203
}
],
office: [
{
id: 8,
title: "人力资源系统",
description: "员工信息、考勤、绩效管理平台",
icon: "fa-users",
network: "internal",
networkName: "IntraNet",
visits: 2105
},
{
id: 9,
title: "财务系统",
description: "企业财务核算与报销管理系统",
icon: "fa-calculator",
network: "internal",
networkName: "FinanceNet",
visits: 1876
},
{
id: 10,
title: "合同管理",
description: "企业合同全生命周期管理系统",
icon: "fa-file-contract",
network: "internal",
networkName: "IntraNet",
visits: 945
}
],
resources: [
{
id: 11,
title: "知识库",
description: "企业知识管理与文档共享平台",
icon: "fa-book",
network: "public",
networkName: "StarNet",
visits: 3241
},
{
id: 12,
title: "培训中心",
description: "员工在线学习与技能提升平台",
icon: "fa-graduation-cap",
network: "public",
networkName: "StarNet",
visits: 1876
},
{
id: 13,
title: "资源下载",
description: "软件、模板、文档资源下载中心",
icon: "fa-download",
network: "internal",
networkName: "IntraNet",
visits: 2654
}
]
};
// 获取DOM元素
const tabItems = document.querySelectorAll('.tab-item');
const cardsContainer = document.getElementById('cards-container');
// 初始化页面
function init() {
// 渲染默认Tab内容
renderCards('common');
// 添加Tab点击事件
tabItems.forEach(tab => {
tab.addEventListener('click', () => {
// 更新Tab状态
tabItems.forEach(item => item.classList.remove('active'));
tab.classList.add('active');
// 渲染对应卡片
const tabId = tab.getAttribute('data-tab');
renderCards(tabId);
});
});
}
// 渲染卡片
function renderCards(tabId) {
// 清空容器
cardsContainer.innerHTML = '';
// 获取当前Tab数据
const cards = portalData[tabId] || [];
// 如果没有数据,显示空状态
if (cards.length === 0) {
cardsContainer.innerHTML = `
<div class="empty-state">
<i class="fas fa-inbox"></i>
<h3>暂无应用</h3>
<p>此分类下暂无可用的应用入口</p>
</div>
`;
return;
}
// 渲染卡片
cards.forEach(card => {
const badgeClass = card.network === 'public' ? 'badge-public' : 'badge-internal';
const badgeText = card.network === 'public' ? '公开' : '内网';
const cardElement = document.createElement('div');
cardElement.className = 'card';
cardElement.innerHTML = `
<div class="card-badge ${badgeClass} tooltip" data-tooltip="${card.networkName}">
${badgeText}
</div>
<div class="card-icon">
<i class="fas ${card.icon}"></i>
</div>
<h3 class="card-title">${card.title}</h3>
<p class="card-description">${card.description}</p>
<div class="card-action">
<a href="#" class="card-link">
访问应用 <i class="fas fa-arrow-right"></i>
</a>
<div class="card-stats">
<i class="fas fa-eye"></i> ${card.visits}
</div>
</div>
`;
cardsContainer.appendChild(cardElement);
});
}
// 页面加载完成后初始化
document.addEventListener('DOMContentLoaded', init);
</script>
</body>
</html>