Browse Source

上传文件至 ''

18079408532 4 days ago
parent
commit
f03fbd8d35
4 changed files with 138 additions and 0 deletions
  1. 52 0
      tab1.page.html
  2. BIN
      tab1.page.scss
  3. 18 0
      tab1.page.spec.ts
  4. 68 0
      tab1.page.ts

+ 52 - 0
tab1.page.html

@@ -0,0 +1,52 @@
+<ion-header>
+  <ion-toolbar>
+    <ion-buttons slot="start">
+      <ion-button>
+        <ion-icon name="logo-android"></ion-icon>
+      </ion-button>
+    </ion-buttons>
+    <ion-title>生活智伴</ion-title>
+    <ion-buttons slot="end">
+      <ion-button (click)="openSettings()">
+        <ion-icon name="settings"></ion-icon>
+      </ion-button>
+      <ion-button (click)="openProfile()">
+        <ion-icon name="person-circle"></ion-icon>
+      </ion-button>
+    </ion-buttons>
+  </ion-toolbar>
+</ion-header>
+
+<ion-content>
+  <!-- 注册与登录 -->
+  <div class="login-register">
+    <ion-button expand="full" (click)="goToRegister()">注册</ion-button>
+    <ion-button expand="full" (click)="goToLogin()">登录</ion-button>
+  </div>
+
+  <!-- 今日天气 -->
+  <div class="weather">
+    <h3>今日天气</h3>
+    <p>{{ weather?.temperature }}°C</p>
+    <p>{{ weather?.condition }}</p>
+    <ion-icon [name]="weather?.icon"></ion-icon>
+  </div>
+
+  <!-- 待办事项 -->
+  <div class="todo-list">
+    <h3>待办事项</h3>
+    <ion-list>
+      <ion-item *ngFor="let todo of todos">
+        <ion-label>{{ todo.text }}</ion-label>
+        <ion-checkbox [(ngModel)]="todo.completed"></ion-checkbox>
+      </ion-item>
+    </ion-list>
+  </div>
+
+  <!-- 实时通勤交通状况 -->
+  <div class="traffic-status">
+    <h3>实时交通状况</h3>
+    <p>{{ traffic?.status }}</p>
+    <ion-button expand="full" (click)="viewTrafficDetails()">查看详情</ion-button>
+  </div>
+</ion-content>

BIN
tab1.page.scss


+ 18 - 0
tab1.page.spec.ts

@@ -0,0 +1,18 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { Tab1Page } from './tab1.page';
+
+describe('Tab1Page', () => {
+  let component: Tab1Page;
+  let fixture: ComponentFixture<Tab1Page>;
+
+  beforeEach(async () => {
+    fixture = TestBed.createComponent(Tab1Page);
+    component = fixture.componentInstance;
+    fixture.detectChanges();
+  });
+
+  it('should create', () => {
+    expect(component).toBeTruthy();
+  });
+});

+ 68 - 0
tab1.page.ts

@@ -0,0 +1,68 @@
+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]);
+  }
+}