Great 6 днів тому
батько
коміт
656f460c10

+ 2 - 1
angular.json

@@ -136,7 +136,8 @@
   "cli": {
     "schematicCollections": [
       "@ionic/angular-toolkit"
-    ]
+    ],
+    "analytics": false
   },
   "schematics": {
     "@ionic/angular-toolkit:component": {

Різницю між файлами не показано, бо вона завелика
+ 688 - 17
package-lock.json


+ 1 - 0
package.json

@@ -27,6 +27,7 @@
     "@capacitor/keyboard": "7.0.1",
     "@capacitor/status-bar": "7.0.1",
     "@ionic/angular": "^8.0.0",
+    "fmode-ng": "^0.0.83",
     "ionicons": "^7.0.0",
     "rxjs": "~7.8.0",
     "tslib": "^2.3.0",

+ 17 - 0
src/app/ai-assistant/ai-assistant-routing.module.ts

@@ -0,0 +1,17 @@
+import { NgModule } from '@angular/core';
+import { Routes, RouterModule } from '@angular/router';
+
+import { AiAssistantPage } from './ai-assistant.page';
+
+const routes: Routes = [
+  {
+    path: '',
+    component: AiAssistantPage
+  }
+];
+
+@NgModule({
+  imports: [RouterModule.forChild(routes)],
+  exports: [RouterModule],
+})
+export class AiAssistantPageRoutingModule {}

+ 70 - 0
src/app/ai-assistant/ai-assistant.page.html

@@ -0,0 +1,70 @@
+<ion-header>
+  <ion-toolbar>
+    <ion-buttons slot="start">
+      <!-- 使用自定义返回按钮 -->
+      <ion-button (click)="goBack()">
+        <ion-icon slot="icon-only" name="arrow-back"></ion-icon>
+      </ion-button>
+    </ion-buttons>
+    <ion-title>AI日程助手</ion-title>
+    <ion-buttons slot="end">
+      <ion-button (click)="userInput = ''">
+        <ion-icon slot="icon-only" name="close-outline"></ion-icon>
+      </ion-button>
+    </ion-buttons>
+  </ion-toolbar>
+</ion-header>
+
+<ion-content>
+  <div class="header">
+    <h1>智能日程规划</h1>
+    <p>让AI帮助您创建高效、平衡的日程安排</p>
+  </div>
+
+  <div class="suggestion-container" *ngIf="!isLoading">
+    <h2>
+      <ion-icon name="bulb-outline"></ion-icon>
+      快速建议:
+    </h2>
+    <div class="suggestions">
+      <ion-badge 
+        *ngFor="let suggestion of suggestions" 
+        class="suggestion-chip"
+        (click)="useSuggestion(suggestion)">
+        {{ suggestion }}
+      </ion-badge>
+    </div>
+  </div>
+
+  <div class="input-container">
+    <ion-textarea 
+      [(ngModel)]="userInput"
+      placeholder="请描述您的日程需求,例如:&#10;&#10;1. 明天需要参加3个会议&#10;2. 需要完成项目报告&#10;3. 希望有1小时健身时间"
+      autoGrow="true"
+      rows="4">
+    </ion-textarea>
+  </div>
+
+  <ion-button 
+    expand="block"
+    class="generate-btn"
+    (click)="getAIMessage()">
+    <ion-icon slot="start" name="sparkles"></ion-icon>
+    生成智能日程
+  </ion-button>
+
+  <div class="ai-response" *ngIf="!isLoading && aiContent">
+    <h3>
+      <ion-icon name="star-outline"></ion-icon>
+      AI日程建议
+    </h3>
+    <div class="response-content">
+      <pre>{{ aiContent }}</pre>
+    </div>
+  </div>
+
+  <div class="loading-container" *ngIf="isLoading">
+    <ion-spinner name="crescent"></ion-spinner>
+    <p>{{ aiContent }}</p>
+  </div>
+</ion-content>

+ 145 - 0
src/app/ai-assistant/ai-assistant.page.scss

@@ -0,0 +1,145 @@
+:host {
+    --background: #f8f9fa;
+  }
+  
+  ion-content {
+    --padding-start: 16px;
+    --padding-end: 16px;
+    --padding-top: 16px;
+    --padding-bottom: 16px;
+    background: var(--background);
+  }
+  
+  .header {
+    margin-bottom: 24px;
+    
+    h1 {
+      font-size: 1.8rem;
+      font-weight: 700;
+      color: #2d3748;
+      margin-bottom: 8px;
+    }
+    
+    p {
+      color: #718096;
+      line-height: 1.5;
+    }
+  }
+  
+  .suggestion-container {
+    margin-bottom: 24px;
+    
+    h2 {
+      display: flex;
+      align-items: center;
+      font-size: 1.1rem;
+      color: #4a5568;
+      margin-bottom: 12px;
+      
+      ion-icon {
+        margin-right: 8px;
+        color: #667eea;
+      }
+    }
+  }
+  
+  .suggestions {
+    display: flex;
+    flex-wrap: wrap;
+    gap: 8px;
+  }
+  
+  .suggestion-chip {
+    background: #ebf4ff;
+    border-radius: 16px;
+    padding: 8px 12px;
+    font-size: 0.85rem;
+    color: #4a5568;
+    cursor: pointer;
+    transition: all 0.2s ease;
+    
+    &:hover {
+      background: #c3dafe;
+    }
+  }
+  
+  .input-container {
+    margin-bottom: 20px;
+    
+    ion-textarea {
+      background: white;
+      border-radius: 12px;
+      --padding-start: 16px;
+      --padding-end: 16px;
+      --padding-top: 16px;
+      --padding-bottom: 16px;
+      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
+      min-height: 120px;
+      font-size: 1rem;
+    }
+  }
+  
+  .generate-btn {
+    --background: #4a6cf7;
+    --background-activated: #3a5af5;
+    --background-hover: #3a5af5;
+    --border-radius: 12px;
+    height: 50px;
+    font-weight: 600;
+    margin-bottom: 24px;
+  }
+  
+  .ai-response {
+    background: white;
+    border-radius: 16px;
+    padding: 20px;
+    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
+    
+    h3 {
+      display: flex;
+      align-items: center;
+      font-size: 1.2rem;
+      color: #2d3748;
+      margin-bottom: 16px;
+      padding-bottom: 12px;
+      border-bottom: 1px solid #eee;
+      
+      ion-icon {
+        margin-right: 10px;
+        color: #4a6cf7;
+      }
+    }
+    
+    .response-content {
+      white-space: pre-wrap;
+      line-height: 1.6;
+      color: #4a5568;
+      
+      pre {
+        font-family: inherit;
+        white-space: pre-wrap;
+        word-break: break-word;
+      }
+    }
+  }
+  
+  .loading-container {
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+    justify-content: center;
+    padding: 40px 0;
+    
+    ion-spinner {
+      width: 48px;
+      height: 48px;
+      color: #4a6cf7;
+    }
+    
+    p {
+      margin-top: 16px;
+      color: #718096;
+      text-align: center;
+      max-width: 80%;
+    }
+  }

+ 17 - 0
src/app/ai-assistant/ai-assistant.page.spec.ts

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

+ 172 - 0
src/app/ai-assistant/ai-assistant.page.ts

@@ -0,0 +1,172 @@
+import { Component, OnInit } from '@angular/core';
+import { 
+  IonHeader, 
+  IonToolbar, 
+  IonTitle, 
+  IonContent, 
+  IonButtons, 
+  IonButton, 
+  IonIcon, 
+  IonTextarea, 
+  IonSpinner,
+  IonBadge,
+  NavController
+} from '@ionic/angular/standalone';
+import { addIcons } from 'ionicons';
+import { sparkles, bulbOutline, starOutline, arrowBack, closeOutline } from 'ionicons/icons';
+import { FormsModule } from '@angular/forms';
+import { CommonModule } from '@angular/common';
+import { RouterModule } from '@angular/router';
+import { Observable } from 'rxjs';
+
+// 模拟的 FmodeChatCompletion 类
+class FmodeChatCompletion {
+  constructor(private messages: any[]) {}
+
+  sendCompletion() {
+    return new Observable(observer => {
+      setTimeout(() => {
+        observer.next({
+          content: `## 智能日程安排建议 🌟
+          
+**根据您的需求,我为您创建了一个高效的日程安排:**
+
+1. **上午 8:30-9:00** - 晨间规划
+   - 回顾今日目标
+   - 整理待办事项
+
+2. **上午 9:00-10:30** - 深度工作时段
+   - 专注处理核心任务
+   - 避免会议和干扰
+
+3. **上午 10:30-11:00** - 休息与恢复
+   - 短暂休息
+   - 补充水分
+
+4. **上午 11:00-12:30** - 会议与协作
+   - 团队同步会议
+   - 项目讨论
+
+5. **下午 12:30-13:30** - 午餐与休息
+   - 健康饮食
+   - 短暂散步
+
+6. **下午 13:30-15:30** - 创意工作时段
+   - 脑力激荡
+   - 创新项目开发
+
+7. **下午 15:30-16:00** - 茶歇与放松
+   - 伸展运动
+   - 整理思绪
+
+8. **下午 16:00-18:00** - 执行与收尾
+   - 完成当日任务
+   - 准备次日计划
+
+**建议调整:**
+- 每工作50分钟休息10分钟
+- 优先处理高价值任务
+- 保持工作与休息的平衡`,
+          complete: true
+        });
+        observer.complete();
+      }, 2000);
+    });
+  }
+}
+
+@Component({
+  selector: 'app-ai-assistant',
+  templateUrl: './ai-assistant.page.html',
+  styleUrls: ['./ai-assistant.page.scss'],
+  standalone: true,
+  imports: [
+    IonHeader, 
+    IonToolbar, 
+    IonTitle, 
+    IonContent, 
+    IonButtons, 
+    IonButton, 
+    IonIcon, 
+    IonTextarea, 
+    IonSpinner,
+    IonBadge,
+    FormsModule, 
+    CommonModule,
+    RouterModule
+  ]
+})
+export class AiAssistantPage implements OnInit {
+  aiContent: string = "正在分析您的日程需求,请稍候...";
+  userInput: string = '';
+  isLoading: boolean = true;
+  suggestions: string[] = [
+    "帮我规划一个高效的工作日安排",
+    "创建包含会议、开发和休息的日程",
+    "设计一个平衡工作和生活的日程表",
+    "为明天的重要会议做日程规划"
+  ];
+
+  constructor(private navCtrl: NavController) {
+    addIcons({ 
+      sparkles, 
+      bulbOutline, 
+      starOutline, 
+      arrowBack, 
+      closeOutline 
+    });
+  }
+
+  ngOnInit() {
+    this.getAIMessage();
+  }
+
+  goBack() {
+    // 使用NavController进行导航返回
+    this.navCtrl.back();
+  }
+
+  useSuggestion(suggestion: string) {
+    this.userInput = suggestion;
+    this.getAIMessage();
+  }
+
+  getAIMessage() {
+    this.isLoading = true;
+    this.aiContent = "正在为您生成智能日程建议...";
+    
+    let now = new Date();
+    let timeParams = `当前时间:${now.toLocaleString()}`;
+    
+    const PromptTemplate = `你是一个专业的日程规划助手,用户正在制定日程安排。
+    请根据以下信息为用户创建一个合理、高效的日程计划:
+    ${this.userInput || "用户未提供具体信息,请创建一个通用的高效工作日安排"}
+    
+    要求:
+    1. 包含6-8个时间段
+    2. 每个时间段有明确的任务和时长
+    3. 合理安排工作、休息和用餐时间
+    4. 使用Markdown格式返回
+    `;
+    
+    const completion = new FmodeChatCompletion([
+      {role: "system", content: timeParams},
+      {role: "user", content: PromptTemplate}
+    ]);
+    
+    completion.sendCompletion().subscribe({
+      next: (message: any) => {
+        if (message.content) {
+          this.aiContent = message.content;
+        }
+        if (message.complete) {
+          this.isLoading = false;
+        }
+      },
+      error: () => {
+        this.aiContent = "无法连接到AI服务,请稍后再试";
+        this.isLoading = false;
+      }
+    });
+  }
+}

+ 34 - 1
src/app/app-routing.module.ts

@@ -1,16 +1,49 @@
 import { NgModule } from '@angular/core';
 import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
+import { TabsPage } from './tabs/tabs.page';
 
 const routes: Routes = [
   {
     path: '',
     loadChildren: () => import('./tabs/tabs.module').then(m => m.TabsPageModule)
+  },
+  {
+    path: 'ai-assistant',
+    loadComponent: () => import('./ai-assistant/ai-assistant.page').then(m => m.AiAssistantPage)
+  },
+  {
+    path: 'tabs',
+    component: TabsPage,
+    children: [
+      {
+        path: 'tab1',
+        loadChildren: () => import('./tab1/tab1.module').then(m => m.Tab1PageModule)
+      },
+      {
+        path: 'tab2',
+        loadChildren: () => import('./tab2/tab2.module').then(m => m.Tab2PageModule)
+      },
+      {
+        path: 'tab3',
+        loadChildren: () => import('./tab3/tab3.module').then(m => m.Tab3PageModule)
+      },
+      {
+        path: 'tab4',
+        loadChildren: () => import('./tab4/tab4.module').then(m => m.Tab4PageModule)
+      },
+      {
+        path: '',
+        redirectTo: '/tabs/tab1',
+        pathMatch: 'full'
+      }
+    ]
   }
 ];
+
 @NgModule({
   imports: [
     RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
   ],
   exports: [RouterModule]
 })
-export class AppRoutingModule {}
+export class AppRoutingModule {}

+ 30 - 11
src/app/tab1/tab1.page.html

@@ -1,17 +1,36 @@
 <ion-header [translucent]="true">
   <ion-toolbar>
-    <ion-title>
-      Tab 1
-    </ion-title>
+    <ion-buttons slot="start">
+      <ion-button>
+        <ion-icon slot="icon-only" name="add"></ion-icon>
+      </ion-button>
+    </ion-buttons>
+    <ion-title>今日任务</ion-title>
+    <ion-buttons slot="end">
+      <ion-button>
+        <ion-icon slot="icon-only" name="search"></ion-icon>
+      </ion-button>
+    </ion-buttons>
   </ion-toolbar>
 </ion-header>
 
 <ion-content [fullscreen]="true">
-  <ion-header collapse="condense">
-    <ion-toolbar>
-      <ion-title size="large">Tab 1</ion-title>
-    </ion-toolbar>
-  </ion-header>
-
-  <app-explore-container name="Tab 1 page"></app-explore-container>
-</ion-content>
+  <div class="timestamp">{{ currentDate }}</div>
+  
+  <ion-card>
+    <ion-item lines="none">
+      <ion-checkbox slot="start"></ion-checkbox>
+      <ion-label>
+        <div class="task-header">
+          <span class="task-title">项目会议</span>
+          <ion-badge color="light">工作</ion-badge>
+          <ion-badge color="light">重要</ion-badge>
+        </div>
+        <div class="task-meta">
+          <span>⏰ 09:30</span>
+          <span>📁 2个子任务</span>
+        </div>
+      </ion-label>
+    </ion-item>
+  </ion-card>
+</ion-content>

+ 24 - 0
src/app/tab1/tab1.page.scss

@@ -0,0 +1,24 @@
+.timestamp {
+    color: var(--ion-color-medium);
+    font-size: 0.875rem;
+    margin: 16px;
+  }
+  
+  .task-header {
+    display: flex;
+    align-items: center;
+    margin-bottom: 4px;
+  }
+  
+  .task-title {
+    margin-right: 8px;
+  }
+  
+  .task-meta {
+    color: var(--ion-color-medium);
+    font-size: 0.875rem;
+    
+    span {
+      margin-right: 12px;
+    }
+  }

+ 2 - 1
src/app/tab1/tab1.page.ts

@@ -7,7 +7,8 @@ import { Component } from '@angular/core';
   standalone: false,
 })
 export class Tab1Page {
+  currentDate: string;
 
-  constructor() {}
+  constructor() {this.currentDate = new Date().toLocaleDateString();}
 
 }

