first commit

This commit is contained in:
toom1996
2025-06-19 14:25:18 +08:00
commit 022e7a68c3
68 changed files with 10858 additions and 0 deletions

356
src/layouts/Layout.astro Normal file
View File

@ -0,0 +1,356 @@
---
import Footer from '../components/Footer.astro'
import { APP_NAME } from '../config/app';
import '../styles/global.css'
import '../styles/theme.css'
const {description, title, keywords} = Astro.props;
---
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<link rel="icon" type="image/svg+xml" href="/logo.png" />
<title>{title}</title>
<meta name="description" content={description} />
<meta name="keywords" content={keywords} />
<!-- <link href="https://fonts.googleapis.com/css2?family=Graphik:wght@400;500;600;700&display=swap" rel="stylesheet"> -->
</head>
<body>
<header>
<div class="logo-container">
<a href="/"><img src="/logo.png" alt={APP_NAME} class="logo-image" /></a>
<div class="logo-text"><a href="/">{APP_NAME}</a></div>
</div>
<button class="mobile-menu-btn" aria-label="打开菜单">
<span></span>
<span></span>
<span></span>
</button>
<nav class="desktop-nav">
<ul>
<li><a title="首页" href="/">首页</a></li>
<!-- <li><a title="新闻专栏" href="/product">产品介绍</a></li> -->
<li><a title="新闻专栏" href="/news">新闻专栏</a></li>
<li><a title="常见问题" href="/faq">常见问题</a></li>
<li><a title="联系我们" href="/contact">联系我们</a></li>
</ul>
</nav>
<nav class="mobile-nav">
<ul>
<li><a title="首页" href="/">首页</a></li>
<!-- <li><a title="新闻专栏" href="/product">产品介绍</a></li> -->
<li><a title="新闻专栏" href="/news">新闻专栏</a></li>
<li><a title="常见问题" href="/faq">常见问题</a></li>
<li><a title="联系我们" href="/contact">联系我们</a></li>
</ul>
</nav>
</header>
<main>
<slot />
</main>
<Footer />
</body>
</html>
<div class="background-animation"></div>
<style>
:root {
--primary-color: #4F46E5;
--primary-light: #818CF8;
--primary-dark: #3730A3;
--accent-color: #10B981;
--accent-light: #34D399;
--accent-dark: #059669;
--background-light: #FFFFFF;
--background-off-white: #F8FAFC;
--background-gray: #F1F5F9;
--text-primary: #000000;
--text-secondary: #64748B;
--gradient-start: #FFFFFF;
--gradient-end: #F8FAFC;
}
html,
body {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
font-family: 'Graphik', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
background-attachment: fixed;
background-size: cover;
color: var(--text-primary);
position: relative;
overflow-x: hidden;
}
.background-animation {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -2;
overflow: hidden;
}
.background-animation::before {
content: "";
position: absolute;
top: -50%;
left: -50%;
width: 200%;
height: 200%;
background:
radial-gradient(circle at 20% 30%, rgba(79, 70, 229, 0.03), transparent 50%),
radial-gradient(circle at 80% 70%, rgba(16, 185, 129, 0.03), transparent 50%),
radial-gradient(circle at 50% 50%, rgba(129, 140, 248, 0.03), transparent 50%);
animation: rotate 60s linear infinite;
z-index: -1;
}
header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1rem 2rem;
background: rgba(255, 255, 255, 0.9);
backdrop-filter: blur(10px);
position: sticky;
top: 0;
z-index: 100;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}
.logo-container {
display: flex;
align-items: center;
gap: 0.75rem;
z-index: 101;
}
.logo-image {
width: 40px;
height: 40px;
object-fit: contain;
transition: transform 0.3s ease;
}
.logo-container:hover .logo-image {
transform: scale(1.1);
}
.logo-text {
font-size: 1.5rem;
font-weight: 700;
background: black;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
.mobile-menu-btn {
display: none;
flex-direction: column;
justify-content: space-between;
width: 30px;
height: 21px;
background: transparent;
border: none;
cursor: pointer;
padding: 0;
z-index: 101;
}
.mobile-menu-btn span {
width: 100%;
height: 3px;
background-color: var(--text-primary);
border-radius: 3px;
transition: all 0.3s ease;
}
.desktop-nav {
display: flex;
}
.mobile-nav {
display: none;
}
nav ul {
display: flex;
list-style: none;
gap: 2.5rem;
margin: 0;
padding: 0;
}
nav a {
color: black;
text-decoration: none;
font-weight: 500;
transition: all 0.3s ease;
position: relative;
padding: 0.5rem 0;
}
nav a::after {
content: '';
position: absolute;
bottom: 0;
left: 0;
width: 0;
height: 2px;
/* background: linear-gradient(90deg, var(--primary-color), var(--accent-color)); */
background: black;
transition: width 0.3s ease;
}
nav a:hover {
color: var(--text-primary);
}
nav a:hover::after {
width: 100%;
}
button {
padding: 0.75rem 1.5rem;
border-radius: 8px;
font-weight: 600;
cursor: pointer;
transition: all 0.3s ease;
}
main {
flex: 1;
padding: 2rem;
max-width: 1200px;
margin: 0 auto;
width: 100%;
box-sizing: border-box;
/* background: var(--background-light); */
}
@keyframes rotate {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
@media (max-width: 768px) {
header {
padding: 1rem;
}
.mobile-menu-btn {
display: flex;
}
.desktop-nav {
display: none;
}
.mobile-nav {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100vh;
background: rgba(255, 255, 255, 0.98);
padding: 6rem 2rem 2rem;
box-sizing: border-box;
z-index: 100;
}
.mobile-nav.active {
display: block;
}
.mobile-nav ul {
flex-direction: column;
gap: 1.5rem;
align-items: center;
}
.mobile-nav a {
font-size: 1.2rem;
color: var(--text-primary);
}
.mobile-menu-btn.active span:nth-child(1) {
transform: translateY(9px) rotate(45deg);
}
.mobile-menu-btn.active span:nth-child(2) {
opacity: 0;
}
.mobile-menu-btn.active span:nth-child(3) {
transform: translateY(-9px) rotate(-45deg);
}
}
@media (max-width: 480px) {
.logo-text {
font-size: 1.2rem;
}
.logo-image {
width: 32px;
height: 32px;
}
.mobile-nav {
padding: 5rem 1.5rem 1.5rem;
}
.mobile-nav a {
font-size: 1.1rem;
}
}
</style>
<script>
// 移动端菜单交互
const menuBtn = document.querySelector('.mobile-menu-btn');
const mobileNav = document.querySelector('.mobile-nav');
const body = document.body;
menuBtn?.addEventListener('click', () => {
menuBtn.classList.toggle('active');
mobileNav?.classList.toggle('active');
body.style.overflow = body.style.overflow === 'hidden' ? '' : 'hidden';
});
// 点击导航链接时关闭菜单
const mobileNavLinks = document.querySelectorAll('.mobile-nav a');
mobileNavLinks.forEach(link => {
link.addEventListener('click', () => {
menuBtn?.classList.remove('active');
mobileNav?.classList.remove('active');
body.style.overflow = '';
});
});
// 点击页面其他区域关闭菜单
document.addEventListener('click', (e) => {
if (mobileNav?.classList.contains('active') &&
!e.target.closest('.mobile-nav') &&
!e.target.closest('.mobile-menu-btn')) {
menuBtn?.classList.remove('active');
mobileNav?.classList.remove('active');
body.style.overflow = '';
}
});
</script>