loveyyp1314 5 месяцев назад
Сommit
b92738d081
9 измененных файлов с 512 добавлено и 0 удалено
  1. 48 0
      about.php
  2. 77 0
      contact.php
  3. 177 0
      css/style.css
  4. BIN
      images/carousel-1.jpg
  5. BIN
      images/carousel-2.png
  6. BIN
      images/carousel-3.jpg
  7. 76 0
      index.php
  8. 87 0
      js/script.js
  9. 47 0
      portfolio.php

+ 48 - 0
about.php

@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html lang="zh-CN">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>关于我 - 我的个人博客</title>
+    <link rel="stylesheet" href="css/style.css">
+    <script defer src="js/script.js"></script>
+</head>
+<body>
+    <header>
+        <div class="container">
+            <a href="index.php" class="logo">MyBlog</a>
+            <nav class="main-nav">
+                <ul>
+                    <li><a href="index.php">首页</a></li>
+                    <li><a href="about.php" class="active">关于我</a></li>
+                    <li><a href="portfolio.php">作品集</a></li>
+                    <li><a href="contact.php">联系我</a></li>
+                </ul>
+            </nav>
+            <div class="header-controls">
+                <button id="theme-switcher" class="control-btn">☀️</button>
+                <button class="hamburger control-btn" id="hamburger-menu">
+                    <span></span>
+                    <span></span>
+                    <span></span>
+                </button>
+            </div>
+        </div>
+    </header>
+
+    <main>
+        <div class="container">
+            <h1>关于我</h1>
+            <p>你好,我是一名在校大学生。喜欢专注于前端技术,对创造美观且用户友好的界面充满热情。</p>
+            <p>我的技能包括:HTML, CSS, JavaScript, 以及一些后端知识如PHP和MySQL。我喜欢通过代码将想法变为现实。</p>
+        </div>
+    </main>
+
+    <footer>
+        <div class="container">
+            <p>&copy; <?php echo date('Y'); ?> 我的个人博客. All Rights Reserved.</p>
+            <p>服务器时间: <?php date_default_timezone_set('Asia/Shanghai'); echo date('Y-m-d H:i:s'); ?></p>
+        </div>
+    </footer>
+</body>
+</html>

+ 77 - 0
contact.php

@@ -0,0 +1,77 @@
+<!DOCTYPE html>
+<html lang="zh-CN">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>联系我 - 我的个人博客</title>
+    <link rel="stylesheet" href="css/style.css">
+    <!-- 引入一个图标库,用于显示社交图标 -->
+    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
+    <script defer src="js/script.js"></script>
+</head>
+<body>
+    <header>
+        <div class="container">
+            <a href="index.php" class="logo">MyBlog</a>
+            <nav class="main-nav">
+                <ul>
+                    <li><a href="index.php">首页</a></li>
+                    <li><a href="about.php">关于我</a></li>
+                    <li><a href="portfolio.php">作品集</a></li>
+                    <li><a href="contact.php" class="active">联系我</a></li>
+                </ul>
+            </nav>
+            <div class="header-controls">
+                <button id="theme-switcher" class="control-btn">☀️</button>
+                <button class="hamburger control-btn" id="hamburger-menu">
+                    <span></span>
+                    <span></span>
+                    <span></span>
+                </button>
+            </div>
+        </div>
+    </header>
+
+    <main>
+        <div class="container">
+            <!-- 标题居中 -->
+            <h1 style="text-align: center;">与我联系</h1>
+            
+            <!-- 新的社交链接区域 -->
+            <div class="social-links-container">
+                <!-- 1. QQ -->
+                <a href="https://qm.qq.com/q/jRXYZ123ABC" target="_blank" class="social-link-card">
+                    <i class="fab fa-qq social-icon"></i>
+                    <span class="social-text">QQ</span>
+                </a>
+                
+                <!-- 2. 电话 -->
+                <a href="tel:13800138000" class="social-link-card">
+                    <i class="fas fa-phone social-icon"></i>
+                    <span class="social-text">电话</span>
+                </a>
+                
+                <!-- 3. GitHub -->
+                <a href="https://github.com/your-username" target="_blank" class="social-link-card">
+                    <i class="fab fa-github social-icon"></i>
+                    <span class="social-text">GitHub</span>
+                </a>
+                
+                <!-- 4. 邮箱 -->
+                <a href="mailto:your-email@example.com" class="social-link-card">
+                    <i class="fas fa-envelope social-icon"></i>
+                    <span class="social-text">邮箱</span>
+                </a>
+            </div>
+            
+        </div>
+    </main>
+
+    <footer>
+        <div class="container">
+            <p>&copy; <?php echo date('Y'); ?> 我的个人博客. All Rights Reserved.</p>
+            <p>服务器时间: <?php date_default_timezone_set('Asia/Shanghai'); echo date('Y-m-d H:i:s'); ?></p>
+        </div>
+    </footer>
+</body>
+</html>

