ai-clothing-design.html 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947
  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>羽绒服DIY - 个性定制</title>
  7. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
  8. <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
  9. <style>
  10. * {
  11. margin: 0;
  12. padding: 0;
  13. box-sizing: border-box;
  14. font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  15. }
  16. :root {
  17. --primary: #3498db;
  18. --primary-dark: #2980b9;
  19. --secondary: #e74c3c;
  20. --secondary-dark: #c0392b;
  21. --accent: #9b59b6;
  22. --accent-dark: #8e44ad;
  23. --success: #2ecc71;
  24. --dark: #2c3e50;
  25. --darker: #1a252f;
  26. --light: #ecf0f1;
  27. --lighter: #f9f9f9;
  28. --gray: #95a5a6;
  29. --light-gray: #bdc3c7;
  30. --border: #e0e0e0;
  31. --shadow: rgba(0, 0, 0, 0.1);
  32. --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  33. --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  34. }
  35. body {
  36. background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  37. color: var(--dark);
  38. line-height: 1.6;
  39. min-height: 100vh;
  40. padding: 20px 0;
  41. overflow-x: hidden;
  42. }
  43. .container {
  44. max-width: 480px;
  45. margin: 0 auto;
  46. padding: 0 15px;
  47. }
  48. /* 头部样式 */
  49. header {
  50. text-align: center;
  51. padding: 20px 0;
  52. margin-bottom: 10px;
  53. position: relative;
  54. animation: fadeInDown 0.8s ease;
  55. }
  56. .logo {
  57. display: flex;
  58. align-items: center;
  59. justify-content: center;
  60. gap: 12px;
  61. font-size: 1.8rem;
  62. font-weight: 800;
  63. color: var(--secondary);
  64. margin-bottom: 5px;
  65. }
  66. .logo i {
  67. font-size: 2.2rem;
  68. background: linear-gradient(135deg, var(--secondary), var(--accent));
  69. -webkit-background-clip: text;
  70. -webkit-text-fill-color: transparent;
  71. }
  72. .tagline {
  73. color: var(--gray);
  74. font-size: 0.95rem;
  75. margin-top: 5px;
  76. max-width: 80%;
  77. margin: 0 auto;
  78. }
  79. /* 标签页样式 */
  80. .tabs {
  81. display: flex;
  82. background: white;
  83. border-radius: 50px;
  84. padding: 6px;
  85. margin: 25px 0;
  86. box-shadow: var(--card-shadow);
  87. position: relative;
  88. z-index: 10;
  89. }
  90. .tab {
  91. flex: 1;
  92. text-align: center;
  93. padding: 14px 0;
  94. border-radius: 50px;
  95. font-weight: 600;
  96. cursor: pointer;
  97. transition: var(--transition);
  98. color: var(--gray);
  99. position: relative;
  100. overflow: hidden;
  101. }
  102. .tab.active {
  103. color: white;
  104. background: linear-gradient(135deg, var(--primary), var(--accent));
  105. box-shadow: 0 5px 15px rgba(52, 152, 219, 0.4);
  106. }
  107. .tab i {
  108. margin-right: 6px;
  109. font-size: 1.1rem;
  110. }
  111. /* 面板样式 */
  112. .panel {
  113. display: none;
  114. background: white;
  115. border-radius: 25px;
  116. padding: 30px;
  117. margin-bottom: 25px;
  118. box-shadow: var(--card-shadow);
  119. animation: fadeIn 0.6s ease;
  120. transform-origin: top;
  121. }
  122. .panel.active {
  123. display: block;
  124. }
  125. h2 {
  126. font-size: 1.5rem;
  127. margin-bottom: 20px;
  128. color: var(--dark);
  129. display: flex;
  130. align-items: center;
  131. gap: 12px;
  132. padding-bottom: 15px;
  133. border-bottom: 2px solid var(--light);
  134. }
  135. h2 i {
  136. background: linear-gradient(135deg, var(--primary), var(--accent));
  137. -webkit-background-clip: text;
  138. -webkit-text-fill-color: transparent;
  139. width: 36px;
  140. height: 36px;
  141. display: flex;
  142. align-items: center;
  143. justify-content: center;
  144. border-radius: 50%;
  145. background-color: rgba(52, 152, 219, 0.1);
  146. }
  147. .section-desc {
  148. color: var(--gray);
  149. margin-bottom: 25px;
  150. font-size: 0.95rem;
  151. }
  152. /* 羽绒服展示区域 */
  153. .jacket-display-container {
  154. position: relative;
  155. margin: 0 auto 30px;
  156. perspective: 1000px;
  157. }
  158. .jacket-display {
  159. width: 300px;
  160. height: 420px;
  161. margin: 0 auto;
  162. position: relative;
  163. transform-style: preserve-3d;
  164. transition: transform 0.8s ease;
  165. }
  166. .jacket-display:hover {
  167. transform: rotateY(10deg);
  168. }
  169. .jacket-base {
  170. position: absolute;
  171. top: 0;
  172. left: 0;
  173. width: 100%;
  174. height: 100%;
  175. background: url('https://i.ibb.co/0QrZb0C/jacket-base.png') no-repeat center;
  176. background-size: contain;
  177. z-index: 1;
  178. filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.1));
  179. }
  180. .jacket-part {
  181. position: absolute;
  182. cursor: pointer;
  183. transition: var(--transition);
  184. z-index: 2;
  185. border-radius: 12px;
  186. box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
  187. }
  188. .jacket-part:hover {
  189. transform: translateY(-3px);
  190. filter: brightness(1.05);
  191. }
  192. .jacket-part.active-part {
  193. outline: 3px solid var(--primary);
  194. outline-offset: 3px;
  195. filter: drop-shadow(0 0 8px rgba(52, 152, 219, 0.5));
  196. }
  197. .jacket-hood {
  198. top: 0;
  199. left: 50px;
  200. width: 200px;
  201. height: 120px;
  202. background: linear-gradient(135deg, #3498db, #2980b9);
  203. border-radius: 100px 100px 0 0;
  204. z-index: 3;
  205. }
  206. .jacket-body {
  207. top: 100px;
  208. left: 25px;
  209. width: 250px;
  210. height: 250px;
  211. background: linear-gradient(135deg, #2980b9, #1c6ea4);
  212. border-radius: 20px;
  213. }
  214. .jacket-sleeve {
  215. top: 110px;
  216. width: 80px;
  217. height: 180px;
  218. border-radius: 40px;
  219. }
  220. .jacket-sleeve.left {
  221. left: 0;
  222. background: linear-gradient(135deg, #3498db, #2980b9);
  223. }
  224. .jacket-sleeve.right {
  225. right: 0;
  226. background: linear-gradient(135deg, #3498db, #2980b9);
  227. }
  228. /* 颜色选择器 */
  229. .color-palette {
  230. display: flex;
  231. flex-wrap: wrap;
  232. gap: 15px;
  233. justify-content: center;
  234. margin-top: 20px;
  235. }
  236. .color-option {
  237. width: 44px;
  238. height: 44px;
  239. border-radius: 50%;
  240. cursor: pointer;
  241. border: 3px solid white;
  242. box-shadow: 0 4px 10px var(--shadow);
  243. transition: var(--transition);
  244. position: relative;
  245. }
  246. .color-option:hover {
  247. transform: scale(1.15);
  248. }
  249. .color-option.active {
  250. transform: scale(1.2);
  251. box-shadow: 0 0 0 3px white, 0 0 0 6px var(--primary);
  252. }
  253. .color-option.active::after {
  254. content: '\f00c';
  255. font-family: 'Font Awesome 6 Free';
  256. font-weight: 900;
  257. position: absolute;
  258. top: 50%;
  259. left: 50%;
  260. transform: translate(-50%, -50%);
  261. color: white;
  262. font-size: 14px;
  263. text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  264. }
  265. /* IP上传区域 */
  266. .ip-upload {
  267. display: flex;
  268. flex-direction: column;
  269. align-items: center;
  270. gap: 20px;
  271. margin: 25px 0;
  272. }
  273. .upload-area {
  274. width: 100%;
  275. height: 200px;
  276. border: 3px dashed var(--light-gray);
  277. border-radius: 20px;
  278. display: flex;
  279. flex-direction: column;
  280. align-items: center;
  281. justify-content: center;
  282. cursor: pointer;
  283. transition: var(--transition);
  284. background: var(--lighter);
  285. position: relative;
  286. overflow: hidden;
  287. }
  288. .upload-area:hover {
  289. border-color: var(--primary);
  290. background: rgba(52, 152, 219, 0.05);
  291. transform: translateY(-5px);
  292. }
  293. .upload-area i {
  294. font-size: 3.5rem;
  295. color: var(--light-gray);
  296. margin-bottom: 15px;
  297. transition: var(--transition);
  298. }
  299. .upload-area:hover i {
  300. color: var(--primary);
  301. }
  302. /* 分享区域 */
  303. .share-section {
  304. text-align: center;
  305. padding: 30px 20px;
  306. background: linear-gradient(135deg, var(--primary), var(--accent));
  307. border-radius: 20px;
  308. color: white;
  309. margin: 25px 0;
  310. position: relative;
  311. overflow: hidden;
  312. }
  313. .share-section::before {
  314. content: '';
  315. position: absolute;
  316. top: -50%;
  317. left: -50%;
  318. width: 200%;
  319. height: 200%;
  320. background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 70%);
  321. transform: rotate(30deg);
  322. }
  323. .share-section h3 {
  324. font-size: 1.4rem;
  325. margin-bottom: 10px;
  326. position: relative;
  327. z-index: 2;
  328. }
  329. .share-link {
  330. display: flex;
  331. background: white;
  332. border-radius: 50px;
  333. padding: 3px;
  334. margin: 25px 0 20px;
  335. color: var(--dark);
  336. align-items: center;
  337. position: relative;
  338. z-index: 2;
  339. box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  340. }
  341. .share-link input {
  342. flex: 1;
  343. border: none;
  344. padding: 14px 20px;
  345. font-size: 0.95rem;
  346. background: transparent;
  347. color: var(--dark);
  348. outline: none;
  349. }
  350. .share-link button {
  351. background: var(--accent);
  352. color: white;
  353. border: none;
  354. border-radius: 50px;
  355. padding: 12px 25px;
  356. font-weight: 600;
  357. cursor: pointer;
  358. transition: var(--transition);
  359. white-space: nowrap;
  360. }
  361. .share-link button:hover {
  362. background: var(--accent-dark);
  363. }
  364. .share-icons {
  365. display: flex;
  366. justify-content: center;
  367. gap: 25px;
  368. margin-top: 20px;
  369. position: relative;
  370. z-index: 2;
  371. }
  372. .share-icon {
  373. width: 55px;
  374. height: 55px;
  375. border-radius: 50%;
  376. background: white;
  377. display: flex;
  378. align-items: center;
  379. justify-content: center;
  380. color: var(--dark);
  381. font-size: 1.6rem;
  382. cursor: pointer;
  383. transition: var(--transition);
  384. box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  385. }
  386. .share-icon:hover {
  387. transform: translateY(-8px);
  388. }
  389. .share-icon.wechat { color: #2ecc71; }
  390. .share-icon.weibo { color: #e74c3c; }
  391. .share-icon.qq { color: #3498db; }
  392. /* 统计卡片 */
  393. .color-stats {
  394. display: flex;
  395. flex-wrap: wrap;
  396. gap: 15px;
  397. margin-top: 20px;
  398. }
  399. .color-stat {
  400. flex: 1;
  401. min-width: 140px;
  402. background: white;
  403. border-radius: 18px;
  404. padding: 20px 15px;
  405. text-align: center;
  406. box-shadow: var(--card-shadow);
  407. transition: var(--transition);
  408. }
  409. .color-stat:hover {
  410. transform: translateY(-8px);
  411. box-shadow: 0 15px 30px rgba(0, 0, 0, 0.12);
  412. }
  413. .color-stat .color-box {
  414. width: 70px;
  415. height: 70px;
  416. border-radius: 50%;
  417. margin: 0 auto 15px;
  418. box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
  419. display: flex;
  420. align-items: center;
  421. justify-content: center;
  422. font-size: 1.8rem;
  423. color: white;
  424. }
  425. .color-stat .stat-name {
  426. font-weight: 700;
  427. margin-bottom: 8px;
  428. font-size: 1.1rem;
  429. }
  430. .color-stat .stat-count {
  431. color: var(--gray);
  432. font-size: 0.95rem;
  433. }
  434. /* 按钮样式 */
  435. .action-buttons {
  436. display: flex;
  437. gap: 15px;
  438. margin-top: 30px;
  439. }
  440. .btn {
  441. flex: 1;
  442. padding: 18px;
  443. border-radius: 50px;
  444. border: none;
  445. font-weight: 600;
  446. font-size: 1.05rem;
  447. cursor: pointer;
  448. transition: var(--transition);
  449. text-align: center;
  450. display: flex;
  451. align-items: center;
  452. justify-content: center;
  453. gap: 8px;
  454. }
  455. .btn-primary {
  456. background: linear-gradient(135deg, var(--primary), var(--accent));
  457. color: white;
  458. box-shadow: 0 8px 20px rgba(52, 152, 219, 0.3);
  459. }
  460. .btn-primary:hover {
  461. box-shadow: 0 12px 25px rgba(52, 152, 219, 0.4);
  462. transform: translateY(-3px);
  463. }
  464. .btn-secondary {
  465. background: white;
  466. color: var(--primary);
  467. border: 2px solid var(--primary);
  468. }
  469. .btn-secondary:hover {
  470. background: rgba(52, 152, 219, 0.05);
  471. transform: translateY(-3px);
  472. }
  473. /* 图表容器 */
  474. .chart-container {
  475. background: white;
  476. border-radius: 20px;
  477. padding: 20px;
  478. margin-top: 25px;
  479. box-shadow: var(--card-shadow);
  480. height: 300px;
  481. }
  482. /* 页脚 */
  483. footer {
  484. text-align: center;
  485. padding: 30px 0 20px;
  486. color: var(--gray);
  487. font-size: 0.9rem;
  488. }
  489. /* 动画 */
  490. @keyframes fadeIn {
  491. from { opacity: 0; transform: translateY(20px); }
  492. to { opacity: 1; transform: translateY(0); }
  493. }
  494. @keyframes fadeInDown {
  495. from { opacity: 0; transform: translateY(-20px); }
  496. to { opacity: 1; transform: translateY(0); }
  497. }
  498. @keyframes pulse {
  499. 0% { transform: scale(1); }
  500. 50% { transform: scale(1.05); }
  501. 100% { transform: scale(1); }
  502. }
  503. .pulse {
  504. animation: pulse 2s infinite;
  505. }
  506. /* 响应式调整 */
  507. @media (max-width: 480px) {
  508. .container {
  509. padding: 0 10px;
  510. }
  511. .jacket-display {
  512. width: 280px;
  513. height: 400px;
  514. }
  515. .color-stats {
  516. flex-direction: column;
  517. }
  518. .color-stat {
  519. min-width: 100%;
  520. }
  521. h2 {
  522. font-size: 1.4rem;
  523. }
  524. .panel {
  525. padding: 25px 20px;
  526. }
  527. }
  528. </style>
  529. </head>
  530. <body>
  531. <div class="container">
  532. <header>
  533. <div class="logo">
  534. <i class="fas fa-vest"></i>
  535. <span>羽绒服DIY</span>
  536. </div>
  537. <p class="tagline">创造属于你的个性羽绒服,展现独特时尚风格</p>
  538. </header>
  539. <div class="tabs">
  540. <div class="tab active" data-tab="customize">
  541. <i class="fas fa-palette"></i> 定制
  542. </div>
  543. <div class="tab" data-tab="ip">
  544. <i class="fas fa-crown"></i> IP
  545. </div>
  546. <div class="tab" data-tab="share">
  547. <i class="fas fa-share-alt"></i> 分享
  548. </div>
  549. <div class="tab" data-tab="trends">
  550. <i class="fas fa-chart-line"></i> 趋势
  551. </div>
  552. </div>
  553. <!-- 个性定制面板 -->
  554. <div class="panel active" id="customize-panel">
  555. <h2><i class="fas fa-palette"></i> 个性定制</h2>
  556. <p class="section-desc">选择羽绒服的不同部位并自定义颜色,打造属于你的独特设计</p>
  557. <div class="jacket-display-container">
  558. <div class="jacket-display">
  559. <div class="jacket-base"></div>
  560. <div class="jacket-part jacket-hood active-part" data-part="hood"></div>
  561. <div class="jacket-part jacket-body" data-part="body"></div>
  562. <div class="jacket-part jacket-sleeve left" data-part="sleeve-left"></div>
  563. <div class="jacket-part jacket-sleeve right" data-part="sleeve-right"></div>
  564. </div>
  565. </div>
  566. <h3>选择颜色</h3>
  567. <div class="color-palette">
  568. <div class="color-option active" style="background-color: #3498db;" data-color="#3498db"></div>
  569. <div class="color-option" style="background-color: #e74c3c;" data-color="#e74c3c"></div>
  570. <div class="color-option" style="background-color: #2ecc71;" data-color="#2ecc71"></div>
  571. <div class="color-option" style="background-color: #f1c40f;" data-color="#f1c40f"></div>
  572. <div class="color-option" style="background-color: #9b59b6;" data-color="#9b59b6"></div>
  573. <div class="color-option" style="background-color: #1abc9c;" data-color="#1abc9c"></div>
  574. <div class="color-option" style="background-color: #e67e22;" data-color="#e67e22"></div>
  575. <div class="color-option" style="background-color: #2c3e50;" data-color="#2c3e50"></div>
  576. <div class="color-option" style="background-color: #ecf0f1;" data-color="#ecf0f1"></div>
  577. <div class="color-option" style="background-color: #e84393;" data-color="#e84393"></div>
  578. </div>
  579. <div class="action-buttons">
  580. <button class="btn btn-secondary">
  581. <i class="fas fa-redo"></i> 重置
  582. </button>
  583. <button class="btn btn-primary pulse">
  584. <i class="fas fa-save"></i> 保存设计
  585. </button>
  586. </div>
  587. </div>
  588. <!-- 热门IP面板 -->
  589. <div class="panel" id="ip-panel">
  590. <h2><i class="fas fa-crown"></i> 热门IP配色</h2>
  591. <p class="section-desc">从热门IP图片中提取颜色,应用到你的羽绒服设计</p>
  592. <div class="ip-upload">
  593. <div class="upload-area" id="uploadArea">
  594. <i class="fas fa-cloud-upload-alt"></i>
  595. <p>点击上传图片或拖放文件到这里</p>
  596. <small>支持JPG、PNG格式,最大5MB</small>
  597. </div>
  598. <button class="btn btn-primary">
  599. <i class="fas fa-magic"></i> 识别图片颜色
  600. </button>
  601. </div>
  602. <h3>热门IP推荐</h3>
  603. <div class="color-stats">
  604. <div class="color-stat">
  605. <div class="color-box" style="background: linear-gradient(135deg, #FFD700, #C0C0C0);">
  606. <i class="fas fa-bolt"></i>
  607. </div>
  608. <div class="stat-name">漫威英雄</div>
  609. <div class="stat-count">12,450 次使用</div>
  610. </div>
  611. <div class="color-stat">
  612. <div class="color-box" style="background: linear-gradient(135deg, #FF69B4, #00FFFF);">
  613. <i class="fas fa-vest"></i>
  614. </div>
  615. <div class="stat-name">芭比娃娃</div>
  616. <div class="stat-count">9,870 次使用</div>
  617. </div>
  618. </div>
  619. </div>
  620. <!-- 分享面板 -->
  621. <div class="panel" id="share-panel">
  622. <h2><i class="fas fa-share-alt"></i> 分享你的设计</h2>
  623. <p class="section-desc">将你的个性羽绒服设计分享给朋友或社交平台</p>
  624. <div class="share-section">
  625. <h3>我的个性羽绒服设计</h3>
  626. <p>扫描二维码或复制链接分享给好友</p>
  627. <div class="share-link">
  628. <input type="text" id="shareLink" value="https://diy.jacket.com/design/abc123" readonly>
  629. <button id="copyBtn">
  630. <i class="fas fa-copy"></i> 复制链接
  631. </button>
  632. </div>
  633. <div class="share-icons">
  634. <div class="share-icon wechat">
  635. <i class="fab fa-weixin"></i>
  636. </div>
  637. <div class="share-icon weibo">
  638. <i class="fab fa-weibo"></i>
  639. </div>
  640. <div class="share-icon qq">
  641. <i class="fab fa-qq"></i>
  642. </div>
  643. </div>
  644. </div>
  645. <h3>热门分享设计</h3>
  646. <div class="color-stats">
  647. <div class="color-stat">
  648. <div class="color-box" style="background: linear-gradient(135deg, #3498db, #9b59b6);">
  649. <i class="fas fa-star"></i>
  650. </div>
  651. <div class="stat-name">星空主题</div>
  652. <div class="stat-count">8,456 次分享</div>
  653. </div>
  654. <div class="color-stat">
  655. <div class="color-box" style="background: linear-gradient(135deg, #e74c3c, #f1c40f);">
  656. <i class="fas fa-fire"></i>
  657. </div>
  658. <div class="stat-name">火焰主题</div>
  659. <div class="stat-count">7,231 次分享</div>
  660. </div>
  661. </div>
  662. </div>
  663. <!-- 流行趋势面板 -->
  664. <div class="panel" id="trends-panel">
  665. <h2><i class="fas fa-chart-line"></i> 颜色流行趋势</h2>
  666. <p class="section-desc">查看最受欢迎的颜色搭配和当前流行趋势</p>
  667. <h3>本周最受欢迎颜色</h3>
  668. <div class="chart-container">
  669. <canvas id="colorChart"></canvas>
  670. </div>
  671. <h3>热门搭配方案</h3>
  672. <div class="color-stats">
  673. <div class="color-stat">
  674. <div class="color-box" style="background: linear-gradient(135deg, #3498db, #2c3e50);">
  675. <i class="fas fa-water"></i>
  676. </div>
  677. <div class="stat-name">深海蓝黑</div>
  678. <div class="stat-count">5,678 次使用</div>
  679. </div>
  680. <div class="color-stat">
  681. <div class="color-box" style="background: linear-gradient(135deg, #e74c3c, #f1c40f);">
  682. <i class="fas fa-sun"></i>
  683. </div>
  684. <div class="stat-name">日落橙黄</div>
  685. <div class="stat-count">4,987 次使用</div>
  686. </div>
  687. </div>
  688. </div>
  689. <footer>
  690. <p>© 2023 羽绒服DIY - 创造你的个性时尚</p>
  691. <p>让每个人都能成为设计师</p>
  692. </footer>
  693. </div>
  694. <script>
  695. // 页面加载完成后执行
  696. document.addEventListener('DOMContentLoaded', function() {
  697. // 标签切换功能
  698. document.querySelectorAll('.tab').forEach(tab => {
  699. tab.addEventListener('click', () => {
  700. // 移除所有活动标签
  701. document.querySelectorAll('.tab').forEach(t => t.classList.remove('active'));
  702. // 添加当前活动标签
  703. tab.classList.add('active');
  704. // 隐藏所有面板
  705. document.querySelectorAll('.panel').forEach(panel => panel.classList.remove('active'));
  706. // 显示对应面板
  707. const panelId = tab.getAttribute('data-tab') + '-panel';
  708. document.getElementById(panelId).classList.add('active');
  709. });
  710. });
  711. // 部位选择功能
  712. document.querySelectorAll('.jacket-part').forEach(part => {
  713. part.addEventListener('click', () => {
  714. document.querySelectorAll('.jacket-part').forEach(p => p.classList.remove('active-part'));
  715. part.classList.add('active-part');
  716. });
  717. });
  718. // 颜色选择功能
  719. document.querySelectorAll('.color-option').forEach(color => {
  720. color.addEventListener('click', () => {
  721. const selectedColor = color.getAttribute('data-color');
  722. const activePart = document.querySelector('.jacket-part.active-part');
  723. if (activePart) {
  724. activePart.style.background = `linear-gradient(135deg, ${selectedColor}, ${adjustColor(selectedColor, -20)})`;
  725. }
  726. // 更新活动颜色指示器
  727. document.querySelectorAll('.color-option').forEach(c => c.classList.remove('active'));
  728. color.classList.add('active');
  729. });
  730. });
  731. // 辅助函数:调整颜色亮度
  732. function adjustColor(color, amount) {
  733. return '#' + color.replace(/^#/, '').replace(/../g, color => ('0'+Math.min(255, Math.max(0, parseInt(color, 16) + amount)).toString(16)).substr(-2));
  734. }
  735. // 复制链接功能
  736. document.getElementById('copyBtn').addEventListener('click', () => {
  737. const linkInput = document.getElementById('shareLink');
  738. linkInput.select();
  739. document.execCommand('copy');
  740. // 显示复制成功提示
  741. const originalText = linkInput.value;
  742. const btnText = document.getElementById('copyBtn');
  743. btnText.innerHTML = '<i class="fas fa-check"></i> 已复制';
  744. setTimeout(() => {
  745. btnText.innerHTML = '<i class="fas fa-copy"></i> 复制链接';
  746. }, 2000);
  747. });
  748. // 上传区域交互
  749. const uploadArea = document.getElementById('uploadArea');
  750. uploadArea.addEventListener('dragover', (e) => {
  751. e.preventDefault();
  752. uploadArea.style.borderColor = 'var(--primary)';
  753. uploadArea.style.backgroundColor = 'rgba(52, 152, 219, 0.1)';
  754. });
  755. uploadArea.addEventListener('dragleave', () => {
  756. uploadArea.style.borderColor = 'var(--light-gray)';
  757. uploadArea.style.backgroundColor = 'var(--lighter)';
  758. });
  759. uploadArea.addEventListener('click', () => {
  760. alert('图片上传功能需要后端支持,此处为前端演示');
  761. });
  762. // 初始化图表
  763. const ctx = document.getElementById('colorChart').getContext('2d');
  764. const colorChart = new Chart(ctx, {
  765. type: 'bar',
  766. data: {
  767. labels: ['海洋蓝', '活力红', '森林绿', '阳光黄', '梦幻紫', '珊瑚橙'],
  768. datasets: [{
  769. label: '使用次数',
  770. data: [1850, 1620, 1540, 1420, 1360, 1280],
  771. backgroundColor: [
  772. '#3498db',
  773. '#e74c3c',
  774. '#2ecc71',
  775. '#f1c40f',
  776. '#9b59b6',
  777. '#ff7f50'
  778. ],
  779. borderColor: [
  780. '#2980b9',
  781. '#c0392b',
  782. '#27ae60',
  783. '#f39c12',
  784. '#8e44ad',
  785. '#ff6347'
  786. ],
  787. borderWidth: 1,
  788. borderRadius: 10
  789. }]
  790. },
  791. options: {
  792. responsive: true,
  793. maintainAspectRatio: false,
  794. plugins: {
  795. legend: {
  796. display: false
  797. },
  798. title: {
  799. display: true,
  800. text: '颜色使用频率统计',
  801. font: {
  802. size: 16
  803. }
  804. }
  805. },
  806. scales: {
  807. y: {
  808. beginAtZero: true,
  809. grid: {
  810. color: 'rgba(0, 0, 0, 0.05)'
  811. }
  812. },
  813. x: {
  814. grid: {
  815. display: false
  816. }
  817. }
  818. }
  819. }
  820. });
  821. // 重置按钮功能
  822. document.querySelector('.btn-secondary').addEventListener('click', () => {
  823. document.querySelectorAll('.jacket-part').forEach(part => {
  824. part.style.background = '';
  825. });
  826. // 重置颜色选择器
  827. document.querySelectorAll('.color-option').forEach(color => {
  828. color.classList.remove('active');
  829. });
  830. // 设置默认颜色为选中
  831. document.querySelector('.color-option').classList.add('active');
  832. // 设置默认激活部位
  833. document.querySelectorAll('.jacket-part').forEach(p => p.classList.remove('active-part'));
  834. document.querySelector('.jacket-hood').classList.add('active-part');
  835. });
  836. });
  837. </script>
  838. </body>
  839. </html>