home.html 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581
  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>家庭AI助手训练</title>
  7. <style>
  8. @import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700&display=swap');
  9. :root {
  10. --bg-light: #FFF9F5;
  11. --warm-orange: #FFA07A;
  12. --soft-blue: #87CEEB;
  13. --light-gray: #F0F0F0;
  14. --text-dark: #333333;
  15. --text-light: #666666;
  16. --accent-green: #98D8C8;
  17. --accent-yellow: #FFD166;
  18. --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  19. }
  20. * {
  21. margin: 0;
  22. padding: 0;
  23. box-sizing: border-box;
  24. font-family: 'Nunito', sans-serif;
  25. }
  26. body {
  27. background-color: var(--bg-light);
  28. color: var(--text-dark);
  29. min-height: 100vh;
  30. padding: 20px;
  31. display: flex;
  32. flex-direction: column;
  33. align-items: center;
  34. }
  35. .container {
  36. width: 100%;
  37. max-width: 900px;
  38. display: flex;
  39. flex-direction: column;
  40. gap: 25px;
  41. }
  42. /* 头部标题 */
  43. .header {
  44. text-align: center;
  45. margin-bottom: 10px;
  46. }
  47. .header h1 {
  48. font-size: 2.2rem;
  49. color: var(--warm-orange);
  50. margin-bottom: 8px;
  51. font-weight: 700;
  52. }
  53. .header p {
  54. color: var(--text-light);
  55. font-size: 1.1rem;
  56. }
  57. /* 成长面板 */
  58. .growth-panel {
  59. background-color: white;
  60. border-radius: 18px;
  61. padding: 25px;
  62. box-shadow: var(--shadow);
  63. text-align: center;
  64. position: relative;
  65. overflow: hidden;
  66. }
  67. .growth-panel::before {
  68. content: '';
  69. position: absolute;
  70. top: 0;
  71. left: 0;
  72. right: 0;
  73. height: 8px;
  74. /* 修改为纯色背景 */
  75. background: var(--warm-orange);
  76. }
  77. .tree-container {
  78. width: 200px;
  79. height: 200px;
  80. margin: 0 auto 20px;
  81. position: relative;
  82. }
  83. .tree {
  84. width: 100%;
  85. height: 100%;
  86. background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200"><path d="M100 20 L120 60 L160 70 L130 100 L150 140 L100 120 L50 140 L70 100 L40 70 L80 60 Z" fill="%2398D8C8"/><rect x="90" y="140" width="20" height="40" fill="%23A0522D"/></svg>');
  87. background-repeat: no-repeat;
  88. background-position: center;
  89. background-size: contain;
  90. animation: gentleBounce 4s infinite ease-in-out;
  91. }
  92. .level-container {
  93. margin-top: 15px;
  94. }
  95. .level {
  96. font-size: 1.2rem;
  97. color: var(--warm-orange);
  98. font-weight: 600;
  99. }
  100. .experience-bar {
  101. background-color: var(--light-gray);
  102. border-radius: 10px;
  103. height: 20px;
  104. margin-top: 10px;
  105. position: relative;
  106. }
  107. .experience-fill {
  108. background-color: var(--warm-orange);
  109. border-radius: 10px;
  110. height: 100%;
  111. width: 65%;
  112. }
  113. .tree-message {
  114. font-size: 1.2rem;
  115. margin-top: 15px;
  116. color: var(--warm-orange);
  117. font-weight: 600;
  118. }
  119. /* 功能区域 */
  120. .features-grid {
  121. display: grid;
  122. grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  123. gap: 20px;
  124. margin-bottom: 20px;
  125. }
  126. .feature-card {
  127. background-color: white;
  128. border-radius: 16px;
  129. padding: 20px;
  130. box-shadow: var(--shadow);
  131. transition: transform 0.3s ease;
  132. }
  133. .feature-card:hover {
  134. transform: translateY(-5px);
  135. }
  136. .feature-card h2 {
  137. font-size: 1.3rem;
  138. margin-bottom: 15px;
  139. color: var(--warm-orange);
  140. display: flex;
  141. align-items: center;
  142. gap: 8px;
  143. }
  144. .feature-card h2 i {
  145. font-size: 1.4rem;
  146. }
  147. /* 任务卡片 */
  148. .task-item {
  149. display: flex;
  150. align-items: center;
  151. padding: 12px 0;
  152. border-bottom: 1px solid var(--light-gray);
  153. }
  154. .task-item:last-child {
  155. border-bottom: none;
  156. }
  157. .task-checkbox {
  158. appearance: none;
  159. width: 20px;
  160. height: 20px;
  161. border: 2px solid var(--soft-blue);
  162. border-radius: 6px;
  163. margin-right: 12px;
  164. position: relative;
  165. cursor: pointer;
  166. }
  167. .task-checkbox:checked {
  168. background-color: var(--soft-blue);
  169. }
  170. .task-checkbox:checked::after {
  171. content: '✓';
  172. position: absolute;
  173. color: white;
  174. font-size: 12px;
  175. top: 50%;
  176. left: 50%;
  177. transform: translate(-50%, -50%);
  178. }
  179. .task-label {
  180. flex: 1;
  181. font-size: 0.95rem;
  182. }
  183. .task-reward {
  184. font-size: 0.8rem;
  185. background-color: var(--accent-yellow);
  186. color: var(--text-dark);
  187. padding: 3px 8px;
  188. border-radius: 12px;
  189. }
  190. /* 情感互动区 */
  191. .mood-selector {
  192. display: flex;
  193. justify-content: space-around;
  194. margin-top: 15px;
  195. }
  196. .mood-option {
  197. display: flex;
  198. flex-direction: column;
  199. align-items: center;
  200. cursor: pointer;
  201. opacity: 0.7;
  202. transition: all 0.3s;
  203. }
  204. .mood-option:hover,
  205. .mood-option.active {
  206. opacity: 1;
  207. transform: scale(1.1);
  208. }
  209. .mood-icon {
  210. width: 40px;
  211. height: 40px;
  212. background-color: var(--light-gray);
  213. border-radius: 50%;
  214. display: flex;
  215. align-items: center;
  216. justify-content: center;
  217. margin-bottom: 5px;
  218. }
  219. .mood-label {
  220. font-size: 0.8rem;
  221. }
  222. /* 奖励展示 */
  223. .badges-container {
  224. display: flex;
  225. flex-wrap: wrap;
  226. gap: 10px;
  227. margin-top: 15px;
  228. }
  229. .badge {
  230. width: 50px;
  231. height: 50px;
  232. background-color: var(--light-gray);
  233. border-radius: 50%;
  234. display: flex;
  235. align-items: center;
  236. justify-content: center;
  237. position: relative;
  238. }
  239. .badge.unlocked {
  240. background-color: var(--accent-yellow);
  241. }
  242. .badge i {
  243. font-size: 1.5rem;
  244. }
  245. /* 底部交互区 */
  246. .interaction-bar {
  247. background-color: white;
  248. border-radius: 16px;
  249. padding: 20px;
  250. box-shadow: var(--shadow);
  251. display: flex;
  252. justify-content: space-between;
  253. align-items: center;
  254. }
  255. .greeting-message {
  256. font-size: 1.1rem;
  257. color: var(--text-dark);
  258. }
  259. .greeting-message span {
  260. color: var(--warm-orange);
  261. font-weight: 600;
  262. }
  263. .mood-button {
  264. background-color: var(--soft-blue);
  265. color: white;
  266. border: none;
  267. padding: 10px 20px;
  268. border-radius: 12px;
  269. display: flex;
  270. align-items: center;
  271. gap: 8px;
  272. cursor: pointer;
  273. transition: background-color 0.3s;
  274. }
  275. .mood-button:hover {
  276. background-color: var(--warm-orange);
  277. }
  278. /* 动画 */
  279. @keyframes gentleBounce {
  280. 0%,
  281. 100% {
  282. transform: translateY(0);
  283. }
  284. 50% {
  285. transform: translateY(-10px);
  286. }
  287. }
  288. @keyframes pulse {
  289. 0% {
  290. transform: scale(1);
  291. }
  292. 50% {
  293. transform: scale(1.05);
  294. }
  295. 100% {
  296. transform: scale(1);
  297. }
  298. }
  299. /* 响应式调整 */
  300. @media (max-width: 768px) {
  301. .features-grid {
  302. grid-template-columns: 1fr;
  303. }
  304. .interaction-bar {
  305. flex-direction: column;
  306. gap: 15px;
  307. text-align: center;
  308. }
  309. }
  310. </style>
  311. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
  312. </head>
  313. <body>
  314. <div class="container">
  315. <!-- 头部标题 -->
  316. <div class="header">
  317. <h1>家庭AI助手训练</h1>
  318. <p>让我们一起培养您贴心的家庭助手</p>
  319. </div>
  320. <!-- 成长面板 -->
  321. <div class="growth-panel">
  322. <div class="tree-container">
  323. <div class="tree"></div>
  324. </div>
  325. <div class="level-container">
  326. <div class="level">等级: 3</div>
  327. <div class="experience-bar">
  328. <div class="experience-fill"></div>
  329. </div>
  330. </div>
  331. <div class="tree-message">你的助手正在茁壮成长!</div>
  332. </div>
  333. <!-- 功能区域 -->
  334. <div class="features-grid">
  335. <!-- 训练任务区 -->
  336. <div class="feature-card">
  337. <h2><i class="fas fa-tasks"></i>今日训练任务</h2>
  338. <div class="task-list">
  339. <div class="task-item">
  340. <input type="checkbox" class="task-checkbox" id="task1" checked>
  341. <label for="task1" class="task-label">教助手识别家庭成员声音</label>
  342. <span class="task-reward">+5</span>
  343. </div>
  344. <div class="task-item">
  345. <input type="checkbox" class="task-checkbox" id="task2">
  346. <label for="task2" class="task-label">设置晚餐提醒</label>
  347. <span class="task-reward">+3</span>
  348. </div>
  349. <div class="task-item">
  350. <input type="checkbox" class="task-checkbox" id="task3">
  351. <label for="task3" class="task-label">记录家庭日程</label>
  352. <span class="task-reward">+4</span>
  353. </div>
  354. <div class="task-item">
  355. <input type="checkbox" class="task-checkbox" id="task4">
  356. <label for="task4" class="task-label">训练天气提醒功能</label>
  357. <span class="task-reward">+2</span>
  358. </div>
  359. </div>
  360. </div>
  361. <!-- 情感互动区 -->
  362. <div class="feature-card">
  363. <h2><i class="fas fa-heart"></i>情感互动</h2>
  364. <p style="margin-bottom: 15px; color: var(--text-light); font-size: 0.95rem;">
  365. 今天助手的心情如何?选择适合的表情来调整互动方式
  366. </p>
  367. <div class="mood-selector">
  368. <div class="mood-option active">
  369. <div class="mood-icon">
  370. <i class="fas fa-smile"></i>
  371. </div>
  372. <span class="mood-label">开心</span>
  373. </div>
  374. <div class="mood-option">
  375. <div class="mood-icon">
  376. <i class="fas fa-meh"></i>
  377. </div>
  378. <span class="mood-label">平静</span>
  379. </div>
  380. <div class="mood-option">
  381. <div class="mood-icon">
  382. <i class="fas fa-frown"></i>
  383. </div>
  384. <span class="mood-label">低落</span>
  385. </div>
  386. <div class="mood-option">
  387. <div class="mood-icon">
  388. <i class="fas fa-angry"></i>
  389. </div>
  390. <span class="mood-label">生气</span>
  391. </div>
  392. </div>
  393. </div>
  394. <!-- 奖励展示 -->
  395. <div class="feature-card">
  396. <h2><i class="fas fa-trophy"></i>家庭徽章</h2>
  397. <p style="margin-bottom: 15px; color: var(--text-light); font-size: 0.95rem;">
  398. 已收集 3/8 个家庭徽章
  399. </p>
  400. <div class="badges-container">
  401. <div class="badge unlocked">
  402. <i class="fas fa-home"></i>
  403. </div>
  404. <div class="badge unlocked">
  405. <i class="fas fa-utensils"></i>
  406. </div>
  407. <div class="badge unlocked">
  408. <i class="fas fa-bed"></i>
  409. </div>
  410. <div class="badge">
  411. <i class="fas fa-bicycle"></i>
  412. </div>
  413. <div class="badge">
  414. <i class="fas fa-book"></i>
  415. </div>
  416. </div>
  417. </div>
  418. </div>
  419. <!-- 底部交互区 -->
  420. <div class="interaction-bar">
  421. <div class="greeting-message">
  422. <span>早上好!</span> 今天的天气适合散步哦!
  423. </div>
  424. <button class="mood-button">
  425. <i class="fas fa-pencil-alt"></i>
  426. <span>记录心情</span>
  427. </button>
  428. </div>
  429. </div>
  430. <script>
  431. // 封装函数以简化 DOM 元素选择
  432. const $ = (selector) => document.querySelector(selector);
  433. const $$ = (selector) => document.querySelectorAll(selector);
  434. document.addEventListener('DOMContentLoaded', function () {
  435. // 任务完成交互
  436. const checkboxes = $$('.task-checkbox');
  437. checkboxes.forEach((checkbox) => {
  438. checkbox.addEventListener('change', function () {
  439. if (this.checked) {
  440. this.parentElement.style.opacity = '0.6';
  441. this.parentElement.style.textDecoration = 'line-through';
  442. // 模拟成长进度更新
  443. const experienceFill = $('.experience-fill');
  444. const currentWidth = parseInt(getComputedStyle(experienceFill).width.replace('px', ''));
  445. const barWidth = parseInt(getComputedStyle($('.experience-bar')).width.replace('px', ''));
  446. const progress = (currentWidth / barWidth) * 100;
  447. const newProgress = Math.min(progress + 5, 100);
  448. experienceFill.style.width = `${newProgress}%`;
  449. const treeMessage = $('.tree-message');
  450. if (newProgress === 100) {
  451. treeMessage.textContent = "恭喜!您的助手已完全成长!";
  452. $('.tree').style.animation = 'pulse 1.5s infinite';
  453. } else {
  454. treeMessage.textContent = "你的助手正在茁壮成长!";
  455. }
  456. }
  457. });
  458. });
  459. // 心情选择交互
  460. const moodOptions = $$('.mood-option');
  461. moodOptions.forEach((option) => {
  462. option.addEventListener('click', function () {
  463. moodOptions.forEach((opt) => opt.classList.remove('active'));
  464. this.classList.add('active');
  465. // 根据心情更新问候语
  466. const greeting = $('.greeting-message span');
  467. const mood = this.querySelector('.mood-label').textContent;
  468. if (mood === '开心') {
  469. greeting.textContent = "太棒了!";
  470. greeting.style.color = "#FFA07A";
  471. } else if (mood === '平静') {
  472. greeting.textContent = "今天过得如何?";
  473. greeting.style.color = "#87CEEB";
  474. } else if (mood === '低落') {
  475. greeting.textContent = "抱抱你...";
  476. greeting.style.color = "#999999";
  477. } else if (mood === '生气') {
  478. greeting.textContent = "冷静一下...";
  479. greeting.style.color = "#FF6B6B";
  480. }
  481. });
  482. });
  483. // 记录心情按钮
  484. const moodButton = $('.mood-button');
  485. moodButton.addEventListener('click', function () {
  486. const activeMood = $('.mood-option.active .mood-label').textContent;
  487. alert(`已记录您今天的心情为: ${activeMood}\n助手会据此调整互动方式哦!`);
  488. // 按钮反馈动画
  489. this.style.transform = 'scale(0.95)';
  490. setTimeout(() => {
  491. this.style.transform = 'scale(1)';
  492. }, 200);
  493. });
  494. // 模拟时间变化的问候语
  495. function updateGreeting() {
  496. const now = new Date();
  497. const hour = now.getHours();
  498. const greetingElement = $('.greeting-message span');
  499. if (hour < 12) {
  500. greetingElement.textContent = "早上好!";
  501. } else if (hour < 18) {
  502. greetingElement.textContent = "下午好!";
  503. } else {
  504. greetingElement.textContent = "晚上好!";
  505. }
  506. }
  507. updateGreeting();
  508. setInterval(updateGreeting, 60000);
  509. });
  510. </script>
  511. </body>
  512. </html>