+ 29 - 11
src/app/tab2/tab2.page.html

@@ -1,17 +1,35 @@
 <ion-header [translucent]="true">
   <ion-toolbar>
-    <ion-title>
-      Tab 2
-    </ion-title>
+    <ion-buttons slot="start">
+      <ion-button>
+        <ion-icon slot="icon-only" name="add"></ion-icon>
+      </ion-button>
+    </ion-buttons>
+    <ion-title>任务列表</ion-title>
+    <ion-buttons slot="end">
+      <ion-button>
+        <ion-icon slot="icon-only" name="search"></ion-icon>
+      </ion-button>
+    </ion-buttons>
   </ion-toolbar>
 </ion-header>
 
 <ion-content [fullscreen]="true">
-  <ion-header collapse="condense">
-    <ion-toolbar>
-      <ion-title size="large">Tab 2</ion-title>
-    </ion-toolbar>
-  </ion-header>
-
-  <app-explore-container name="Tab 2 page"></app-explore-container>
-</ion-content>
+  <div class="grid">
+    <ion-card>
+      <ion-card-content>
+        <div class="folder-icon">📁</div>
+        <div class="folder-title">工作项目</div>
+        <div class="folder-count">5个任务</div>
+      </ion-card-content>
+    </ion-card>
+    
+    <ion-card>
+      <ion-card-content>
+        <div class="folder-icon">📁</div>
+        <div class="folder-title">个人事务</div>
+        <div class="folder-count">3个任务</div>
+      </ion-card-content>
+    </ion-card>
+  </div>
+</ion-content>

