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

feat(novel-app): 添加代理创建页面和测试页面

18460000105 3 hónapja
szülő
commit
b0a1fc73c8

+ 8 - 0
novel-app/src/app/app.routes.ts

@@ -63,6 +63,14 @@ export const routes: Routes = [
   {
     path: 'name-generator',
     loadComponent: () => import('./name-generator/name-generator.page').then(m => m.NameGeneratorPage)
+  },
+  {
+    path: 'agent-create',
+    loadComponent: () => import('./agent-create/agent-create.page').then( m => m.AgentCreatePage)
+  },
+  {
+    path: 'atest',
+    loadComponent: () => import('./atest/atest.page').then( m => m.AtestPage)
   }
 
 

+ 2 - 2
novel-app/src/app/story-generator/story-generator.page.ts

@@ -2,13 +2,13 @@ import { Component } from '@angular/core';
 import { IonicModule } from '@ionic/angular';
 import { FormsModule } from '@angular/forms';
 import { Router } from '@angular/router';
-
+import { CommonModule } from '@angular/common';
 @Component({
   selector: 'app-story-generator',
   templateUrl: './story-generator.page.html',
   styleUrls: ['./story-generator.page.scss'],
   standalone: true,
-  imports: [IonicModule, FormsModule],
+  imports: [IonicModule, FormsModule,CommonModule],
 })
 export class StoryGeneratorPage {
   title: string = '';

+ 8 - 5
novel-app/src/app/tab1/tab1.page.html

@@ -1,6 +1,8 @@
 
 <ion-content>
-
+  <ion-refresher slot="fixed" (ionRefresh)="handleRefresh($event)">
+    <ion-refresher-content></ion-refresher-content>
+  </ion-refresher>
 <div>
   <ion-card>
     <ion-card-header>
@@ -9,21 +11,22 @@
     </ion-card-header>
     <ion-card-content>
       <ion-list>
-        <ion-item (click)="openInquiry(doctor)"  *ngFor="let doctor of doctorList" lines="none">
-          <ion-thumbnail slot="start">
+        <ion-item   *ngFor="let doctor of doctorList" lines="none">
+          <ion-thumbnail slot="start" (click)="openInquiry(doctor)">
             <img [src]="doctor.get('avatar')" [alt]="doctor.get('name')" />
           </ion-thumbnail>
-          <div class="doctor-info">
+          <div class="doctor-info" (click)="openInquiry(doctor)">
             <h3>{{ doctor.get('name') }}({{ doctor.get('age') }}岁)</h3>
             <p>{{ doctor.get('Desc') }},{{ doctor.get('title') }},{{ doctor.get('depart')?.name }}</p>
            
           </div>
+          <ion-button ios="logo-apple" size="small" color="danger" (click)="deleteAgent(doctor)" slot="end">删除</ion-button>
         </ion-item>
       </ion-list>
     </ion-card-content>
   </ion-card>
 </div>
-<ion-fab vertical="bottom" horizontal="center" slot="fixed">
+<ion-fab vertical="bottom" horizontal="end" slot="fixed">
   <ion-fab-button (click)="navigateToPage()">
     <ion-icon name="add"></ion-icon>
   </ion-fab-button>

+ 16 - 3
novel-app/src/app/tab1/tab1.page.ts

@@ -13,6 +13,7 @@ import { add } from 'ionicons/icons';
 import { documentText, chatbubbles, person, calendar, newspaper,
    medkit,clipboard, podium, videocam, people } from 'ionicons/icons';
 import { CloudObject, CloudQuery } from '../lib/ncloud';
+import { IonRefresher, IonRefresherContent } from '@ionic/angular/standalone';
 addIcons({ documentText, chatbubbles, person, calendar, newspaper,
    medkit,clipboard, podium, videocam, people
  });
@@ -24,12 +25,19 @@ addIcons({ documentText, chatbubbles, person, calendar, newspaper,
   imports: [
     IonHeader, IonToolbar, IonTitle, IonContent, ExploreContainerComponent, IonTabButton, IonButton,
     IonIcon,IonSearchbar,IonLabel,IonItem,IonList,CommonModule,IonCard,IonCardHeader,IonCardTitle,IonCardSubtitle,
-    IonCardContent, IonThumbnail, IonFab,IonFabButton,IonIcon
+    IonCardContent, IonThumbnail, IonFab,IonFabButton,IonIcon,IonRefresher,IonRefresherContent
+
   ],
 })
 export class Tab1Page {
   
-
+  handleRefresh(event:any) {
+    setTimeout(() => {
+      // Any calls to load data go here
+      this.loadDoctorList()
+      event.target.complete();
+    }, 2000);
+  }
   constructor(
     private router: Router,
      private modalCtrl: ModalController,
@@ -41,7 +49,7 @@ export class Tab1Page {
     addIcons({ add });
   }
   navigateToPage() {
-    this.router.navigate(['/atest']); // 替换为目标页面的路由
+    this.router.navigate(['../agent-create']); // 替换为目标页面的路由
   }
   /**
    * Go to the ai page
@@ -129,4 +137,9 @@ export class Tab1Page {
     }
     openChatPanelModal(this.modalCtrl,options)
   }
+  deleteAgent(agent:CloudObject){
+    console.log("删除了",agent);
+    agent.destroy();
+    this.loadDoctorList()
+  }
 }