tab1.page.ts 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. import { Component } from '@angular/core';
  2. import { IonHeader, IonToolbar, IonTitle, IonContent, IonCard, IonCardContent, IonCardHeader, IonChip, IonButton, IonButtons, IonList, IonItem, IonIcon } from '@ionic/angular/standalone';
  3. import { ExploreContainerComponent } from '../explore-container/explore-container.component';
  4. import { Router } from '@angular/router';
  5. import { CommonModule } from '@angular/common';
  6. @Component({
  7. selector: 'app-tab1',
  8. templateUrl: 'tab1.page.html',
  9. styleUrls: ['tab1.page.scss'],
  10. standalone: true,
  11. imports: [
  12. CommonModule,
  13. IonHeader, IonToolbar, IonTitle, IonContent, ExploreContainerComponent,
  14. IonCard,IonCardContent,IonCardHeader,IonChip,
  15. IonButton,IonButtons,IonList,IonItem,IonIcon
  16. ],
  17. })
  18. export class Tab1Page {
  19. currentDate: Date = new Date();
  20. sleepDuration: string = '7小时30分钟';
  21. sleepTime: string = '22:30';
  22. wakeTime: string = '06:00';
  23. lastDreamDescription: string = '在海边漫步';
  24. emotion: string = '放松';
  25. dreamImages: string[] = [
  26. 'assets/images/dream1.jpg',
  27. 'assets/images/dream2.jpg',
  28. 'assets/images/dream3.jpg',
  29. ];
  30. improvementSuggestion: string = '保持卧室安静和黑暗';
  31. sleepTips: string[] = [
  32. '定时作息,建立良好睡眠习惯',
  33. '避免晚上使用电子设备',
  34. '保持卧室温度适宜',
  35. ];
  36. constructor(private router: Router) {}
  37. getSleepQualityStars(): number[] {
  38. return Array(4).fill(0); // 假设4颗星
  39. }
  40. recordDream() {
  41. // 记录梦境的逻辑
  42. }
  43. analyzeDream() {
  44. // 解梦的逻辑
  45. }
  46. viewAllDreams() {
  47. // 查看所有梦境的逻辑
  48. }
  49. openSettings() {
  50. // 打开设置页面的逻辑
  51. }
  52. openProfile() {
  53. // 打开个人资料页面的逻辑
  54. }
  55. navigateTo(page: string) {
  56. this.router.navigate([page]);
  57. }
  58. }