+ 27 - 0
src/app/tab2/tab2.page.scss

@@ -0,0 +1,27 @@
+.grid {
+    display: grid;
+    grid-template-columns: 1fr 1fr;
+    gap: 16px;
+    padding: 16px;
+  }
+  
+  ion-card {
+    margin: 0;
+    height: 100%;
+  }
+  
+  .folder-icon {
+    font-size: 2rem;
+    margin-bottom: 8px;
+    color: var(--ion-color-primary);
+  }
+  
+  .folder-title {
+    font-weight: 500;
+    margin-bottom: 4px;
+  }
+  
+  .folder-count {
+    font-size: 0.875rem;
+    color: var(--ion-color-medium);
+  }

+ 23 - 10
src/app/tab3/tab3.page.html

@@ -1,17 +1,30 @@
 <ion-header [translucent]="true">
   <ion-toolbar>
-    <ion-title>
-      Tab 3
-    </ion-title>
+    <ion-title>功能设置</ion-title>
   </ion-toolbar>
 </ion-header>
 
 <ion-content [fullscreen]="true">
-  <ion-header collapse="condense">
-    <ion-toolbar>
-      <ion-title size="large">Tab 3</ion-title>
-    </ion-toolbar>
-  </ion-header>
+  <ion-list>
+    <ion-item>
+      <ion-icon slot="start" name="calendar"></ion-icon>
+      <ion-label>日历视图</ion-label>
+    </ion-item>
+    
+    <ion-item>
+      <ion-icon slot="start" name="stats-chart"></ion-icon>
+      <ion-label>数据统计</ion-label>
+    </ion-item>
+    
+    <ion-item>
+      <ion-icon slot="start" name="settings"></ion-icon>
+      <ion-label>高级设置</ion-label>
+    </ion-item>
 
