Pārlūkot izejas kodu

0210329-合并dev

0210329 4 mēneši atpakaļ
vecāks
revīzija
58045ed0b1

+ 19 - 0
src/app/app-routing.module.ts

@@ -6,6 +6,7 @@ const routes: Routes = [
     path: '',
     loadChildren: () => import('./tabs/tabs.module').then(m => m.TabsPageModule)
   },
+<<<<<<< HEAD
   {
     path: 'calendar',
     loadChildren: () => import('./calendar/calendar.module').then( m => m.CalendarPageModule)
@@ -23,6 +24,24 @@ const routes: Routes = [
     path: 'bounty-store',
     loadChildren: () => import('../app/bounty-store/bounty-store.module').then(mod => mod.BountyStorePageModule)
   },
+=======
+ 
+
+  {
+    path: 'user',
+    loadChildren: () => import('../modules/user/user.module').then(m => m.UserModule)
+  },
+  {
+    path: "tree",
+    loadChildren: () => import('../modules/tab/tree/tree.module').then(m => m.TreePageModule)
+  },
+  {
+    path: 'memo',
+    loadChildren: () => import('./memo/memo.module').then( m => m.MemoPageModule)
+  },
+
+
+>>>>>>> dev
 
 ];
 @NgModule({

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

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

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

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

+ 0 - 13
src/app/calendar/calendar.page.html

@@ -1,13 +0,0 @@
-<ion-header [translucent]="true">
-  <ion-toolbar>
-    <ion-title>calendar</ion-title>
-  </ion-toolbar>
-</ion-header>
-
-<ion-content [fullscreen]="true">
-  <ion-header collapse="condense">
-    <ion-toolbar>
-      <ion-title size="large">calendar</ion-title>
-    </ion-toolbar>
-  </ion-header>
-</ion-content>

+ 0 - 0
src/app/calendar/calendar.page.scss


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

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

+ 0 - 15
src/app/calendar/calendar.page.ts

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

+ 28 - 5
src/app/memo/memo.page.html

@@ -1,12 +1,9 @@
-<ion-header>
+<!-- <ion-header>
   <ion-toolbar>
     <ion-title>备忘录</ion-title>
   </ion-toolbar>
 </ion-header>
-
 <ion-content>
-
-
   <div *ngIf="segment === 'memo'">
     <ion-list>
       <ion-item *ngFor="let memo of memos">
@@ -22,5 +19,31 @@
       <ion-button (click)="addMemo()">添加</ion-button>
     </ion-item>
   </div>
+</ion-content> -->
 
-</ion-content>
+<ion-header>
+  <ion-toolbar>
+    <ion-title>备忘录</ion-title>
+  </ion-toolbar>
+</ion-header>
+<ion-content>
+
+  <div *ngIf="segment === 'memo'">
+    <ion-list>
+      <ion-item *ngFor="let memo of memos">
+        <ion-label>
+          {{ memo.content }}
+          <p>{{ memo.timestamp | date:'yyyy年MM月dd日 HH:mm:ss' }}</p>
+        </ion-label>
+        <ion-button slot="end" color="danger" (click)="confirmDeleteMemo(memo)">
+          删除
+        </ion-button>
+      </ion-item>
+    </ion-list>
+
+    <ion-item>
+      <ion-input placeholder="添加新备忘录" [(ngModel)]="newMemo"></ion-input>
+      <ion-button (click)="addMemo()">添加</ion-button>
+    </ion-item>
+  </div>
+</ion-content>

+ 88 - 28
src/app/memo/memo.page.ts

@@ -1,52 +1,115 @@
+// import { Component, OnInit } from '@angular/core';
+// import { AlertController } from '@ionic/angular';
+// @Component({
+//   selector: 'app-memo',
+//   templateUrl: './memo.page.html',
+//   styleUrls: ['./memo.page.scss'],
+// })
+// export class MemoPage implements OnInit {
+//   segment: string = 'memo';
+//   memos: string[] = [];
+//   newMemo: string = '';
+//   newMessage: string = '';
+//   constructor(private alertController: AlertController) {}
+//   ngOnInit() {
+//     this.loadMemos();
+//   }
+//   //加载备忘录
+//   loadMemos() {
+//     const memos = localStorage.getItem('memos');
+//     if (memos) {
+//       this.memos = JSON.parse(memos);
+//     }
+//   }
+//   //保存备忘录
+//   saveMemos() {
+//     localStorage.setItem('memos', JSON.stringify(this.memos));
+//   }
+//   //异步函数,添加备忘录
+//   async addMemo() {
+//     if (this.newMemo.trim().length > 0) {
+//       this.memos.push(this.newMemo);
+//       this.newMemo = '';
+//       this.saveMemos();
+//       const alert = await this.alertController.create({
+//         header: '提示',
+//         message: '添加成功',
+//         buttons: ['确定']
+//       });
+//       await alert.present();
+//     }
+//   }
+//   //异步函数,确认删除
+//   async confirmDeleteMemo(memo: string) {
+//     const alert = await this.alertController.create({
+//       header: '确认删除',
+//       message: `你确定要删除 "${memo}" 吗?`,
+//       buttons: [
+//         {
+//           text: '取消',
+//           role: 'cancel'
+//         },
+//         {
+//           text: '删除',
+//           handler: () => {
+//             this.memos = this.memos.filter(m => m !== memo);
+//             this.saveMemos();
+//           }
+//         }
+//       ]
+//     });
+//     await alert.present();
+//   }
+//   //删除备忘录
+//   deleteMemo(memo: string) {
+//     this.memos = this.memos.filter(m => m !== memo);
+//     this.saveMemos();
+//   }
+// }
+
+
 import { Component, OnInit } from '@angular/core';
 import { AlertController } from '@ionic/angular';
 
+interface Memo {
+  content: string;
+  timestamp: Date;
+}
 
 @Component({
   selector: 'app-memo',
   templateUrl: './memo.page.html',
   styleUrls: ['./memo.page.scss'],
 })
-
-
-
 export class MemoPage implements OnInit {
   segment: string = 'memo';
-  memos: string[] = [];
+  memos: Memo[] = [];
   newMemo: string = '';
-  newMessage: string = '';
+
   constructor(private alertController: AlertController) {}
 
   ngOnInit() {
     this.loadMemos();
   }
-  //加载备忘录
+
   loadMemos() {
     const memos = localStorage.getItem('memos');
     if (memos) {
       this.memos = JSON.parse(memos);
     }
   }
-  //保存备忘录
+
   saveMemos() {
     localStorage.setItem('memos', JSON.stringify(this.memos));
   }
 
-  //获取时间戳
-  getCurrentTimestamp(): string {
-    const now = new Date();
-    const year = now.getFullYear();
-    const month = (now.getMonth() + 1).toString().padStart(2, '0');
-    const day = now.getDate().toString().padStart(2, '0');
-    const hours = now.getHours().toString().padStart(2, '0');
-    const minutes = now.getMinutes().toString().padStart(2, '0');
-    return `${year}年${month}月${day}日${hours}:${minutes}`;
-  }
-
-  //异步函数,添加备忘录
   async addMemo() {
     if (this.newMemo.trim().length > 0) {
-      this.memos.push(this.newMemo);
+      const newMemoObj: Memo = {
+        content: this.newMemo,
+        timestamp: new Date(),
+      };
+      this.memos.push(newMemoObj);
       this.newMemo = '';
       this.saveMemos();
       const alert = await this.alertController.create({
@@ -57,11 +120,11 @@ export class MemoPage implements OnInit {
       await alert.present();
     }
   }
-  //异步函数,确认删除
-  async confirmDeleteMemo(memo: string) {
+
+  async confirmDeleteMemo(memo: Memo) {
     const alert = await this.alertController.create({
       header: '确认删除',
-      message: `你确定要删除 "${memo}" 吗?`,
+      message: `你确定要删除 "${memo.content}" 吗?`,
       buttons: [
         {
           text: '取消',
@@ -70,8 +133,7 @@ export class MemoPage implements OnInit {
         {
           text: '删除',
           handler: () => {
-            this.memos = this.memos.filter(m => m !== memo);
-            this.saveMemos();
+            this.deleteMemo(memo);
           }
         }
       ]
@@ -79,10 +141,8 @@ export class MemoPage implements OnInit {
     await alert.present();
   }
 
-  //删除备忘录
-  deleteMemo(memo: string) {
+  deleteMemo(memo: Memo) {
     this.memos = this.memos.filter(m => m !== memo);
     this.saveMemos();
   }
-
 }

+ 1 - 8
src/app/tab2/tab2.page.html

@@ -5,15 +5,11 @@
 </ion-header>
 
 <ion-content>
-  
-
   <ion-content>
     <ion-item>
       <ion-input placeholder="输入消息" [(ngModel)]="userInput"></ion-input>
     </ion-item>
-
     <ion-button expand="block" (click)="sendMessage()">发送</ion-button>
-
     <ion-card *ngFor="let message of messageList">
       <ion-card-header>
         {{message?.role}}
@@ -23,7 +19,4 @@
       </ion-card-content>
     </ion-card>
   </ion-content>
-
-
-
-</ion-content>
+</ion-content>

+ 1 - 9
src/app/tab2/tab2.page.ts

@@ -12,17 +12,9 @@ export class Tab2Page implements OnInit {
   newMessage: string = '';
   messageList:Array<TestChatMessage> = []
   userInput:string = ""
-
   completion:TestChatCompletion
-
   constructor(private alertController: AlertController) {this.completion = new TestChatCompletion(this.messageList)}
-
-
-  ngOnInit() {
-  
-  }
-  
-
+  ngOnInit() {}
   //ai对话
   sendMessage(){
     this.messageList.push({