「华为商城页面」
链接:https://pan.quark.cn/s/8eb586e94c40链接:https://pan.quark.cn/s/8eb586e94c40
链接:https://pan.quark.cn/s/8eb586e94c40
<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>华为商城 - 首页</title> <style> /* 基础重置和全局样式 (建议移至外部CSS文件) */ body, h1, h2, h3, p, ul, li, figure, figcaption { margin: 0; padding: 0; font-family: 'Helvetica Neue', Helvetica, Arial, 'Microsoft Yahei', 'Hiragino Sans GB', 'Heiti SC', 'WenQuanYi Micro Hei', sans-serif; box-sizing: border-box; } body { background-color: #f8f8f8; /* 浅灰色背景 */ color: #333; line-height: 1.6; } a { text-decoration: none; color: inherit; } img { max-width: 100%; height: auto; display: block; } .container { width: 90%; max-width: 1200px; margin: 0 auto; padding: 20px 0; } /* 头部样式 */ .header { background-color: #fff; /* 白色背景 */ padding: 15px 0; box-shadow: 0 2px 5px rgba(0,0,0,0.1); position: sticky; top: 0; z-index: 1000; } .header-content { display: flex; justify-content: space-between; align-items: center; width: 90%; max-width: 1200px; margin: 0 auto; } .logo { font-size: 1.8em; font-weight: bold; color: #cf0a2c; /* 华为红 */ } .logo .light-text { font-weight: normal; color: #555; } .nav ul { list-style: none; display: flex; } .nav ul li { margin-left: 25px; } .nav ul li a { font-size: 1em; color: #333; padding: 5px 10px; border-radius: 4px; transition: background-color 0.3s ease, color 0.3s ease; } .nav ul li a:hover, .nav ul li a.active { background-color: #cf0a2c; color: #fff; } .header-actions a { margin-left: 15px; font-size: 1.2em; color: #555; } .header-actions a:hover { color: #cf0a2c; } /* 轮播图区域 */ .hero-carousel { position: relative; width: 100%; height: 500px; /* 根据实际图片调整 */ overflow: hidden; background-color: #e0e0e0; /* 占位背景 */ } .carousel-slide { position: absolute; width: 100%; height: 100%; opacity: 0; transition: opacity 1s ease-in-out; /* GSAP会控制这个 */ background-size: cover; background-position: center; display: flex; align-items: center; justify-content: center; text-align: center; flex-direction: column; } .carousel-slide.active { opacity: 1; } .slide-content { background-color: rgba(0,0,0,0.4); color: #fff; padding: 30px 50px; border-radius: 8px; max-width: 600px; } .slide-content h2 { font-size: 2.8em; margin-bottom: 15px; font-weight: bold; letter-spacing: 1px; } .slide-content p { font-size: 1.2em; margin-bottom: 25px; } .cta-button { background-color: #cf0a2c; color: #fff; padding: 12px 25px; font-size: 1.1em; border-radius: 5px; border: none; cursor: pointer; transition: background-color 0.3s ease, transform 0.3s ease; text-transform: uppercase; } .cta-button:hover { background-color: #a90823; transform: translateY(-2px); } .carousel-indicators { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; } .indicator { width: 12px; height: 12px; border-radius: 50%; background-color: rgba(255,255,255,0.5); margin: 0 5px; cursor: pointer; transition: background-color 0.3s ease; } .indicator.active { background-color: #cf0a2c; } /* 内容区域通用标题 */ .section-title { text-align: center; font-size: 2.2em; color: #333; margin-bottom: 40px; padding-top: 50px; font-weight: 600; position: relative; } .section-title::after { content: ''; display: block; width: 60px; height: 4px; background-color: #cf0a2c; margin: 10px auto 0; border-radius: 2px; } /* 产品网格 */ .product-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 30px; } .product-card { background-color: #fff; border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.08); overflow: hidden; transition: transform 0.3s ease, box-shadow 0.3s ease; display: flex; flex-direction: column; } .product-card:hover { transform: translateY(-10px); box-shadow: 0 8px 25px rgba(0,0,0,0.12); } .product-image-container { width: 100%; padding-top: 75%; /* 4:3 Aspect Ratio */ position: relative; background-color: #f0f0f0; } .product-image-container img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: contain; /* 'cover' or 'contain' based on preference */ padding: 10px; /* Optional padding around image */ } .product-info { padding: 20px; text-align: center; flex-grow: 1; display: flex; flex-direction: column; justify-content: space-between; } .product-info h3 { font-size: 1.3em; color: #2c3e50; margin-bottom: 10px; } .product-price { font-size: 1.2em; color: #cf0a2c; font-weight: bold; margin-bottom: 15px; } .product-description { font-size: 0.9em; color: #7f8c8d; margin-bottom: 20px; flex-grow: 1; } /* 特色专区 */ .featured-section { background-color: #ffffff; /* 与产品卡片区分或保持一致 */ padding: 40px 0; margin-top: 30px; } .featured-section .container { padding-top: 0; } .dual-banner-container { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 30px; } .banner-item { position: relative; border-radius: 8px; overflow: hidden; box-shadow: 0 4px 15px rgba(0,0,0,0.08); min-height: 300px; /* Adjust as needed */ } .banner-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; } .banner-item:hover img { transform: scale(1.05); } .banner-content { position: absolute; bottom: 20px; left: 20px; color: #fff; background-color: rgba(0,0,0,0.5); padding: 15px; border-radius: 5px; } .banner-content h3 { font-size: 1.6em; margin-bottom: 5px; } .banner-content p { font-size: 1em; } /* 服务与支持 */ .support-section { background-color: #e9ecef; /* 不同背景色区分 */ padding: 50px 0; } .support-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 30px; text-align: center; } .support-item { background-color: #fff; padding: 30px 20px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.07); transition: transform 0.3s ease; } .support-item:hover { transform: translateY(-5px); } .support-item i { /* 假设使用 Font Awesome 或类似图标库 */ font-size: 2.5em; color: #cf0a2c; margin-bottom: 15px; } .support-item h4 { font-size: 1.2em; color: #333; margin-bottom: 10px; } .support-item p { font-size: 0.9em; color: #666; } /* 页脚 */ .footer { background-color: #2c3e50; /* 深色页脚 */ color: #ecf0f1; padding: 40px 0; text-align: center; } .footer-content { width: 90%; max-width: 1200px; margin: 0 auto; } .footer-links { margin-bottom: 20px; } .footer-links a { color: #bdc3c7; margin: 0 15px; font-size: 0.9em; transition: color 0.3s ease; } .footer-links a:hover { color: #fff; } .footer-social { margin-bottom: 20px; } .footer-social a { color: #bdc3c7; margin: 0 10px; font-size: 1.5em; /* 社交图标可以大一些 */ transition: color 0.3s ease; } .footer-social a:hover { color: #cf0a2c; } .footer-copyright { font-size: 0.85em; color: #95a5a6; } /* 响应式调整示例 */ @media (max-width: 768px) { .header-content { flex-direction: column; } .nav ul { margin-top: 15px; flex-wrap: wrap; justify-content: center; } .nav ul li { margin: 5px 10px; } .hero-carousel { height: 400px; /* 移动端减小高度 */ } .slide-content h2 { font-size: 2em; } .slide-content p { font-size: 1em; } .product-grid { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); /* 在更小屏幕上可能需要单列 */ } .dual-banner-container { grid-template-columns: 1fr; /* 单列显示 */ } .footer-links a { display: block; margin: 8px 0; } } @media (max-width: 480px) { .product-grid { grid-template-columns: 1fr; /* 极小屏幕单列 */ } .slide-content { padding: 20px; } .slide-content h2 { font-size: 1.6em; } .slide-content p { font-size: 0.9em; } .cta-button { padding: 10px 20px; font-size: 1em; } .section-title { font-size: 1.8em; } } </style> </head> <body> <header class="header" id="main-header"> <div class="header-content"> <a href="#" class="logo">华为<span class="light-text">商城</span></a> <nav class="nav"> <ul> <li><a href="index.html" class="active" data-section="home">首页</a></li> <li><a href="products.html" data-section="phones">最新手机</a></li> <li><a href="laptops.html" data-section="laptops">笔记本平板</a></li> <li><a href="wearables.html" data-section="wearables">智能穿戴</a></li> <li><a href="accessories.html" data-section="accessories">智慧配件</a></li> <li><a href="support.html" data-section="support">服务支持</a></li> </ul> </nav> <div class="header-actions"> <a href="#" aria-label="搜索"><i class="fas fa-search"></i></a> <a href="#" aria-label="用户中心"><i class="fas fa-user"></i></a> <a href="#" aria-label="购物车"><i class="fas fa-shopping-cart"></i></a> </div> </div> </header> <section class="hero-carousel" id="hero-carousel"> <div class="carousel-slide active" style="background-image: url('img/111.webp');"> <div class="slide-content" data-animation="fadeInUp"> <h2>华为 Pura 70 系列</h2> <p>美,自成一格。先锋影像,强劲性能。</p> <button class="cta-button">探索Pura系列</button> </div> </div> <div class="carousel-slide" style="background-image: url('img/222.webp');"> <div class="slide-content" data-animation="fadeInRight"> <h2>全新 MateBook X Pro</h2> <p>智慧办公新体验,轻薄便携,高效创作。</p> <button class="cta-button">了解更多</button> </div> </div> <div class="carousel-slide" style="background-image: url('img/333.webp');"> <div class="slide-content" data-animation="fadeInLeft"> <h2>华为 FreeBuds Pro 3</h2> <p>静谧聆听,纯净音质,智慧降噪新高度。</p> <button class="cta-button">立即选购</button> </div> </div> <div class="carousel-indicators"> <span class="indicator active" data-slide-to="0"></span> <span class="indicator" data-slide-to="1"></span> <span class="indicator" data-slide-to="2"></span> </div> </section> <section class="featured-products"> <div class="container"> <h2 class="section-title" data-animation="slideInUp">新品上市</h2> <div class="product-grid"> <div class="product-card" data-animation="zoomIn"> <div class="product-image-container"> <img src="img/111.webp" alt="华为 Pura 70 Ultra"> </div> <div class="product-info"> <h3>华为 Pura 70 Ultra</h3> <p class="product-price">¥9999 起</p> <p class="product-description">伸缩摄像头,超聚光影像,XMAGE加持。</p> <button class="cta-button small">查看详情</button> </div> </div> <div class="product-card" data-animation="zoomIn" data-delay="0.1s"> <div class="product-image-container"> <img src="img/222.webp" alt="华为 MatePad Pro 13.2"> </div> <div class="product-info"> <h3>华为 MatePad Pro 13.2</h3> <p class="product-price">¥5199 起</p> <p class="product-description">柔性OLED大屏,星闪连接,专业办公体验。</p> <button class="cta-button small">查看详情</button> </div> </div> <div class="product-card" data-animation="zoomIn" data-delay="0.2s"> <div class="iproduct-image-container"> <img src="img/333.webp" alt="华为 WATCH GT 4"> </div> <div class="product-info"> <h3>华为 WATCH GT 4</h3> <p class="product-price">¥1588 起</p> <p class="product-description">科学运动指导,专业健康管理,时尚设计。</p> <button class="cta-button small">查看详情</button> </div> </div> <div class="product-card" data-animation="zoomIn" data-delay="0.3s"> <div class="product-image-container"> <img src="img/444.jpg" alt="华为 FreeClip 耳夹耳机"> </div> <div class="product-info"> <h3>华为 FreeClip 耳夹耳机</h3> <p class="product-price">¥1299</p> <p class="product-description">开放式聆听,舒适稳固,时尚百搭新选择。</p> <button class="cta-button small">查看详情</button> </div> </div> </div> </div> </section> <section class="featured-section" id="special-offers"> <div class="container"> <h2 class="section-title" data-animation="slideInUp">精选活动</h2> <div class="dual-banner-container"> <div class="banner-item" data-animation="fadeInLeft"> <img src="img/999.webp" alt="智慧办公专区"> <div class="banner-content"> <h3>智慧办公升级</h3> <p>MateBook系列限时优惠,提升您的生产力。</p> <button class="cta-button small">前往选购</button> </div> </div> <div class="banner-item" data-animation="fadeInRight"> <img src="img/888.webp" alt="运动健康伙伴"> <div class="banner-content"> <h3>运动健康伙伴</h3> <p>WATCH & Band系列,记录您的活力每一刻。</p> <button class="cta-button small">探索穿戴</button> </div> </div> </div> </div> </section> <section class="support-section" id="services"> <div class="container"> <h2 class="section-title" data-animation="slideInUp">服务与支持</h2> <div class="support-grid"> <div class="support-item" data-animation="pulse"> <i class="fas fa-tools"></i> <h4>维修服务</h4> <p>官方授权,专业维修,保障您的设备。</p> </div> <div class="support-item" data-animation="pulse" data-delay="0.1s"> <i class="fas fa-headset"></i> <h4>在线客服</h4> <p>7x24小时在线,随时解答您的疑问。</p> </div> <div class="support-item" data-animation="pulse" data-delay="0.2s"> <i class="fas fa-store"></i> <h4>查找门店</h4> <p>查找离您最近的华为授权体验店。</p> </div> <div class="support-item" data-animation="pulse" data-delay="0.3s"> <i class="fas fa-sync-alt"></i> <h4>软件升级</h4> <p>获取最新的HarmonyOS更新与应用支持。</p> </div> </div> </div> </section> <footer class="footer" id="page-footer"> <div class="footer-content"> <div class="footer-links"> <a href="#">关于我们</a> | <a href="#">隐私政策</a> | <a href="#">服务条款</a> | <a href="#">联系我们</a> | <a href="#">网站地图</a> </div> <div class="footer-social"> <a href="#" aria-label="微博"><i class="fab fa-weibo"></i></a> <a href="#" aria-label="微信"><i class="fab fa-weixin"></i></a> <a href="#" aria-label="抖音"><i class="fab fa-tiktok"></i></a> </div> <p class="footer-copyright">© <span id="current-year">2024</span> 华为终端有限公司 版权所有 | <a href="#">粤A2-20044005号</a></p> <p class="footer-tip">温馨提示:请确认您正在访问的是华为官方商城,谨防假冒。</p> </div> </footer> <script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/gsap.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/ScrollTrigger.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/js/all.min.js"></script> <script> // JavaScript (建议移至外部JS文件) // 动态设置年份 document.getElementById('current-year').textContent = new Date().getFullYear(); // 简易轮播图逻辑 (GSAP可以做得更炫酷) const slides = document.querySelectorAll('.carousel-slide'); const indicators = document.querySelectorAll('.indicator'); let currentSlide = 0; const slideInterval = 5000; // 5秒切换 function showSlide(index) { slides.forEach((slide, i) => { slide.classList.remove('active'); indicators[i].classList.remove('active'); // GSAP 动画可以放在这里 // gsap.to(slide, { autoAlpha: 0, duration: 0.5 }); }); slides[index].classList.add('active'); indicators[index].classList.add('active'); // gsap.to(slides[index], { autoAlpha: 1, duration: 1, delay: 0.2 }); // 示例:为当前激活的slide内容添加动画 const activeSlideContent = slides[index].querySelector('.slide-content'); if (activeSlideContent) { const animatedElements = activeSlideContent.querySelectorAll('h2, p, .cta-button'); gsap.fromTo(animatedElements, { opacity: 0, y: 30 }, { opacity: 1, y: 0, duration: 0.6, stagger: 0.2, delay: 0.3, ease: "power2.out" } ); } } function nextSlide() { currentSlide = (currentSlide + 1) % slides.length; showSlide(currentSlide); } indicators.forEach(indicator => { indicator.addEventListener('click', () => { currentSlide = parseInt(indicator.dataset.slideTo); showSlide(currentSlide); }); }); // 自动播放 // let autoPlayInterval = setInterval(nextSlide, slideInterval); // 鼠标悬停时停止自动播放 (可选) // const carousel = document.getElementById('hero-carousel'); // carousel.addEventListener('mouseenter', () => clearInterval(autoPlayInterval)); // carousel.addEventListener('mouseleave', () => autoPlayInterval = setInterval(nextSlide, slideInterval)); // 页面加载时显示第一张 showSlide(0); // GSAP 滚动触发动画示例 gsap.registerPlugin(ScrollTrigger); // 统一处理带 data-animation 属性的元素 document.querySelectorAll('[data-animation]').forEach(el => { const animationType = el.dataset.animation; const delay = parseFloat(el.dataset.delay) || 0; // 获取延迟时间 let animationProps = { opacity: 0 }; // 默认从不可见开始 if (animationType === 'fadeInUp') { animationProps.y = 50; } else if (animationType === 'fadeInRight') { animationProps.x = -50; } else if (animationType === 'fadeInLeft') { animationProps.x = 50; } else if (animationType === 'zoomIn') { animationProps.scale = 0.8; } else if (animationType === 'slideInUp') { // Section titles animationProps.y = 70; } gsap.from(el, { ...animationProps, scrollTrigger: { trigger: el, start: "top 85%", // 元素顶部接触到视口85%时触发 end: "bottom 20%", toggleActions: "play none none none", // 进入视口播放,离开不反向 // markers: true, // 调试用 }, duration: 0.8, delay: delay, // 应用延迟 ease: "power2.out", autoAlpha: 1, // GSAP的特殊属性,处理opacity和visibility y: 0, // 动画结束时y回到0 x: 0, // 动画结束时x回到0 scale: 1 // 动画结束时scale回到1 }); }); // 特殊动画,如 pulse (可结合CSS或GSAP timeline) gsap.utils.toArray('[data-animation="pulse"]').forEach(el => { const delay = parseFloat(el.dataset.delay) || 0; gsap.from(el, { // Initial state (optional, can be set in CSS) opacity:0, y:30, delay: delay, scrollTrigger: { trigger: el, start: "top 90%", toggleActions: "play none none none", }, }); // Pulse 效果更适合用 CSS keyframes 或 GSAP timeline hover 效果 // el.addEventListener('mouseenter', () => gsap.to(el, {scale: 1.05, duration: 0.3})); // el.addEventListener('mouseleave', () => gsap.to(el, {scale: 1, duration: 0.3})); }); // 简单的轮播图自动播放 (使用GSAP Timeline可以更精确控制) if (slides.length > 1) { let masterTimeline = gsap.timeline({repeat: -1}); // 无限重复 slides.forEach((slide, index) => { const slideContentH2 = slide.querySelector('.slide-content h2'); const slideContentP = slide.querySelector('.slide-content p'); const slideContentBtn = slide.querySelector('.slide-content .cta-button'); masterTimeline.to(slide, { opacity: 1, duration: 1, onStart: () => { // 更新指示器 indicators.forEach(ind => ind.classList.remove('active')); indicators[index].classList.add('active'); currentSlide = index; } }, `slide${index}`) // 标签,用于同步 .from([slideContentH2, slideContentP, slideContentBtn], { autoAlpha:0, y:30, stagger:0.2, duration: 0.6 }, `slide${index}+=0.3`) // 在slide显示后0.3秒开始内容动画 .to([slideContentH2, slideContentP, slideContentBtn], { // 内容消失动画 autoAlpha:0, y:-20, stagger:0.1, duration: 0.4 }, `slide${index}+=${slideInterval / 1000 - 0.5}`) // 在下一张slide开始前0.5秒结束 .to(slide, { opacity: 0, duration: 1, delay: slideInterval / 1000 - 1 // 保证在内容消失后,slide本身再消失 }, `slide${index}`); }); // 初始化第一个slide的内容动画 const firstSlide = slides[0]; const firstSlideContentH2 = firstSlide.querySelector('.slide-content h2'); const firstSlideContentP = firstSlide.querySelector('.slide-content p'); const firstSlideContentBtn = firstSlide.querySelector('.slide-content .cta-button'); gsap.set(slides, {opacity:0}); // 全部隐藏 gsap.set(firstSlide, {opacity:1}); // 显示第一个 gsap.from([firstSlideContentH2, firstSlideContentP, firstSlideContentBtn], { autoAlpha:0, y:30, stagger:0.2, duration: 0.6, delay: 0.3 }); } </script> </body> </html>