-  <app-explore-container name="Tab 3 page"></app-explore-container>
-</ion-content>
+    <ion-item button [routerLink]="['/ai-assistant']">
+      <ion-icon slot="start" name="sparkles"></ion-icon>
+      <ion-label>AI辅助</ion-label>
+      <ion-badge slot="end" color="primary">新</ion-badge>
+    </ion-item>
+  </ion-list>
+</ion-content>

+ 10 - 0
src/app/tab3/tab3.page.scss

@@ -0,0 +1,10 @@
+ion-list {
+    padding: 16px;
+  }
+  
+  ion-item {
+    --padding-start: 0;
+    --inner-padding-end: 0;
+    margin-bottom: 8px;
+    border-radius: 8px;
+  }

+ 17 - 0
src/app/tab4/tab4-routing.module.ts

@@ -0,0 +1,17 @@
+import { NgModule } from '@angular/core';
+import { Routes, RouterModule } from '@angular/router';
+
+import { Tab4Page } from './tab4.page';
+
+const routes: Routes = [
+  {
+    path: '',
+    component: Tab4Page
+  }
+];
+
+@NgModule({
+  imports: [RouterModule.forChild(routes)],
+  exports: [RouterModule],
+})
+export class Tab4PageRoutingModule {}

+ 20 - 0
src/app/tab4/tab4.module.ts

