zhigou.html 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>智购</title>
  7. <style>
  8. * {
  9. margin: 0;
  10. padding: 0;
  11. box-sizing: border-box;
  12. font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  13. }
  14. body {
  15. background-color: #f5f5f5;
  16. height: 100vh;
  17. display: flex;
  18. flex-direction: column;
  19. }
  20. /* 顶部导航 */
  21. .header {
  22. background: white;
  23. padding: 12px 15px;
  24. text-align: center;
  25. position: relative;
  26. border-bottom: 1px solid #f0f0f0;
  27. }
  28. .header h1 {
  29. font-size: 18px;
  30. font-weight: 500;
  31. color: #333;
  32. }
  33. /* 可滑动内容区 */
  34. .content {
  35. flex: 1;
  36. overflow-y: auto;
  37. -webkit-overflow-scrolling: touch;
  38. padding-bottom: 60px; /* 给底部导航留空间 */
  39. }
  40. /* 智能搜索区域 */
  41. .search-section {
  42. background-color: #fff;
  43. padding: 15px;
  44. border-bottom: 1px solid #eee;
  45. }
  46. .search-title {
  47. font-size: 16px;
  48. color: #333;
  49. margin-bottom: 10px;
  50. }
  51. .search-container {
  52. display: flex;
  53. align-items: center;
  54. }
  55. .search-input {
  56. flex: 1;
  57. background-color: #f5f5f5;
  58. border-radius: 20px;
  59. padding: 10px 15px;
  60. font-size: 14px;
  61. border: none;
  62. outline: none;
  63. }
  64. .search-icon {
  65. margin-left: 10px;
  66. color: #409eff;
  67. }
  68. /* 轮播图区域 */
  69. .carousel {
  70. position: relative;
  71. height: 150px;
  72. margin: 10px;
  73. overflow: hidden;
  74. border-radius: 8px;
  75. }
  76. .carousel-inner {
  77. display: flex;
  78. transition: transform 0.5s ease;
  79. height: 100%;
  80. }
  81. .carousel-item {
  82. min-width: 100%;
  83. height: 100%;
  84. background-size: cover;
  85. background-position: center;
  86. }
  87. .carousel-control {
  88. position: absolute;
  89. top: 50%;
  90. transform: translateY(-50%);
  91. width: 30px;
  92. height: 30px;
  93. background-color: rgba(255, 255, 255, 0.5);
  94. border-radius: 50%;
  95. display: flex;
  96. align-items: center;
  97. justify-content: center;
  98. cursor: pointer;
  99. }
  100. .carousel-prev {
  101. left: 10px;
  102. }
  103. .carousel-next {
  104. right: 10px;
  105. }
  106. .carousel-indicators {
  107. position: absolute;
  108. bottom: 10px;
  109. left: 50%;
  110. transform: translateX(-50%);
  111. display: flex;
  112. gap: 5px;
  113. }
  114. .indicator {
  115. width: 8px;
  116. height: 8px;
  117. border-radius: 50%;
  118. background-color: rgba(255, 255, 255, 0.5);
  119. cursor: pointer;
  120. }
  121. .indicator.active {
  122. background-color: white;
  123. }
  124. /* AI智能推荐区域 */
  125. .recommendation-section {
  126. background-color: #fff;
  127. padding: 15px;
  128. margin-top: 10px;
  129. border-bottom: 1px solid #eee;
  130. }
  131. .section-title {
  132. font-size: 16px;
  133. color: #333;
  134. margin-bottom: 15px;
  135. display: flex;
  136. justify-content: space-between;
  137. align-items: center;
  138. }
  139. .section-title .more {
  140. font-size: 12px;
  141. color: #999;
  142. }
  143. .recommendation-grid {
  144. display: flex;
  145. flex-wrap: wrap;
  146. justify-content: space-between;
  147. }
  148. .product-card {
  149. width: 48%;
  150. background-color: #fff;
  151. border-radius: 8px;
  152. padding: 10px;
  153. margin-bottom: 10px;
  154. box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  155. }
  156. .product-image {
  157. width: 100%;
  158. height: 140px;
  159. background-color: #f8f8f8;
  160. margin-bottom: 10px;
  161. border-radius: 4px;
  162. }
  163. .product-title {
  164. font-size: 14px;
  165. margin-bottom: 5px;
  166. overflow: hidden;
  167. text-overflow: ellipsis;
  168. display: -webkit-box;
  169. -webkit-line-clamp: 2;
  170. -webkit-box-orient: vertical;
  171. }
  172. .product-price {
  173. color: #ff6b00;
  174. font-size: 16px;
  175. font-weight: bold;
  176. margin-bottom: 5px;
  177. }
  178. .product-sales {
  179. font-size: 12px;
  180. color: #999;
  181. }
  182. /* AI导购区域 */
  183. .ai-guide-section {
  184. background-color: #fff;
  185. padding: 15px;
  186. margin-top: 10px;
  187. border-bottom: 1px solid #eee;
  188. }
  189. .chat-window {
  190. position: fixed;
  191. bottom: 70px;
  192. right: 15px;
  193. width: 50px;
  194. height: 50px;
  195. background-color: #409eff;
  196. border-radius: 50%;
  197. display: flex;
  198. align-items: center;
  199. justify-content: center;
  200. color: white;
  201. font-size: 24px;
  202. box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  203. cursor: pointer;
  204. z-index: 100;
  205. }
  206. /* 底部导航 */
  207. .bottom-nav {
  208. position: fixed;
  209. bottom: 0;
  210. width: 100%;
  211. background: white;
  212. display: flex;
  213. justify-content: space-around;
  214. padding: 10px 0;
  215. border-top: 1px solid #f0f0f0;
  216. z-index: 10;
  217. }
  218. .nav-item {
  219. display: flex;
  220. flex-direction: column;
  221. align-items: center;
  222. color: #666;
  223. font-size: 12px;
  224. }
  225. .nav-item.active {
  226. color: #409eff;
  227. }
  228. .nav-icon {
  229. font-size: 20px;
  230. margin-bottom: 3px;
  231. }
  232. /* 智能客服聊天窗口 */
  233. .chat-container {
  234. position: fixed;
  235. bottom: 0;
  236. width: 100%;
  237. height: 300px;
  238. background-color: #fff;
  239. border-top: 1px solid #eee;
  240. z-index: 1000;
  241. display: none;
  242. flex-direction: column;
  243. }
  244. .chat-header {
  245. display: flex;
  246. justify-content: space-between;
  247. align-items: center;
  248. padding: 10px 15px;
  249. border-bottom: 1px solid #eee;
  250. }
  251. .chat-close {
  252. font-size: 18px;
  253. }
  254. .chat-messages {
  255. flex: 1;
  256. padding: 10px;
  257. overflow-y: auto;
  258. }
  259. .chat-input {
  260. display: flex;
  261. padding: 10px;
  262. border-top: 1px solid #eee;
  263. }
  264. .chat-input input {
  265. flex: 1;
  266. padding: 8px;
  267. border: 1px solid #eee;
  268. border-radius: 4px;
  269. margin-right: 10px;
  270. }
  271. .chat-input button {
  272. padding: 8px 15px;
  273. background-color: #409eff;
  274. color: white;
  275. border: none;
  276. border-radius: 4px;
  277. cursor: pointer;
  278. }
  279. </style>
  280. </head>
  281. <body>
  282. <!-- 顶部导航 -->
  283. <div class="header">
  284. <h1>智购</h1>
  285. </div>
  286. <!-- 可滑动内容区 -->
  287. <div class="content" id="scrollContent">
  288. <!-- 智能搜索区域 -->
  289. <div class="search-section">
  290. <h2 class="search-title">智搜</h2>
  291. <div class="search-container">
  292. <input type="text" class="search-input" placeholder="输入关键词,如'适合跑步的鞋子'">
  293. <span class="search-icon">🔍</span>
  294. </div>
  295. <!-- 轮播图 -->
  296. <div class="carousel">
  297. <div class="carousel-inner" id="carouselInner">
  298. <div class="carousel-item" style="background-image: url('https://picsum.photos/id/1/800/400');"></div>
  299. <div class="carousel-item" style="background-image: url('https://picsum.photos/id/2/800/400');"></div>
  300. <div class="carousel-item" style="background-image: url('https://picsum.photos/id/3/800/400');"></div>
  301. </div>
  302. <div class="carousel-control carousel-prev" id="prevBtn">❮</div>
  303. <div class="carousel-control carousel-next" id="nextBtn">❯</div>
  304. <div class="carousel-indicators" id="indicators">
  305. <div class="indicator active"></div>
  306. <div class="indicator"></div>
  307. <div class="indicator"></div>
  308. </div>
  309. </div>
  310. </div>
  311. <!-- AI智能推荐区域 -->
  312. <div class="recommendation-section">
  313. <div class="section-title">
  314. <span>智推</span>
  315. <span class="more">更多 ></span>
  316. </div>
  317. <div class="recommendation-grid">
  318. <!-- 商品卡片1 -->
  319. <div class="product-card">
  320. <div class="product-image"></div>
  321. <div class="product-title">跑步运动鞋 男士轻便透气</div>
  322. <div class="product-price">¥299</div>
  323. <div class="product-sales">128人付款</div>
  324. </div>
  325. <!-- 商品卡片2 -->
  326. <div class="product-card">
  327. <div class="product-image"></div>
  328. <div class="product-title">智能手表 心率监测</div>
  329. <div class="product-price">¥399</div>
  330. <div class="product-sales">86人付款</div>
  331. </div>
  332. <!-- 商品卡片3 -->
  333. <div class="product-card">
  334. <div class="product-image"></div>
  335. <div class="product-title">无线蓝牙耳机 主动降噪</div>
  336. <div class="product-price">¥249</div>
  337. <div class="product-sales">203人付款</div>
  338. </div>
  339. <!-- 商品卡片4 -->
  340. <div class="product-card">
  341. <div class="product-image"></div>
  342. <div class="product-title">乳清蛋白粉 增肌减脂</div>
  343. <div class="product-price">¥179</div>
  344. <div class="product-sales">54人付款</div>
  345. </div>
  346. </div>
  347. </div>
  348. </div>
  349. <!-- AI导购聊天窗口按钮 -->
  350. <div class="chat-window" id="chatBtn">💬</div>
  351. <!-- AI导购聊天窗口 -->
  352. <div class="chat-container" id="chatContainer">
  353. <div class="chat-header">
  354. <h3>智能客服</h3>
  355. <span class="chat-close" id="chatClose">×</span>
  356. </div>
  357. <div class="chat-messages" id="chatMessages">
  358. <div style="margin-bottom: 10px;">
  359. <div style="background-color: #f5f5f5; padding: 10px; border-radius: 5px; max-width: 80%; margin-left: auto; margin-right: 10px;">
  360. 您好!欢迎使用智购客服,请问有什么可以帮您?
  361. </div>
  362. </div>
  363. </div>
  364. <div class="chat-input">
  365. <input type="text" placeholder="请输入您的问题..." id="chatInput">
  366. <button id="sendBtn">发送</button>
  367. </div>
  368. </div>
  369. <!-- 底部导航 -->
  370. <div class="bottom-nav">
  371. <div class="nav-item active">
  372. <div class="nav-icon">🏠</div>
  373. <div>主页</div>
  374. </div>
  375. <div class="nav-item">
  376. <div class="nav-icon">🛒</div>
  377. <div>智购</div>
  378. </div>
  379. <div class="nav-item">
  380. <div class="nav-icon">👤</div>
  381. <div>我的</div>
  382. </div>
  383. </div>
  384. <script>
  385. // 确保移动端滑动流畅
  386. document.addEventListener('touchmove', function(e) {
  387. e.preventDefault();
  388. }, { passive: false });
  389. // 滑动内容区域
  390. const scrollContent = document.getElementById('scrollContent');
  391. scrollContent.addEventListener('touchmove', function(e) {
  392. e.stopPropagation();
  393. }, { passive: true });
  394. // 轮播图功能
  395. const carouselInner = document.getElementById('carouselInner');
  396. const indicators = document.querySelectorAll('.indicator');
  397. const prevBtn = document.getElementById('prevBtn');
  398. const nextBtn = document.getElementById('nextBtn');
  399. let currentIndex = 0;
  400. const itemCount = document.querySelectorAll('.carousel-item').length;
  401. function updateCarousel() {
  402. carouselInner.style.transform = `translateX(-${currentIndex * 100}%)`;
  403. document.querySelectorAll('.indicator').forEach((indicator, index) => {
  404. indicator.classList.toggle('active', index === currentIndex);
  405. });
  406. }
  407. function nextSlide() {
  408. currentIndex = (currentIndex + 1) % itemCount;
  409. updateCarousel();
  410. }
  411. function prevSlide() {
  412. currentIndex = (currentIndex - 1 + itemCount) % itemCount;
  413. updateCarousel();
  414. }
  415. // 自动轮播
  416. let interval = setInterval(nextSlide, 3000);
  417. // 点击控制
  418. prevBtn.addEventListener('click', () => {
  419. clearInterval(interval);
  420. prevSlide();
  421. interval = setInterval(nextSlide, 3000);
  422. });
  423. nextBtn.addEventListener('click', () => {
  424. clearInterval(interval);
  425. nextSlide();
  426. interval = setInterval(nextSlide, 3000);
  427. });
  428. // 指示器点击
  429. indicators.forEach((indicator, index) => {
  430. indicator.addEventListener('click', () => {
  431. clearInterval(interval);
  432. currentIndex = index;
  433. updateCarousel();
  434. interval = setInterval(nextSlide, 3000);
  435. });
  436. });
  437. // AI客服聊天窗口
  438. const chatBtn = document.getElementById('chatBtn');
  439. const chatContainer = document.getElementById('chatContainer');
  440. const chatClose = document.getElementById('chatClose');
  441. const chatInput = document.getElementById('chatInput');
  442. const sendBtn = document.getElementById('sendBtn');
  443. const chatMessages = document.getElementById('chatMessages');
  444. // 打开聊天窗口
  445. chatBtn.addEventListener('click', function() {
  446. chatContainer.style.display = 'flex';
  447. });
  448. // 关闭聊天窗口
  449. chatClose.addEventListener('click', function() {
  450. chatContainer.style.display = 'none';
  451. });
  452. // 发送消息
  453. sendBtn.addEventListener('click', sendMessage);
  454. chatInput.addEventListener('keypress', function(e) {
  455. if (e.key === 'Enter') {
  456. sendMessage();
  457. }
  458. });
  459. function sendMessage() {
  460. const message = chatInput.value.trim();
  461. if (message) {
  462. // 添加用户消息
  463. const userMsg = document.createElement('div');
  464. userMsg.innerHTML = `
  465. <div style="margin-bottom: 10px;">
  466. <div style="background-color: #e1f5fe; padding: 10px; border-radius: 5px; max-width: 80%; margin-right: auto; margin-left: 10px;">
  467. ${message}
  468. </div>
  469. </div>
  470. `;
  471. chatMessages.appendChild(userMsg);
  472. // 清空输入框
  473. chatInput.value = '';
  474. // 滚动到底部
  475. chatMessages.scrollTop = chatMessages.scrollHeight;
  476. // 模拟AI回复
  477. setTimeout(function() {
  478. const botMsg = document.createElement('div');
  479. botMsg.innerHTML = `
  480. <div style="margin-bottom: 10px;">
  481. <div style="background-color: #f5f5f5; padding: 10px; border-radius: 5px; max-width: 80%; margin-left: auto; margin-right: 10px;">
  482. 感谢您的咨询,我正在为您查询相关信息,请稍候...
  483. </div>
  484. </div>
  485. `;
  486. chatMessages.appendChild(botMsg);
  487. chatMessages.scrollTop = chatMessages.scrollHeight;
  488. }, 500);
  489. }
  490. }
  491. // 智能搜索功能
  492. const searchInput = document.querySelector('.search-input');
  493. searchInput.addEventListener('keypress', function(e) {
  494. if (e.key === 'Enter') {
  495. const query = searchInput.value.trim();
  496. if (query) {
  497. alert(`您搜索的内容是: ${query}\n在实际项目中,这里会调用AI搜索接口,返回相关商品`);
  498. }
  499. }
  500. });
  501. </script>
  502. </body>
  503. </html>