Forráskód Böngészése

更新 'tab1.page.ts'

18079408532 4 napja
szülő
commit
0d6fb92891
1 módosított fájl, 54 hozzáadás és 68 törlés
  1. 54 68
      tab1.page.ts

+ 54 - 68
tab1.page.ts

@@ -1,68 +1,54 @@
-import { Component } from '@angular/core';
-import { IonHeader, IonToolbar, IonTitle, IonContent, IonCard, IonCardContent, IonCardHeader, IonChip, IonButton, IonButtons, IonList, IonItem, IonIcon } from '@ionic/angular/standalone';
-
-import { ExploreContainerComponent } from '../explore-container/explore-container.component';
-import { Router } from '@angular/router';
-import { CommonModule } from '@angular/common';
-
-@Component({
-  selector: 'app-tab1',
-  templateUrl: 'tab1.page.html',
-  styleUrls: ['tab1.page.scss'],
-  standalone: true,
-  imports: [
-    CommonModule,
-    IonHeader, IonToolbar, IonTitle, IonContent, ExploreContainerComponent,
-    IonCard,IonCardContent,IonCardHeader,IonChip,
-    IonButton,IonButtons,IonList,IonItem,IonIcon
-  ],
-})
-export class Tab1Page {
-  currentDate: Date = new Date();
-  sleepDuration: string = '7小时30分钟';
-  sleepTime: string = '22:30';
-  wakeTime: string = '06:00';
-  lastDreamDescription: string = '在海边漫步';
-  emotion: string = '放松';
-  dreamImages: string[] = [
-    'assets/images/dream1.jpg',
-    'assets/images/dream2.jpg',
-    'assets/images/dream3.jpg',
-  ];
-  improvementSuggestion: string = '保持卧室安静和黑暗';
-  sleepTips: string[] = [
-    '定时作息,建立良好睡眠习惯',
-    '避免晚上使用电子设备',
-    '保持卧室温度适宜',
-  ];
-
-  constructor(private router: Router) {}
-
-  getSleepQualityStars(): number[] {
-    return Array(4).fill(0); // 假设4颗星
-  }
-
-  recordDream() {
-    // 记录梦境的逻辑
-  }
-
-  analyzeDream() {
-    // 解梦的逻辑
-  }
-
-  viewAllDreams() {
-    // 查看所有梦境的逻辑
-  }
-
-  openSettings() {
-    // 打开设置页面的逻辑
-  }
-
-  openProfile() {
-    // 打开个人资料页面的逻辑
-  }
-
-  navigateTo(page: string) {
-    this.router.navigate([page]);
-  }
-}
+import { Component } from '@angular/core';
+import { NavController } from '@ionic/angular';
+
+@Component({
+  selector: 'app-home',
+  templateUrl: 'home.page.html',
+  styleUrls: ['home.page.scss'],
+})
+export class HomePage {
+  // 假设这些数据从后端API获取
+  weather = {
+    temperature: 22,
+    condition: '晴天',
+    icon: 'sunny'
+  };
+
+  todos = [
+    { text: '完成日报', completed: false },
+    { text: '参加会议', completed: false },
+    { text: '买菜', completed: false }
+  ];
+
+  traffic = {
+    status: '路况良好,预计10分钟到达'
+  };
+
+  constructor(private navCtrl: NavController) {}
+
+  // 打开设置页面
+  openSettings() {
+    this.navCtrl.navigateForward('/settings');
+  }
+
+  // 打开个人资料页面
+  openProfile() {
+    this.navCtrl.navigateForward('/profile');
+  }
+
+  // 跳转到注册页面
+  goToRegister() {
+    this.navCtrl.navigateForward('/register');
+  }
+
+  // 跳转到登录页面
+  goToLogin() {
+    this.navCtrl.navigateForward('/login');
+  }
+
+  // 查看交通详情
+  viewTrafficDetails() {
+    this.navCtrl.navigateForward('/traffic-details');
+  }
+}
+