tab1.page.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import { Component } from '@angular/core';
  2. import { NavController } from '@ionic/angular';
  3. @Component({
  4. selector: 'app-home',
  5. templateUrl: 'home.page.html',
  6. styleUrls: ['home.page.scss'],
  7. })
  8. export class HomePage {
  9. // 假设这些数据从后端API获取
  10. weather = {
  11. temperature: 22,
  12. condition: '晴天',
  13. icon: 'sunny'
  14. };
  15. todos = [
  16. { text: '完成日报', completed: false },
  17. { text: '参加会议', completed: false },
  18. { text: '买菜', completed: false }
  19. ];
  20. traffic = {
  21. status: '路况良好,预计10分钟到达'
  22. };
  23. constructor(private navCtrl: NavController) {}
  24. // 打开设置页面
  25. openSettings() {
  26. this.navCtrl.navigateForward('/settings');
  27. }
  28. // 打开个人资料页面
  29. openProfile() {
  30. this.navCtrl.navigateForward('/profile');
  31. }
  32. // 跳转到注册页面
  33. goToRegister() {
  34. this.navCtrl.navigateForward('/register');
  35. }
  36. // 跳转到登录页面
  37. goToLogin() {
  38. this.navCtrl.navigateForward('/login');
  39. }
  40. // 查看交通详情
  41. viewTrafficDetails() {
  42. this.navCtrl.navigateForward('/traffic-details');
  43. }
  44. }