@@ -0,0 +1,20 @@
+import { NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { FormsModule } from '@angular/forms';
+
+import { IonicModule } from '@ionic/angular';
+
+import { Tab4PageRoutingModule } from './tab4-routing.module';
+
+import { Tab4Page } from './tab4.page';
+
+@NgModule({
+  imports: [
+    CommonModule,
+    FormsModule,
+    IonicModule,
+    Tab4PageRoutingModule
+  ],
+  declarations: [Tab4Page]
+})
+export class Tab4PageModule {}

+ 30 - 0
src/app/tab4/tab4.page.html

@@ -0,0 +1,30 @@
+<ion-header [translucent]="true">
+  <ion-toolbar>
+    <ion-buttons slot="start">
+      <ion-avatar>
+        <img src="https://i.pravatar.cc/150?img=12" />
+      </ion-avatar>
+      <ion-title>用户昵称</ion-title>
+    </ion-buttons>
+  </ion-toolbar>
+</ion-header>
+
+<ion-content [fullscreen]="true">
+  <ion-list>
+    <ion-item>
+      <ion-label>本周完成</ion-label>
+      <ion-badge slot="end" color="primary">12 任务</ion-badge>
+    </ion-item>
+    
+    <ion-item>
+      <ion-label>连续打卡</ion-label>
+      <ion-badge slot="end" color="primary">7 天</ion-badge>
+    </ion-item>
+    
+    <ion-item>
+      <ion-icon slot="start" name="moon"></ion-icon>
+      <ion-label>暗色模式</ion-label>
+      <ion-toggle slot="end"></ion-toggle>
+    </ion-item>
+  </ion-list>
+</ion-content>

+ 18 - 0
src/app/tab4/tab4.page.scss

@@ -0,0 +1,18 @@
+ion-toolbar {
+    ion-avatar {
+      width: 32px;
+      height: 32px;
+      margin-right: 12px;
+    }
+  }
+  
+  ion-list {
+    padding: 16px;
+  }
+  
+  ion-item {
+    --padding-start: 0;
+    --inner-padding-end: 0;
+    margin-bottom: 8px;
+    border-radius: 8px;
+  }

+ 17 - 0
src/app/tab4/tab4.page.spec.ts

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

+ 16 - 0
src/app/tab4/tab4.page.ts

@@ -0,0 +1,16 @@
+import { Component, OnInit } from '@angular/core';
+
+@Component({
+  selector: 'app-tab4',
+  templateUrl: './tab4.page.html',
+  styleUrls: ['./tab4.page.scss'],
+  standalone: false,
+})
+export class Tab4Page implements OnInit {
+
+  constructor() { }
+
+  ngOnInit() {
+  }
+
+}

+ 4 - 0
src/app/tabs/tabs-routing.module.ts

@@ -19,6 +19,10 @@ const routes: Routes = [
         path: 'tab3',
         loadChildren: () => import('../tab3/tab3.module').then(m => m.Tab3PageModule)
       },
+      {
+        path: 'tab4',
+        loadChildren: () => import('../tab4/tab4.module').then(m => m.Tab4PageModule)
+      },
       {
         path: '',
         redirectTo: '/tabs/tab1',

+ 36 - 2
src/app/tabs/tabs.module.ts

@@ -2,10 +2,44 @@ import { IonicModule } from '@ionic/angular';
 import { NgModule } from '@angular/core';
 import { CommonModule } from '@angular/common';
 import { FormsModule } from '@angular/forms';
-
 import { TabsPageRoutingModule } from './tabs-routing.module';
-
 import { TabsPage } from './tabs.page';
+import { RouterModule, Routes } from '@angular/router';
+
+const routes: Routes = [
+  {
+    path: 'tabs',
+    component: TabsPage,
+    children: [
+      {
+        path: 'tab1',
+        loadChildren: () => import('../tab1/tab1.module').then(m => m.Tab1PageModule)
+      },
+      {
+        path: 'tab2',
+        loadChildren: () => import('../tab2/tab2.module').then(m => m.Tab2PageModule)
+      },
+      {
+        path: 'tab3',
+        loadChildren: () => import('../tab3/tab3.module').then(m => m.Tab3PageModule)
+      },
+      {
+        path: 'tab4',
+        loadChildren: () => import('../tab4/tab4.module').then(m => m.Tab4PageModule)
+      },
+      {
+        path: '',
+        redirectTo: '/tabs/tab1',
+        pathMatch: 'full'
+      }
+    ]
+  },
+  {
+    path: '',
+    redirectTo: '/tabs/tab1',
+    pathMatch: 'full'
+  }
+];
 
 @NgModule({
   imports: [

+ 17 - 14
src/app/tabs/tabs.page.html

@@ -1,20 +1,23 @@
 <ion-tabs>
-
   <ion-tab-bar slot="bottom">
-    <ion-tab-button tab="tab1" href="/tabs/tab1">
-      <ion-icon aria-hidden="true" name="triangle"></ion-icon>
-      <ion-label>Tab 1</ion-label>
+    <ion-tab-button tab="tab1">
+      <ion-icon name="calendar"></ion-icon>
+      <ion-label>今日</ion-label>
     </ion-tab-button>
-
-    <ion-tab-button tab="tab2" href="/tabs/tab2">
-      <ion-icon aria-hidden="true" name="ellipse"></ion-icon>
-      <ion-label>Tab 2</ion-label>
+    
+    <ion-tab-button tab="tab2">
+      <ion-icon name="folder"></ion-icon>
+      <ion-label>列表</ion-label>
     </ion-tab-button>
-
-    <ion-tab-button tab="tab3" href="/tabs/tab3">
-      <ion-icon aria-hidden="true" name="square"></ion-icon>
-      <ion-label>Tab 3</ion-label>
+    
+    <ion-tab-button tab="tab3">
+      <ion-icon name="ellipsis-horizontal"></ion-icon>
+      <ion-label>更多</ion-label>
+    </ion-tab-button>
+    
+    <ion-tab-button tab="tab4">
+      <ion-icon name="person"></ion-icon>
+      <ion-label>我的</ion-label>
     </ion-tab-button>
   </ion-tab-bar>
-
-</ion-tabs>
+</ion-tabs>

+ 22 - 0
src/global.scss

@@ -35,3 +35,25 @@
 /* @import "@ionic/angular/css/palettes/dark.always.css"; */
 /* @import "@ionic/angular/css/palettes/dark.class.css"; */
 @import "@ionic/angular/css/palettes/dark.system.css";
+/* 添加安全区域处理 */
+ion-tab-bar {
+    padding-bottom: constant(safe-area-inset-bottom);
+    padding-bottom: env(safe-area-inset-bottom);
+  }
+  
+  /* 调整标题居中 */
+  ion-toolbar {
+    ion-title {
+      text-align: center;
+    }
+  }
+  
+  /* 调整我的页面标题位置 */
+  app-tab4 {
+    ion-toolbar {
+      ion-title {
+        text-align: left;
+        padding-left: 12px;
+      }
+    }
+  }

Деякі файли не було показано, через те що забагато файлів було змінено