+ 177 - 0
css/style.css

@@ -0,0 +1,177 @@
+/* --- 全局与变量定义 (新拟物风格) --- */
+@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap');
+
+:root {
+    /* 色彩方案 - 白天模式 */
+    --primary-color: #5b86e5;
+    --background-color: #e0e5ec;
+    --text-color: #555e67;
+    --text-muted-color: #9ba1a8;
+    
+    /* 字体 */
+    --font-family-sans-serif: 'Inter', sans-serif;
+
+    /* 新拟物阴影 */
+    --neumorph-shadow-light: inset -5px -5px 10px #ffffff, inset 5px 5px 10px #bec3c9;
+    --neumorph-shadow-dark: -5px -5px 10px #ffffff, 5px 5px 10px #bec3c9;
+    --neumorph-shadow-dark-active: inset -3px -3px 7px #ffffff, inset 3px 3px 7px #bec3c9;
+
+    /* 圆角 */
+    --border-radius: 20px;
+}
+
+body.dark-mode {
+    /* 色彩方案 - 黑夜模式 */
+    --primary-color: #6a82fb;
+    --background-color: #2c2f35;
+    --text-color: #e2e2e2;
+    --text-muted-color: #8f9297;
+
+    /* 新拟物阴影 - 黑夜模式 */
+    --neumorph-shadow-light: inset -5px -5px 10px #35393f, inset 5px 5px 10px #232529;
+    --neumorph-shadow-dark: -5px -5px 10px #35393f, 5px 5px 10px #232529;
+    --neumorph-shadow-dark-active: inset -3px -3px 7px #35393f, inset 3px 3px 7px #232529;
+}
+
+* { margin: 0; padding: 0; box-sizing: border-box; }
+
+body {
+    font-family: var(--font-family-sans-serif);
+    background-color: var(--background-color);
+    color: var(--text-color);
+    line-height: 1.6;
+    transition: background-color 0.4s ease, color 0.4s ease;
+    -webkit-font-smoothing: antialiased;
+}
+
+.container { max-width: 980px; margin: 0 auto; padding: 0 20px; }
+
+/* --- 页头与导航 (新拟物风格) --- */
+header {
+    background-color: transparent; /* 背景透明以融入页面 */
+    padding: 1.5rem 0;
+    position: sticky; top: 0; z-index: 1000;
+}
+header .container { display: flex; align-items: center; justify-content: space-between; }
+.logo { font-size: 1.8rem; font-weight: 700; color: var(--text-color); text-decoration: none; flex-shrink: 0; }
+.main-nav { flex-grow: 1; }
+.main-nav ul { list-style: none; display: flex; justify-content: center; }
+.main-nav li { margin: 0 5px; }
+.main-nav a { text-decoration: none; color: var(--text-muted-color); font-weight: 500; padding: 10px 20px; border-radius: 15px; transition: all 0.3s ease; }
+.main-nav a:hover { color: var(--primary-color); }
+.main-nav a.active { color: var(--primary-color); font-weight: 700; box-shadow: var(--neumorph-shadow-dark-active); }
+.header-controls { display: flex; align-items: center; flex-shrink: 0; gap: 15px; }
+
+/* --- 统一控制按钮样式 --- */
+.control-btn {
+    background: var(--background-color);
+    border: none;
+    width: 45px;
+    height: 45px;
+    border-radius: 50%;
+    cursor: pointer;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    box-shadow: var(--neumorph-shadow-dark);
+    transition: box-shadow 0.2s ease, color 0.2s ease;
+    color: var(--text-muted-color);
+}
+.control-btn:hover { color: var(--primary-color); }
+.control-btn:active, .control-btn.active { box-shadow: var(--neumorph-shadow-dark-active); }
+#theme-switcher { font-size: 1.2rem; }
+.hamburger { padding-top: 2px; } /* 微调汉堡图标位置 */
+
+/* --- 轮播图 (新拟物风格) --- */
+.carousel { position: relative; width: 100%; margin: 2rem 0 3rem; border-radius: var(--border-radius); overflow: hidden; box-shadow: var(--neumorph-shadow-dark); }
+.carousel-inner { position: relative; width: 100%; aspect-ratio: 16 / 7; }
+.carousel-item { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; visibility: hidden; transition: opacity 0.7s ease-in-out; }
+.carousel-item.active { opacity: 1; visibility: visible; z-index: 2; }
+.carousel-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
+.carousel-control { position: absolute; top: 50%; transform: translateY(-50%); z-index: 10; opacity: 0.8; }
+.carousel-control.prev { left: 15px; }
+.carousel-control.next { right: 15px; }
+
+/* --- 主体内容 (新拟物风格) --- */
+main { padding: 2rem 0; }
+h1 { font-size: 2.5rem; text-align: center; margin-bottom: 3rem; color: var(--text-color); }
+.article-list { display: grid; gap: 2.5rem; }
+.article-card { background-color: var(--background-color); border-radius: var(--border-radius); padding: 2.5rem; box-shadow: var(--neumorph-shadow-dark); transition: box-shadow 0.3s ease; }
+.article-card:hover { box-shadow: var(--neumorph-shadow-dark-active); }
+.article-card h2 { font-size: 1.5rem; margin-bottom: 0.75rem; color: var(--text-color); }
+.article-card .meta { font-size: 0.9rem; color: var(--text-muted-color); margin-bottom: 1rem; }
+.article-card p { margin-bottom: 1.5rem; }
+
+/* --- 按钮与表单 (新拟物风格) --- */
+.btn { display: inline-block; background-color: var(--primary-color); color: #fff; padding: 14px 28px; border-radius: 15px; text-decoration: none; font-weight: 500; border: none; cursor: pointer; transition: all 0.2s ease; box-shadow: -3px -3px 7px rgba(255,255,255,0.1), 3px 3px 7px rgba(0,0,0,0.2); }
+.btn:hover { filter: brightness(1.1); }
+.btn:active { transform: scale(0.98); box-shadow: inset -3px -3px 7px rgba(255,255,255,0.1), inset 3px 3px 7px rgba(0,0,0,0.2); }
+
+/* --- 联系我页面 - 社交链接样式 --- */
+.social-links-container {
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    flex-wrap: wrap; /* 在小屏幕上自动换行 */
+    gap: 2.5rem; /* 链接之间的间距 */
+    margin-top: 4rem; /* 与标题的间距 */
+    text-align: center;
+}
+
+.social-link-card {
+    display: flex;
+    flex-direction: column; /* 图标和文字垂直排列 */
+    align-items: center;
+    justify-content: center;
+    width: 150px;
+    height: 150px;
+    text-decoration: none;
+    background-color: var(--background-color);
+    border-radius: var(--border-radius);
+    box-shadow: var(--neumorph-shadow-dark);
+    transition: all 0.3s ease;
+    color: var(--text-color); /* 统一卡片文字颜色 */
+}
+
+.social-link-card:hover {
+    transform: translateY(-10px); /* 悬停时向上浮动 */
+    box-shadow: var(--neumorph-shadow-dark-active);
+    color: var(--primary-color);
+}
+
+.social-icon {
+    font-size: 3rem; /* 图标大小 */
+    margin-bottom: 1rem; /* 图标和文字的间距 */
+    color: var(--primary-color);
+    transition: color 0.3s ease;
+}
+
+.social-link-card:hover .social-icon {
+    color: inherit; /* 继承父元素 a 的颜色 */
+}
+
+.social-text {
+    font-size: 1rem;
+    font-weight: 500;
+    transition: color 0.3s ease;
+    color: inherit; /* 继承父元素 a 的颜色 */
+}
+
+
+/* --- 页脚 --- */
+footer { text-align: center; padding: 3rem 0; margin-top: 3rem; color: var(--text-muted-color); font-size: 0.9rem; }
+footer p { margin: 0.5rem 0; }
+
+/* --- 响应式设计 --- */
+.hamburger span { display: block; width: 22px; height: 2px; background-color: var(--text-muted-color); margin: 5px 0; transition: all 0.3s ease-in-out; border-radius: 2px; }
+@media (max-width: 768px) {
+    .main-nav { display: none; position: fixed; top: 0; left: -100%; width: 280px; height: 100%; background-color: var(--background-color); transition: left 0.4s ease; z-index: 1000; box-shadow: 10px 0 20px -5px rgba(0,0,0,0.1); }
+    .main-nav.active { left: 0; }
+    .main-nav ul { flex-direction: column; align-items: flex-start; padding: 80px 30px; }
+    .main-nav li { margin: 15px 0; width: 100%; }
+    .main-nav a { font-size: 1.2rem; }
+    .hamburger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
+    .hamburger.active span:nth-child(2) { opacity: 0; }
+    .hamburger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
+    .header-controls { position: relative; z-index: 1001; }
+}

BIN
images/carousel-1.jpg


BIN
images/carousel-2.png


BIN
images/carousel-3.jpg


+ 76 - 0
index.php

@@ -0,0 +1,76 @@
+<!DOCTYPE html>
+<html lang="zh-CN">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>我的个人博客</title>
+    <link rel="stylesheet" href="css/style.css">
+    <script defer src="js/script.js"></script>
+</head>
+<body>
+    <header>
+        <div class="container">
+            <a href="index.php" class="logo">MyBlog</a>
+            <nav class="main-nav">
+                <ul>
+                    <li><a href="index.php" class="active">首页</a></li>
+                    <li><a href="about.php">关于我</a></li>
+                    <li><a href="portfolio.php">作品集</a></li>
+                    <li><a href="contact.php">联系我</a></li>
+                </ul>
+            </nav>
+            <div class="header-controls">
+                <button id="theme-switcher" class="control-btn">☀️</button>
+                <button class="hamburger control-btn" id="hamburger-menu">
+                    <span></span>
+                    <span></span>
+                    <span></span>
+                </button>
+            </div>
+        </div>
+    </header>
+
+    <main>
+        <div class="container">
+            <div class="carousel">
+                <div class="carousel-inner">
+                    <div class="carousel-item active">
+                        <img src="images/carousel-1.jpg" alt="轮播图一">
+                    </div>
+                    <div class="carousel-item">
+                        <img src="images/carousel-2.png" alt="轮播图二">
+                    </div>
+                    <div class="carousel-item">
+                        <img src="images/carousel-3.jpg" alt="轮播图三">
+                    </div>
+                </div>
+                <button class="carousel-control prev control-btn">&lt;</button>
+                <button class="carousel-control next control-btn">&gt;</button>
+            </div>
+            
+            <h1>最新文章</h1>
+            <div class="article-list">
+                <article class="article-card">
+                    <h2>网站设计入门指南</h2>
+                    <p class="meta">发布于 2023-10-27</p>
+                    <p>这是关于如何开始学习网站设计的第一篇文章,涵盖了HTML, CSS和JavaScript的基础知识...</p>
+                    <a href="#" class="btn">阅读全文</a>
+                </article>
+                <article class="article-card">
+                    <h2>CSS Flexbox 布局详解</h2>
+                    <p class="meta">发布于 2023-10-25</p>
+                    <p>Flexbox是现代CSS布局的核心。本文将通过实例详细讲解其主要属性和应用场景...</p>
+                    <a href="#" class="btn">阅读全文</a>
+                </article>
+            </div>
+        </div>
+    </main>
+
+    <footer>
+        <div class="container">
+            <p>&copy; <?php echo date('Y'); ?> 我的个人博客. All Rights Reserved.</p>
+            <p>服务器时间: <?php date_default_timezone_set('Asia/Shanghai'); echo date('Y-m-d H:i:s'); ?></p>
+        </div>
+    </footer>
+</body>
+</html>

+ 87 - 0
js/script.js

@@ -0,0 +1,87 @@
+document.addEventListener('DOMContentLoaded', () => {
+
+    // --- 交互功能1: 响应式汉堡菜单 ---
+    const hamburgerMenu = document.getElementById('hamburger-menu');
+    const mainNav = document.querySelector('.main-nav');
+
+    if (hamburgerMenu && mainNav) {
+        hamburgerMenu.addEventListener('click', () => {
+            mainNav.classList.toggle('active');
+        });
+    }
+
+    // --- 交互功能2 (进阶): 白天/黑夜模式切换 ---
+    const themeSwitcher = document.getElementById('theme-switcher');
+    const body = document.body;
+    const currentTheme = localStorage.getItem('theme');
+
+    if (currentTheme === 'dark') {
+        body.classList.add('dark-mode');
+        if (themeSwitcher) themeSwitcher.textContent = '🌙';
+    } else {
+        if (themeSwitcher) themeSwitcher.textContent = '☀️';
+    }
+
+    if (themeSwitcher) {
+        themeSwitcher.addEventListener('click', () => {
+            body.classList.toggle('dark-mode');
+            if (body.classList.contains('dark-mode')) {
+                localStorage.setItem('theme', 'dark');
+                themeSwitcher.textContent = '🌙';
+            } else {
+                localStorage.setItem('theme', 'light');
+                themeSwitcher.textContent = '☀️';
+            }
+        });
+    }
+
+    // --- 交互功能3 (进阶): 联系表单异步提交 (配合PHP) ---
+    const contactForm = document.getElementById('contact-form');
+    if (contactForm) {
+        contactForm.addEventListener('submit', function(event) {
+            event.preventDefault(); 
+            let statusDiv = this.querySelector('.form-status');
+            if (!statusDiv) {
+                statusDiv = document.createElement('div');
+                statusDiv.className = 'form-status';
+                this.appendChild(statusDiv);
+            }
+            const formData = new FormData(this);
+            fetch('handle_contact.php', { method: 'POST', body: formData })
+                .then(response => response.text().then(text => ({ ok: response.ok, text })))
+                .then(({ ok, text }) => {
+                    statusDiv.textContent = text;
+                    statusDiv.style.color = ok ? 'green' : 'red';
+                    if (ok) contactForm.reset();
+                })
+                .catch(error => {
+                    statusDiv.textContent = '提交失败,请检查网络连接。';
+                    statusDiv.style.color = 'red';
+                });
+        });
+    }
+
+    // --- 交互功能4 (进阶): 自动播放轮播图 ---
+    const carousel = document.querySelector('.carousel');
+    if (carousel) {
+        const items = carousel.querySelectorAll('.carousel-item');
+        const prevBtn = carousel.querySelector('.carousel-control.prev');
+        const nextBtn = carousel.querySelector('.carousel-control.next');
+        let currentIndex = 0;
+        let intervalId = null;
+
+        if (items.length > 1) {
+            const showItem = (index) => items.forEach((item, i) => item.classList.toggle('active', i === index));
+            const nextItem = () => { currentIndex = (currentIndex + 1) % items.length; showItem(currentIndex); };
+            const prevItem = () => { currentIndex = (currentIndex - 1 + items.length) % items.length; showItem(currentIndex); };
+            const startCarousel = () => { stopCarousel(); intervalId = setInterval(nextItem, 3000); };
+            const stopCarousel = () => clearInterval(intervalId);
+            if (nextBtn) nextBtn.addEventListener('click', () => { nextItem(); startCarousel(); });
+            if (prevBtn) prevBtn.addEventListener('click', () => { prevItem(); startCarousel(); });
+            carousel.addEventListener('mouseenter', stopCarousel);
+            carousel.addEventListener('mouseleave', startCarousel);
+            showItem(currentIndex);
+            startCarousel();
+        }
+    }
+});

+ 47 - 0
portfolio.php

@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<html lang="zh-CN">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>作品集 - 我的个人博客</title>
+    <link rel="stylesheet" href="css/style.css">
+    <script defer src="js/script.js"></script>
+</head>
+<body>
+    <header>
+        <div class="container">
+            <a href="index.php" class="logo">MyBlog</a>
+            <nav class="main-nav">
+                <ul>
+                    <li><a href="index.php">首页</a></li>
+                    <li><a href="about.php">关于我</a></li>
+                    <li><a href="portfolio.php" class="active">作品集</a></li>
+                    <li><a href="contact.php">联系我</a></li>
+                </ul>
+            </nav>
+            <div class="header-controls">
+                <button id="theme-switcher" class="control-btn">☀️</button>
+                <button class="hamburger control-btn" id="hamburger-menu">
+                    <span></span>
+                    <span></span>
+                    <span></span>
+                </button>
+            </div>
+        </div>
+    </header>
+
+    <main>
+        <div class="container">
+            <h1>我的作品集</h1>
+            <p>这里将展示我完成过的项目。目前正在整理中,敬请期待!</p>
+        </div>
+    </main>
+
+    <footer>
+        <div class="container">
+            <p>&copy; <?php echo date('Y'); ?> 我的个人博客. All Rights Reserved.</p>
+            <p>服务器时间: <?php date_default_timezone_set('Asia/Shanghai'); echo date('Y-m-d H:i:s'); ?></p>
+        </div>
+    </footer>
+</body>
+</html>