| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571 |
- <!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>
- * {
- margin: 0;
- padding: 0;
- box-sizing: border-box;
- font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
- }
-
- body {
- background-color: #f5f5f5;
- height: 100vh;
- display: flex;
- flex-direction: column;
- }
-
- /* 顶部导航 */
- .header {
- background: white;
- padding: 12px 15px;
- text-align: center;
- position: relative;
- border-bottom: 1px solid #f0f0f0;
- }
-
- .header h1 {
- font-size: 18px;
- font-weight: 500;
- color: #333;
- }
-
- /* 可滑动内容区 */
- .content {
- flex: 1;
- overflow-y: auto;
- -webkit-overflow-scrolling: touch;
- padding-bottom: 60px; /* 给底部导航留空间 */
- }
-
- /* 智能搜索区域 */
- .search-section {
- background-color: #fff;
- padding: 15px;
- border-bottom: 1px solid #eee;
- }
-
- .search-title {
- font-size: 16px;
- color: #333;
- margin-bottom: 10px;
- }
-
- .search-container {
- display: flex;
- align-items: center;
- }
-
- .search-input {
- flex: 1;
- background-color: #f5f5f5;
- border-radius: 20px;
- padding: 10px 15px;
- font-size: 14px;
- border: none;
- outline: none;
- }
-
- .search-icon {
- margin-left: 10px;
- color: #409eff;
- }
-
- /* 轮播图区域 */
- .carousel {
- position: relative;
- height: 150px;
- margin: 10px;
- overflow: hidden;
- border-radius: 8px;
- }
-
- .carousel-inner {
- display: flex;
- transition: transform 0.5s ease;
- height: 100%;
- }
-
- .carousel-item {
- min-width: 100%;
- height: 100%;
- background-size: cover;
- background-position: center;
- }
-
- .carousel-control {
- position: absolute;
- top: 50%;
- transform: translateY(-50%);
- width: 30px;
- height: 30px;
- background-color: rgba(255, 255, 255, 0.5);
- border-radius: 50%;
- display: flex;
- align-items: center;
- justify-content: center;
- cursor: pointer;
- }
-
- .carousel-prev {
- left: 10px;
- }
-
- .carousel-next {
- right: 10px;
- }
-
- .carousel-indicators {
- position: absolute;
- bottom: 10px;
- left: 50%;
- transform: translateX(-50%);
- display: flex;
- gap: 5px;
- }
-
- .indicator {
- width: 8px;
- height: 8px;
- border-radius: 50%;
- background-color: rgba(255, 255, 255, 0.5);
- cursor: pointer;
- }
-
- .indicator.active {
- background-color: white;
- }
-
- /* AI智能推荐区域 */
- .recommendation-section {
- background-color: #fff;
- padding: 15px;
- margin-top: 10px;
- border-bottom: 1px solid #eee;
- }
-
- .section-title {
- font-size: 16px;
- color: #333;
- margin-bottom: 15px;
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
-
- .section-title .more {
- font-size: 12px;
- color: #999;
- }
-
- .recommendation-grid {
- display: flex;
- flex-wrap: wrap;
- justify-content: space-between;
- }
-
- .product-card {
- width: 48%;
- background-color: #fff;
- border-radius: 8px;
- padding: 10px;
- margin-bottom: 10px;
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
- }
-
- .product-image {
- width: 100%;
- height: 140px;
- background-color: #f8f8f8;
- margin-bottom: 10px;
- border-radius: 4px;
- }
-
- .product-title {
- font-size: 14px;
- margin-bottom: 5px;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 2;
- -webkit-box-orient: vertical;
- }
-
- .product-price {
- color: #ff6b00;
- font-size: 16px;
- font-weight: bold;
- margin-bottom: 5px;
- }
-
- .product-sales {
- font-size: 12px;
- color: #999;
- }
-
- /* AI导购区域 */
- .ai-guide-section {
- background-color: #fff;
- padding: 15px;
- margin-top: 10px;
- border-bottom: 1px solid #eee;
- }
-
- .chat-window {
- position: fixed;
- bottom: 70px;
- right: 15px;
- width: 50px;
- height: 50px;
- background-color: #409eff;
- border-radius: 50%;
- display: flex;
- align-items: center;
- justify-content: center;
- color: white;
- font-size: 24px;
- box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
- cursor: pointer;
- z-index: 100;
- }
-
- /* 底部导航 */
- .bottom-nav {
- position: fixed;
- bottom: 0;
- width: 100%;
- background: white;
- display: flex;
- justify-content: space-around;
- padding: 10px 0;
- border-top: 1px solid #f0f0f0;
- z-index: 10;
- }
-
- .nav-item {
- display: flex;
- flex-direction: column;
- align-items: center;
- color: #666;
- font-size: 12px;
- }
-
- .nav-item.active {
- color: #409eff;
- }
-
- .nav-icon {
- font-size: 20px;
- margin-bottom: 3px;
- }
-
- /* 智能客服聊天窗口 */
- .chat-container {
- position: fixed;
- bottom: 0;
- width: 100%;
- height: 300px;
- background-color: #fff;
- border-top: 1px solid #eee;
- z-index: 1000;
- display: none;
- flex-direction: column;
- }
-
- .chat-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 10px 15px;
- border-bottom: 1px solid #eee;
- }
-
- .chat-close {
- font-size: 18px;
- }
-
- .chat-messages {
- flex: 1;
- padding: 10px;
- overflow-y: auto;
- }
-
- .chat-input {
- display: flex;
- padding: 10px;
- border-top: 1px solid #eee;
- }
-
- .chat-input input {
- flex: 1;
- padding: 8px;
- border: 1px solid #eee;
- border-radius: 4px;
- margin-right: 10px;
- }
-
- .chat-input button {
- padding: 8px 15px;
- background-color: #409eff;
- color: white;
- border: none;
- border-radius: 4px;
- cursor: pointer;
- }
- </style>
- </head>
- <body>
- <!-- 顶部导航 -->
- <div class="header">
- <h1>智购</h1>
- </div>
-
- <!-- 可滑动内容区 -->
- <div class="content" id="scrollContent">
- <!-- 智能搜索区域 -->
- <div class="search-section">
- <h2 class="search-title">智搜</h2>
- <div class="search-container">
- <input type="text" class="search-input" placeholder="输入关键词,如'适合跑步的鞋子'">
- <span class="search-icon">🔍</span>
- </div>
-
- <!-- 轮播图 -->
- <div class="carousel">
- <div class="carousel-inner" id="carouselInner">
- <div class="carousel-item" style="background-image: url('https://picsum.photos/id/1/800/400');"></div>
- <div class="carousel-item" style="background-image: url('https://picsum.photos/id/2/800/400');"></div>
- <div class="carousel-item" style="background-image: url('https://picsum.photos/id/3/800/400');"></div>
- </div>
- <div class="carousel-control carousel-prev" id="prevBtn">❮</div>
- <div class="carousel-control carousel-next" id="nextBtn">❯</div>
- <div class="carousel-indicators" id="indicators">
- <div class="indicator active"></div>
- <div class="indicator"></div>
- <div class="indicator"></div>
- </div>
- </div>
- </div>
-
- <!-- AI智能推荐区域 -->
- <div class="recommendation-section">
- <div class="section-title">
- <span>智推</span>
- <span class="more">更多 ></span>
- </div>
- <div class="recommendation-grid">
- <!-- 商品卡片1 -->
- <div class="product-card">
- <div class="product-image"></div>
- <div class="product-title">跑步运动鞋 男士轻便透气</div>
- <div class="product-price">¥299</div>
- <div class="product-sales">128人付款</div>
- </div>
-
- <!-- 商品卡片2 -->
- <div class="product-card">
- <div class="product-image"></div>
- <div class="product-title">智能手表 心率监测</div>
- <div class="product-price">¥399</div>
- <div class="product-sales">86人付款</div>
- </div>
-
- <!-- 商品卡片3 -->
- <div class="product-card">
- <div class="product-image"></div>
- <div class="product-title">无线蓝牙耳机 主动降噪</div>
- <div class="product-price">¥249</div>
- <div class="product-sales">203人付款</div>
- </div>
-
- <!-- 商品卡片4 -->
- <div class="product-card">
- <div class="product-image"></div>
- <div class="product-title">乳清蛋白粉 增肌减脂</div>
- <div class="product-price">¥179</div>
- <div class="product-sales">54人付款</div>
- </div>
- </div>
- </div>
- </div>
-
- <!-- AI导购聊天窗口按钮 -->
- <div class="chat-window" id="chatBtn">💬</div>
-
- <!-- AI导购聊天窗口 -->
- <div class="chat-container" id="chatContainer">
- <div class="chat-header">
- <h3>智能客服</h3>
- <span class="chat-close" id="chatClose">×</span>
- </div>
- <div class="chat-messages" id="chatMessages">
- <div style="margin-bottom: 10px;">
- <div style="background-color: #f5f5f5; padding: 10px; border-radius: 5px; max-width: 80%; margin-left: auto; margin-right: 10px;">
- 您好!欢迎使用智购客服,请问有什么可以帮您?
- </div>
- </div>
- </div>
- <div class="chat-input">
- <input type="text" placeholder="请输入您的问题..." id="chatInput">
- <button id="sendBtn">发送</button>
- </div>
- </div>
-
- <!-- 底部导航 -->
- <div class="bottom-nav">
- <div class="nav-item active">
- <div class="nav-icon">🏠</div>
- <div>主页</div>
- </div>
- <div class="nav-item">
- <div class="nav-icon">🛒</div>
- <div>智购</div>
- </div>
- <div class="nav-item">
- <div class="nav-icon">👤</div>
- <div>我的</div>
- </div>
- </div>
- <script>
- // 确保移动端滑动流畅
- document.addEventListener('touchmove', function(e) {
- e.preventDefault();
- }, { passive: false });
-
- // 滑动内容区域
- const scrollContent = document.getElementById('scrollContent');
- scrollContent.addEventListener('touchmove', function(e) {
- e.stopPropagation();
- }, { passive: true });
-
- // 轮播图功能
- const carouselInner = document.getElementById('carouselInner');
- const indicators = document.querySelectorAll('.indicator');
- const prevBtn = document.getElementById('prevBtn');
- const nextBtn = document.getElementById('nextBtn');
- let currentIndex = 0;
- const itemCount = document.querySelectorAll('.carousel-item').length;
-
- function updateCarousel() {
- carouselInner.style.transform = `translateX(-${currentIndex * 100}%)`;
- document.querySelectorAll('.indicator').forEach((indicator, index) => {
- indicator.classList.toggle('active', index === currentIndex);
- });
- }
-
- function nextSlide() {
- currentIndex = (currentIndex + 1) % itemCount;
- updateCarousel();
- }
-
- function prevSlide() {
- currentIndex = (currentIndex - 1 + itemCount) % itemCount;
- updateCarousel();
- }
-
- // 自动轮播
- let interval = setInterval(nextSlide, 3000);
-
- // 点击控制
- prevBtn.addEventListener('click', () => {
- clearInterval(interval);
- prevSlide();
- interval = setInterval(nextSlide, 3000);
- });
-
- nextBtn.addEventListener('click', () => {
- clearInterval(interval);
- nextSlide();
- interval = setInterval(nextSlide, 3000);
- });
-
- // 指示器点击
- indicators.forEach((indicator, index) => {
- indicator.addEventListener('click', () => {
- clearInterval(interval);
- currentIndex = index;
- updateCarousel();
- interval = setInterval(nextSlide, 3000);
- });
- });
-
- // AI客服聊天窗口
- const chatBtn = document.getElementById('chatBtn');
- const chatContainer = document.getElementById('chatContainer');
- const chatClose = document.getElementById('chatClose');
- const chatInput = document.getElementById('chatInput');
- const sendBtn = document.getElementById('sendBtn');
- const chatMessages = document.getElementById('chatMessages');
-
- // 打开聊天窗口
- chatBtn.addEventListener('click', function() {
- chatContainer.style.display = 'flex';
- });
-
- // 关闭聊天窗口
- chatClose.addEventListener('click', function() {
- chatContainer.style.display = 'none';
- });
-
- // 发送消息
- sendBtn.addEventListener('click', sendMessage);
- chatInput.addEventListener('keypress', function(e) {
- if (e.key === 'Enter') {
- sendMessage();
- }
- });
-
- function sendMessage() {
- const message = chatInput.value.trim();
- if (message) {
- // 添加用户消息
- const userMsg = document.createElement('div');
- userMsg.innerHTML = `
- <div style="margin-bottom: 10px;">
- <div style="background-color: #e1f5fe; padding: 10px; border-radius: 5px; max-width: 80%; margin-right: auto; margin-left: 10px;">
- ${message}
- </div>
- </div>
- `;
- chatMessages.appendChild(userMsg);
-
- // 清空输入框
- chatInput.value = '';
-
- // 滚动到底部
- chatMessages.scrollTop = chatMessages.scrollHeight;
-
- // 模拟AI回复
- setTimeout(function() {
- const botMsg = document.createElement('div');
- botMsg.innerHTML = `
- <div style="margin-bottom: 10px;">
- <div style="background-color: #f5f5f5; padding: 10px; border-radius: 5px; max-width: 80%; margin-left: auto; margin-right: 10px;">
- 感谢您的咨询,我正在为您查询相关信息,请稍候...
- </div>
- </div>
- `;
- chatMessages.appendChild(botMsg);
- chatMessages.scrollTop = chatMessages.scrollHeight;
- }, 500);
- }
- }
-
- // 智能搜索功能
- const searchInput = document.querySelector('.search-input');
- searchInput.addEventListener('keypress', function(e) {
- if (e.key === 'Enter') {
- const query = searchInput.value.trim();
- if (query) {
- alert(`您搜索的内容是: ${query}\n在实际项目中,这里会调用AI搜索接口,返回相关商品`);
- }
- }
- });
- </script>
- </body>
- </html>
|