瀏覽代碼

contintiue fix : tab 2

yuebuzu-creater 2 月之前
父節點
當前提交
92dc604529

+ 1 - 0
.gitignore

@@ -1 +1,2 @@
 .DS_Store
+node_modules

+ 188 - 0
package-lock.json

@@ -0,0 +1,188 @@
+{
+  "name": "s202226701018",
+  "lockfileVersion": 3,
+  "requires": true,
+  "packages": {
+    "": {
+      "dependencies": {
+        "@angular/forms": "^19.0.4",
+        "@ionic/angular": "^8.4.1"
+      }
+    },
+    "node_modules/@angular/common": {
+      "version": "19.0.4",
+      "resolved": "https://registry.npmmirror.com/@angular/common/-/common-19.0.4.tgz",
+      "integrity": "sha512-SBWraO5NVZa/QJPrVbk3IsUmZQDriYBvqYuZFJaI/UTbhcAedNRsLDbKHtOYrHHx6K1saPXSQCufWgFo30lEqw==",
+      "license": "MIT",
+      "peer": true,
+      "dependencies": {
+        "tslib": "^2.3.0"
+      },
+      "engines": {
+        "node": "^18.19.1 || ^20.11.1 || >=22.0.0"
+      },
+      "peerDependencies": {
+        "@angular/core": "19.0.4",
+        "rxjs": "^6.5.3 || ^7.4.0"
+      }
+    },
+    "node_modules/@angular/core": {
+      "version": "19.0.4",
+      "resolved": "https://registry.npmmirror.com/@angular/core/-/core-19.0.4.tgz",
+      "integrity": "sha512-eoLixL8+03HpMIrmbL9lX+PAEw/fJSGshUH99IN9ZgCDEWeAlORg3U5RQEEh59ovelGfTn/sNaYhWsLVoBUIYQ==",
+      "license": "MIT",
+      "peer": true,
+      "dependencies": {
+        "tslib": "^2.3.0"
+      },
+      "engines": {
+        "node": "^18.19.1 || ^20.11.1 || >=22.0.0"
+      },
+      "peerDependencies": {
+        "rxjs": "^6.5.3 || ^7.4.0",
+        "zone.js": "~0.15.0"
+      }
+    },
+    "node_modules/@angular/forms": {
+      "version": "19.0.4",
+      "resolved": "https://registry.npmmirror.com/@angular/forms/-/forms-19.0.4.tgz",
+      "integrity": "sha512-smBCOjqCOMjHxRwwmImo58esSatGRsIxEaPytMezWWXqcD9pCZFzHskXA7218cJBRO8T9wuAf5AJFSqD4Yg72A==",
+      "license": "MIT",
+      "dependencies": {
+        "tslib": "^2.3.0"
+      },
+      "engines": {
+        "node": "^18.19.1 || ^20.11.1 || >=22.0.0"
+      },
+      "peerDependencies": {
+        "@angular/common": "19.0.4",
+        "@angular/core": "19.0.4",
+        "@angular/platform-browser": "19.0.4",
+        "rxjs": "^6.5.3 || ^7.4.0"
+      }
+    },
+    "node_modules/@angular/platform-browser": {
+      "version": "19.0.4",
+      "resolved": "https://registry.npmmirror.com/@angular/platform-browser/-/platform-browser-19.0.4.tgz",
+      "integrity": "sha512-/PRr7kLVVqNFqAkw+SK8RwqE479qCcUyuw6GOHtGabt3ZfQKSbx+pTioVrZFEy5pTBMslCPV5q3I+wGRG7/nyg==",
+      "license": "MIT",
+      "peer": true,
+      "dependencies": {
+        "tslib": "^2.3.0"
+      },
+      "engines": {
+        "node": "^18.19.1 || ^20.11.1 || >=22.0.0"
+      },
+      "peerDependencies": {
+        "@angular/animations": "19.0.4",
+        "@angular/common": "19.0.4",
+        "@angular/core": "19.0.4"
+      },
+      "peerDependenciesMeta": {
+        "@angular/animations": {
+          "optional": true
+        }
+      }
+    },
+    "node_modules/@angular/router": {
+      "version": "19.0.4",
+      "resolved": "https://registry.npmmirror.com/@angular/router/-/router-19.0.4.tgz",
+      "integrity": "sha512-GYab1nDwlSLGKr5kAOButbL2/ht7gsTmMKKZsiQTuPgi6YX6N/t5wLP5H0TbHm+hxV/NVRXcoMQUa8TjpeKN2A==",
+      "license": "MIT",
+      "peer": true,
+      "dependencies": {
+        "tslib": "^2.3.0"
+      },
+      "engines": {
+        "node": "^18.19.1 || ^20.11.1 || >=22.0.0"
+      },
+      "peerDependencies": {
+        "@angular/common": "19.0.4",
+        "@angular/core": "19.0.4",
+        "@angular/platform-browser": "19.0.4",
+        "rxjs": "^6.5.3 || ^7.4.0"
+      }
+    },
+    "node_modules/@ionic/angular": {
+      "version": "8.4.1",
+      "resolved": "https://registry.npmmirror.com/@ionic/angular/-/angular-8.4.1.tgz",
+      "integrity": "sha512-22ghlHeIJjHDizns/huYp1sQ3Y9qYyUY9hEueIB0e8jsNhCOwhRijMIoOCZ/sfMKTbNaKX7EJ25NpVetF7mZXQ==",
+      "license": "MIT",
+      "dependencies": {
+        "@ionic/core": "8.4.1",
+        "ionicons": "^7.0.0",
+        "jsonc-parser": "^3.0.0",
+        "tslib": "^2.3.0"
+      },
+      "peerDependencies": {
+        "@angular/core": ">=16.0.0",
+        "@angular/forms": ">=16.0.0",
+        "@angular/router": ">=16.0.0",
+        "rxjs": ">=7.5.0",
+        "zone.js": ">=0.13.0"
+      }
+    },
+    "node_modules/@ionic/core": {
+      "version": "8.4.1",
+      "resolved": "https://registry.npmmirror.com/@ionic/core/-/core-8.4.1.tgz",
+      "integrity": "sha512-D5xpw5TF2wldpAWE0rHq3L+5T79EjR6d++QFpprjp+q+cFjjhOnfGD+2k7gLlWepAod9LUUigeL0JF02C2wgRQ==",
+      "license": "MIT",
+      "dependencies": {
+        "@stencil/core": "4.20.0",
+        "ionicons": "^7.2.2",
+        "tslib": "^2.1.0"
+      }
+    },
+    "node_modules/@stencil/core": {
+      "version": "4.20.0",
+      "resolved": "https://registry.npmmirror.com/@stencil/core/-/core-4.20.0.tgz",
+      "integrity": "sha512-WPrTHFngvN081RY+dJPneKQLwnOFD60OMCOQGmmSHfCW0f4ujPMzzhwWU1gcSwXPWXz5O+8cBiiCaxAbJU7kAg==",
+      "license": "MIT",
+      "bin": {
+        "stencil": "bin/stencil"
+      },
+      "engines": {
+        "node": ">=16.0.0",
+        "npm": ">=7.10.0"
+      }
+    },
+    "node_modules/ionicons": {
+      "version": "7.4.0",
+      "resolved": "https://registry.npmmirror.com/ionicons/-/ionicons-7.4.0.tgz",
+      "integrity": "sha512-ZK94MMqgzMCPPMhmk8Ouu6goyVHFIlw/ACP6oe3FrikcI0N7CX0xcwVaEbUc0G/v3W0shI93vo+9ve/KpvcNhQ==",
+      "license": "MIT",
+      "dependencies": {
+        "@stencil/core": "^4.0.3"
+      }
+    },
+    "node_modules/jsonc-parser": {
+      "version": "3.3.1",
+      "resolved": "https://registry.npmmirror.com/jsonc-parser/-/jsonc-parser-3.3.1.tgz",
+      "integrity": "sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ==",
+      "license": "MIT"
+    },
+    "node_modules/rxjs": {
+      "version": "7.8.1",
+      "resolved": "https://registry.npmmirror.com/rxjs/-/rxjs-7.8.1.tgz",
+      "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==",
+      "license": "Apache-2.0",
+      "peer": true,
+      "dependencies": {
+        "tslib": "^2.1.0"
+      }
+    },
+    "node_modules/tslib": {
+      "version": "2.8.1",
+      "resolved": "https://registry.npmmirror.com/tslib/-/tslib-2.8.1.tgz",
+      "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
+      "license": "0BSD"
+    },
+    "node_modules/zone.js": {
+      "version": "0.15.0",
+      "resolved": "https://registry.npmmirror.com/zone.js/-/zone.js-0.15.0.tgz",
+      "integrity": "sha512-9oxn0IIjbCZkJ67L+LkhYWRyAy7axphb3VgE2MBDlOqnmHMPWGYMxJxBYFueFq/JGY2GMwS0rU+UCLunEmy5UA==",
+      "license": "MIT",
+      "peer": true
+    }
+  }
+}

+ 6 - 0
package.json

@@ -0,0 +1,6 @@
+{
+  "dependencies": {
+    "@angular/forms": "^19.0.4",
+    "@ionic/angular": "^8.4.1"
+  }
+}

+ 4 - 1
wisdom-app/src/app/app.component.ts

@@ -1,11 +1,14 @@
 import { Component } from '@angular/core';
 import { IonApp, IonRouterOutlet } from '@ionic/angular/standalone';
+import { FormsModule } from '@angular/forms';
 
 @Component({
   selector: 'app-root',
   templateUrl: 'app.component.html',
   standalone: true,
-  imports: [IonApp, IonRouterOutlet],
+  imports: [
+    IonApp, IonRouterOutlet,FormsModule
+  ],
 })
 export class AppComponent {
   constructor() {}

+ 38 - 0
wisdom-app/src/app/component/navigation-lan/navigation-lan.component.html

@@ -0,0 +1,38 @@
+<ion-card>
+  <ion-card-header>
+    <ion-card-title>
+      <ion-segment [scrollable]="true" value="hotdot" [value]="type" (ionChange)="typeChange($event)">
+        <ion-segment-button value="hotdot" content-id="hotdot">
+          <ion-label>热点</ion-label>
+        </ion-segment-button>
+        <ion-segment-button value="export" content-id="export">
+          <ion-label>专家科普</ion-label>
+        </ion-segment-button>
+        <ion-segment-button value="sleep" content-id="sleep">
+          <ion-label>睡眠</ion-label>
+        </ion-segment-button>
+        <ion-segment-button value="life" content-id="life">
+          <ion-label>生活</ion-label>
+        </ion-segment-button>
+        <ion-segment-button value="male" content-id="male">
+          <ion-label>男性</ion-label>
+        </ion-segment-button>
+        <ion-segment-button value="female" content-id="female">
+          <ion-label>女性</ion-label>
+        </ion-segment-button>
+      </ion-segment>
+    </ion-card-title>
+    <!-- <ion-card-subtitle>请输入账号密码</ion-card-subtitle> -->
+  </ion-card-header>
+
+  <ion-card-content>
+    <ion-segment-view>
+      <ion-segment-content id="hotdot">First</ion-segment-content>
+      <ion-segment-content id="export">Second</ion-segment-content>
+      <ion-segment-content id="sleep">Third</ion-segment-content>
+      <ion-segment-content id="sleep">life</ion-segment-content>
+      <ion-segment-content id="sleep">male</ion-segment-content>
+      <ion-segment-content id="sleep">female</ion-segment-content>
+    </ion-segment-view>
+  </ion-card-content>
+</ion-card>

+ 37 - 0
wisdom-app/src/app/component/navigation-lan/navigation-lan.component.scss

@@ -0,0 +1,37 @@
+    ion-card {
+        width: 100%;
+        height: 100%;
+        margin: 0;
+        padding: 0;
+        border-radius: 0;
+        box-shadow: none;
+    }
+    ion-card-header {
+        font-size: 1.5em;
+        height: 200px;
+    }
+
+    ion-card-content {
+        font-size: 1.2em;
+        height: 100px;
+        width: 100%;
+    }
+    
+    ion-segment-view {
+        // height: 150px;
+        height: 100%;
+    }
+    ion-segment-content {
+        display: flex;
+        align-items: center;
+        justify-content: center;
+    }
+    ion-segment-content:nth-of-type(1) {
+        background: lightpink;
+    }
+    ion-segment-content:nth-of-type(2) {
+        background: lightblue;
+    }
+    ion-segment-content:nth-of-type(3) {
+        background: lightgreen;
+    }

+ 22 - 0
wisdom-app/src/app/component/navigation-lan/navigation-lan.component.spec.ts

@@ -0,0 +1,22 @@
+import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
+
+import { NavigationLanComponent } from './navigation-lan.component';
+
+describe('NavigationLanComponent', () => {
+  let component: NavigationLanComponent;
+  let fixture: ComponentFixture<NavigationLanComponent>;
+
+  beforeEach(waitForAsync(() => {
+    TestBed.configureTestingModule({
+      imports: [NavigationLanComponent],
+    }).compileComponents();
+
+    fixture = TestBed.createComponent(NavigationLanComponent);
+    component = fixture.componentInstance;
+    fixture.detectChanges();
+  }));
+
+  it('should create', () => {
+    expect(component).toBeTruthy();
+  });
+});

+ 27 - 0
wisdom-app/src/app/component/navigation-lan/navigation-lan.component.ts

@@ -0,0 +1,27 @@
+import { Input, OnInit } from '@angular/core';
+import { Component } from '@angular/core';
+import { IonHeader, IonToolbar, IonTitle, IonContent, IonCard, IonCardContent, IonButton, IonCardHeader, IonCardTitle, IonCardSubtitle, ModalController, IonInput, IonItem, IonSegment, IonSegmentButton, IonLabel, IonSegmentContent, IonSegmentView } from '@ionic/angular/standalone';
+import { CloudUser } from 'src/lib/ncloud';
+import { ArticleCardComponent } from '../article-card/article-card.component';
+
+@Component({
+  selector: 'app-navigation-lan',
+  templateUrl: './navigation-lan.component.html',
+  styleUrls: ['./navigation-lan.component.scss'],
+  standalone: true,
+    imports: [IonHeader, IonToolbar, IonTitle, IonContent, 
+      IonCard,IonCardContent,IonButton,IonCardHeader,IonCardTitle,IonCardSubtitle,
+      IonInput,IonItem,
+      IonSegment,IonSegmentButton,IonLabel,
+      ArticleCardComponent,IonSegmentContent,IonSegmentView
+    ],
+})
+export class NavigationLanComponent  implements OnInit {
+
+  type:"hotdot"|"export"|"sleep"|"lift"|"male"|"female" = "hotdot"
+  typeChange(ev:any){
+    this.type = ev?.detail?.value || ev?.value || 'hotdot'
+  }
+  constructor() { }
+  ngOnInit() {}
+}

+ 22 - 1
wisdom-app/src/app/page/page-inquiry/page-inquiry.component.html

@@ -65,5 +65,26 @@
       <h2>{{shareData.diagResult.desc}}</h2>
       <p>{{shareData.diagResult.content}}</p>
     }
-  
+    <div>
+      <ion-card>
+        <ion-card-header>
+          <ion-card-title>权威医生</ion-card-title>
+          <ion-card-subtitle>医生简介</ion-card-subtitle>
+        </ion-card-header>
+        <ion-card-content>
+          <ion-list>
+            <ion-item (click)="openInquiry(doctor)" *ngFor="let doctor of doctorList" lines="none">
+              <ion-thumbnail slot="start">
+                <img [src]="doctor.get('avatar') || '../../assets/image/doctor7.png'" [alt]="doctor.get('name')" />
+              </ion-thumbnail>
+              <div class="doctor-info">
+                <h3>{{ doctor.get('name') }}({{ doctor.get('age') }}岁)</h3>
+                <p>{{ doctor.get('title') }},{{ doctor.get('depart')?.name }}</p>
+                <p>飞码互联网医院</p>
+              </div>
+            </ion-item>
+          </ion-list>
+        </ion-card-content>
+      </ion-card>
+    </div>
 </ion-content>

+ 125 - 5
wisdom-app/src/app/page/page-inquiry/page-inquiry.component.ts

@@ -1,19 +1,21 @@
 import { Component,OnInit } from '@angular/core';
-import { IonHeader, IonToolbar, IonTitle, IonContent, IonButton,IonIcon, ModalController, IonTextarea, IonInput } from '@ionic/angular/standalone';
+import { IonHeader, IonToolbar, IonTitle, IonContent, IonButton,IonIcon, ModalController, IonTextarea, IonInput, IonCard, IonCardHeader, IonCardTitle, IonThumbnail, IonCardContent, IonCardSubtitle, IonItem, IonList } from '@ionic/angular/standalone';
 import { AgentTaskStep } from 'src/agent/agent.task';
 import { addIcons } from 'ionicons';
 import { radioButtonOffOutline, reloadOutline, checkmarkCircleOutline, closeCircleOutline } from 'ionicons/icons';
 import { TaskExecutor } from 'src/agent/agent.start';
 import { AgentUserInputComponent } from 'src/agent/agent-user-input/agent-user-input.component';
-import { FmodeChatCompletion, ImagineWork, DalleOptions } from "fmode-ng";
+import { FmodeChatCompletion, ImagineWork, DalleOptions, openChatPanelModal, FmodeChat, FmodeChatMessage, ChatPanelOptions } from "fmode-ng";
 import { TaskPoemPictureDesc } from 'src/agent/tasks/poem/poem-desc';
 import { TaskPoemPictureCreate } from 'src/agent/tasks/poem/poem-picture';
-import { DecimalPipe } from '@angular/common';
+import { CommonModule, DecimalPipe } from '@angular/common';
 import { TaskInqueryUserStory } from 'src/agent/tasks/inquiry/1.inquiry-user-story';
 import { extactAndParseJsonFromString } from 'src/agent/agent.json';
 import { TaskInqueryDoctorQuestion } from 'src/agent/tasks/inquiry/2.inquiry-doctor-question';
 import { TaskInqueryUserAnswer } from 'src/agent/tasks/inquiry/3.inquiry-user-answer';
 import { Router } from '@angular/router';
+import { CloudObject, CloudQuery, CloudUser } from 'src/lib/ncloud';
+import { openUserLoginModal } from 'src/lib/user/modal-user-login/modal-user-login.component';
 addIcons({radioButtonOffOutline,reloadOutline,checkmarkCircleOutline,closeCircleOutline})
 
 @Component({
@@ -23,10 +25,24 @@ addIcons({radioButtonOffOutline,reloadOutline,checkmarkCircleOutline,closeCircle
   standalone: true,
   imports: [
     IonHeader, IonToolbar, IonTitle, IonContent, IonButton,IonTextarea,IonInput,
-    IonIcon,AgentUserInputComponent,DecimalPipe
+    IonIcon,AgentUserInputComponent,DecimalPipe,IonCard,IonCardHeader,IonCardTitle,
+    IonCardSubtitle,IonCardContent, IonThumbnail, IonItem,IonList,CommonModule
   ],
 })
 export class PageInquiryComponent  implements OnInit {
+
+  ngOnInit(){
+    this.loadDoctorList();
+  }
+
+  doctorList:Array<CloudObject> = []
+  async loadDoctorList(){
+    let query = new CloudQuery("Doctor");
+    query.include("depart")
+    this.doctorList = await query.find()
+    console.log(this.doctorList)
+  }
+
   constructor(
     private modalCtrl:ModalController,
     private router:Router
@@ -50,7 +66,7 @@ export class PageInquiryComponent  implements OnInit {
 
   shareData:any = {}
 
-  ngOnInit(){}
+
   doInqueryTask(){
     let task1 = TaskInqueryUserStory({shareData:this.shareData,modalCtrl:this.modalCtrl});
     let task2 = TaskInqueryDoctorQuestion({shareData:this.shareData,modalCtrl:this.modalCtrl});
@@ -106,4 +122,108 @@ export class PageInquiryComponent  implements OnInit {
   //     }
   //   })
   // }
+
+  /** 示例:问诊根据doctor拼接提示词 */
+     async openInquiry(doctor:CloudObject){
+      // 验证用户登录
+      let currentUser = new CloudUser();
+      let userPrompt = ``
+      if(!currentUser?.id){
+        console.log("用户未登录,请登录后重试");
+        let user = await openUserLoginModal(this.modalCtrl);
+        if(!user?.id){
+          return
+        }
+        currentUser = user;
+      }
+      
+      if(currentUser?.get("realname")){
+        userPrompt += `当前来访的患者,姓名:${currentUser?.get("realname")}`
+      }
+      if(currentUser?.get("gender")){
+        userPrompt += `,性别:${currentUser?.get("gender")}`
+      }
+      if(currentUser?.get("age")){
+        userPrompt += `,年龄:${currentUser?.get("age")}`
+      }
+  
+  
+      localStorage.setItem("company","E4KpGvTEto")
+  
+      let consult = new CloudObject("Consultation")
+      let now = new Date();
+      let dateStr = `${now.getFullYear()}-${now.getMonth()+1}-${now.getDate()}`
+      // 对象权限的精确指定
+      let ACL:any = {
+        "*":{read:false,write:false}
+      }
+      if(currentUser?.id){
+        ACL[currentUser?.id] = {read:true,write:true}
+      }
+      consult.set({
+        title:`${doctor.get('depart')?.name || ""}门诊记录${dateStr}-${doctor?.get("name")}`,
+        doctor:doctor.toPointer(),
+        depart:{
+          __type:"Pointer",
+          className:"Department",
+          objectId:doctor.get("depart")?.objectId
+        },
+        user:currentUser.toPointer(),
+        ACL:ACL
+      })
+  
+      let options:ChatPanelOptions = {
+        roleId:"2DXJkRsjXK",
+        onChatInit:(chat:FmodeChat)=>{
+          console.log("onChatInit");
+                console.log("预设角色",chat.role);
+                chat.role.set("name",doctor?.get("name"));
+                chat.role.set("title",doctor?.get("title"));
+                chat.role.set("desc",doctor?.get("desc"));
+                chat.role.set("tags",doctor?.get("qualifications"));
+                chat.role.set("avatar",doctor?.get("avatar") || "../../assets/image/doctor7.png")
+                chat.role.set("prompt",`
+  # 角色设定
+  您是${doctor?.get("name")},${doctor?.get("desc")},年龄${doctor?.get("age")}岁,需要完成一次完整的门诊服务。
+  
+  # 对话环节
+  0.导诊(根据用户基本情况,引导挂号合适的科室)
+  1.预设的问询方式(根据不同症状来问询具体的情况)
+  - 打招呼,以用户自述为主
+  - 当信息充足时候,确认用户症状对应的科室,并进入下一个环节
+  2.拓展的问询细节
+  例如:用户反映呼吸不畅,拓展出:是否咳嗽;是否感觉痛或者痒等其他需要的问题。
+  - 当问询细节补充完成后进入下一个环节
+  3.初步的诊断结果,并且同时列出检查检验项目
+  初步诊断:确定需要有哪些进一步检查
+  检查检验:获取医学客观数据
+  - 等待用户提交客观数据,进入下一阶段
+  4.给出诊断方案并给出处方
+  - 完成处方时,请在消息结尾附带: [处方完成]
+  
+  # 开始话语
+  当您准备好了,可以以一个医生的身份,向来访的用户打招呼。
+  ${userPrompt}
+  `);
+        },
+        onMessage:(chat:FmodeChat,message:FmodeChatMessage)=>{
+          console.log("onMessage",message)
+          let content:any = message?.content
+          if(typeof content == "string"){
+            if(content?.indexOf("[处方完成]")>-1){
+              console.log("门诊已完成")
+              consult.set({
+                content:content // 处方内容
+              })
+              consult.save();
+            }
+          }
+        },
+        onChatSaved:(chat:FmodeChat)=>{
+          // chat?.chatSession?.id 本次会话的 chatId
+          console.log("onChatSaved",chat,chat?.chatSession,chat?.chatSession?.id)
+        }
+      }
+      openChatPanelModal(this.modalCtrl,options)
+    }
 }

+ 3 - 4
wisdom-app/src/app/tab1/tab1.page.html

@@ -90,7 +90,7 @@
   </div>
 </div>
 
-<div>
+<!-- <div>
   <ion-card>
     <ion-card-header>
       <ion-card-title>权威医生</ion-card-title>
@@ -111,13 +111,12 @@
       </ion-list>
     </ion-card-content>
   </ion-card>
-</div>
-
+</div> -->
 
 <div>
   <ion-card>
     <ion-card-header>
-      <ion-card-title>其他医生</ion-card-title>
+      <ion-card-title>权威医生</ion-card-title>
       <ion-card-subtitle>医生简介</ion-card-subtitle>
     </ion-card-header>
     <ion-card-content>

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

@@ -228,7 +228,7 @@ export class Tab1Page {
               chat.role.set("title",doctor?.get("title"));
               chat.role.set("desc",doctor?.get("desc"));
               chat.role.set("tags",doctor?.get("qualifications"));
-              chat.role.set("avatar",doctor?.get("avatar") || "../../assets/image/doctor5.png")
+              chat.role.set("avatar",doctor?.get("avatar") || "../../assets/image/doctor7.png")
               chat.role.set("prompt",`
 # 角色设定
 您是${doctor?.get("name")},${doctor?.get("desc")},年龄${doctor?.get("age")}岁,需要完成一次完整的门诊服务。

+ 56 - 24
wisdom-app/src/app/tab2/tab2.page.html

@@ -1,7 +1,7 @@
 <ion-header [translucent]="true">
   <ion-toolbar>
     <ion-title>
-      Tab 2
+      健康科普
     </ion-title>
   </ion-toolbar>
 </ion-header>
@@ -10,32 +10,64 @@
   <div class="search-bar">
     <input type="text" placeholder="输入关键词搜索科普文章">
   </div>
+  <div class="content">
+    <ion-card>
+      <ion-card-header>
+        <ion-card-title>
+          <ion-segment [scrollable]="true" value="hotdot" [value]="type" (ionChange)="typeChange($event)">
+            <ion-segment-button value="hotdot" content-id="hotdot">
+              <ion-label>热点</ion-label>
+            </ion-segment-button>
+            <ion-segment-button value="export" content-id="export">
+              <ion-label>专家科普</ion-label>
+            </ion-segment-button>
+            <ion-segment-button value="sleep" content-id="sleep">
+              <ion-label>睡眠</ion-label>
+            </ion-segment-button>
+            <ion-segment-button value="life" content-id="life">
+              <ion-label>生活</ion-label>
+            </ion-segment-button>
+            <ion-segment-button value="male" content-id="male">
+              <ion-label>男性</ion-label>
+            </ion-segment-button>
+            <ion-segment-button value="female" content-id="female">
+              <ion-label>女性</ion-label>
+            </ion-segment-button>
+          </ion-segment>
+        </ion-card-title>
+        <!-- <ion-card-subtitle>请输入账号密码</ion-card-subtitle> -->
+      </ion-card-header>
+    
+      <ion-card-content>
+        <ion-segment-view>
+          <ion-segment-content id="hotdot">
+            <app-article-card *ngFor="let card of cards" [card]="card"></app-article-card>
+          </ion-segment-content>
 
+          <ion-segment-content id="export">
+            <app-article-card *ngFor="let card of cards" [card]="card"></app-article-card>
+          </ion-segment-content>
+
+          <ion-segment-content id="sleep">
+            <app-article-card *ngFor="let card of cards" [card]="card"></app-article-card>
+          </ion-segment-content>
+          
+          <ion-segment-content id="life">
+            <app-article-card *ngFor="let card of cards" [card]="card"></app-article-card>
+          </ion-segment-content>
+          <ion-segment-content id="male">
+            <app-article-card *ngFor="let card of cards" [card]="card"></app-article-card>
+          </ion-segment-content>
+          <ion-segment-content id="female">
+            <app-article-card *ngFor="let card of cards" [card]="card"></app-article-card>
+          </ion-segment-content>
+        </ion-segment-view>
+      </ion-card-content>
+    </ion-card>
+  </div>
 
-<div class="tabs">
-    <ion-button (click)="changeTab0()" fill="clear">
-      <span class="tab active">热点</span>
-    </ion-button>
-    <ion-button (click)="changeTab1()" fill="clear">
-      <span class="tab">专家科普</span>
-    </ion-button>
-    <ion-button (click)="changeTab2()" fill="clear">
-      <span class="tab">睡眠</span>
-    </ion-button>
-    <ion-button (click)="changeTab3()" fill="clear">
-      <span class="tab">生活</span>
-    </ion-button>
-    <ion-button (click)="changeTab4()" fill="clear">
-      <span class="tab">男性</span>
-    </ion-button>
-    <ion-button (click)="changeTab5()" fill="clear">
-      <span class="tab">女性</span>
-    </ion-button>
-    <span class="tab1">&#9660;</span>
-  </div> 
-  
   <div class="knowledge-cards">
-      <app-article-card *ngFor="let card of cards" [card]="card"></app-article-card>
+      
   </div>
 
 </ion-content>

+ 84 - 17
wisdom-app/src/app/tab2/tab2.page.scss

@@ -9,29 +9,96 @@
   border: 1px solid #ccc;
   border-radius: 4px;
 }
-  
-.tabs {
-  display: flex;
-  justify-content: space-around;
-  padding: 0px 0;
-  background-color: #f8f8f8;
+.content {
+  margin-top: -10px;
+  height: 100%;
+  width: 100%;
+}
+
+ion-card {
+  width: 100%;
+  height: 100%;
+  margin: 0;
+  padding: 0;
+  border-radius: 0;
+  box-shadow: none;
+}
+ion-card-header {
+  font-size: 1.5em;
+  height: auto;
 }
 
-.tabs ion-button {
+ion-card-content {
+  font-size: 1.2em;
+  width: 100%;
+  height: auto;
+}
+
+ion-segment-view {
+  height: auto;
+  width: 100%;
+}
 
-  flex: 1;
-  text-align: center;
-  border: none;
-  background-color: rgb(195, 195, 194);
-  color: #333;
+ion-segment-content {
+  // display: flex;
+  align-items: center;
+  justify-content: center;
 }
 
-.tab {
-  cursor: pointer;
-  color: red;
-  padding: 0px 0px;
-  // background-color: rgb(235, 238, 65);
+ion-segment-content:nth-of-type(5) {
+  background: lightpink;
 }
+ion-segment-content:nth-of-type(2) {
+  background: lightblue;
+}
+ion-segment-content:nth-of-type(3) {
+  background: lightgreen;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+// .tabs {
+//   display: flex;
+//   justify-content: space-around;
+//   padding: 0px 0;
+//   background-color: #f8f8f8;
+// }
+
+// .tabs ion-button {
+//   flex: 1;
+//   text-align: center;
+//   // border: none;
+//   --background: transparent;
+//   --color-checked: #4caf50;
+//   --indicator-color: #4caf50;
+//   --color: #666;
+//   --color-focused: #4caf50;
+//   --color-hover: #4caf50;
+//   --color-activated: #4caf50;
+//   --color-selected: #4caf50;
+// }
 
+// .tab {
+//   cursor: pointer;
+//   padding: 0px 0px;
+// }
+// .tab.active {
+//   color: rgb(81, 255, 0);
+//   background-color: rgb(255, 255, 255);
+// }
 
 //

+ 20 - 37
wisdom-app/src/app/tab2/tab2.page.ts

@@ -1,12 +1,14 @@
-import { Component } from '@angular/core';
-import { IonHeader, IonToolbar, IonTitle, IonContent, IonList, IonItem, IonLabel, IonAvatar, IonButton } from '@ionic/angular/standalone';
+import { Component, NgModule } from '@angular/core';
+import { IonHeader, IonToolbar, IonTitle, IonContent, IonList, IonItem, IonLabel, IonAvatar, IonButton, IonSegment, IonSegmentButton, IonSegmentContent, IonSegmentView, IonCardContent, IonCardTitle, IonCardHeader, IonCard } from '@ionic/angular/standalone';
 import { ExploreContainerComponent } from '../explore-container/explore-container.component';
 import { addIcons } from 'ionicons';
 import { airplane, bluetooth, call, wifi } from 'ionicons/icons';
-import { ModalController } from '@ionic/angular';
+import { IonicModule, ModalController } from '@ionic/angular';
 import { ArticleCardComponent } from '../component/article-card/article-card.component';
 import { CommonModule } from '@angular/common';
 import { CloudObject, CloudQuery } from 'src/lib/ncloud';
+import { FormsModule } from '@angular/forms';
+import { NavigationLanComponent } from '../component/navigation-lan/navigation-lan.component';
 addIcons({ airplane, bluetooth, call, wifi });
 
 interface Article {
@@ -25,60 +27,41 @@ interface Article {
   standalone: true,
   imports: [IonHeader, IonToolbar, IonTitle, IonContent, ExploreContainerComponent,
     IonLabel,IonItem,IonList,IonAvatar,ArticleCardComponent,CommonModule,IonButton,
+    IonSegment, IonSegmentButton,NavigationLanComponent,
+    IonSegmentContent,IonSegmentView,IonCardContent, IonCardTitle, IonCardHeader,IonCard
   ]
 })
 
 export class Tab2Page {
-  constructor() {
-  }
-  hotDot: Number = 0;
-  changeTab0() {
-    this.hotDot = 0;
-    this.loadCards();
-  }
-  changeTab1() {
-    this.hotDot = 1;
-    this.loadCards();
-  }
-  changeTab2() {
-    this.hotDot = 2;
-    this.loadCards();
-  }
-  changeTab3() {
-    this.hotDot = 3;
-    this.loadCards();
-  }
-  changeTab4() {
-    this.hotDot = 4;
-    this.loadCards();
-  }
-  changeTab5() {
-    this.hotDot = 5;
-    this.loadCards();
-  }
 
+  type:"hotdot"|"export"|"sleep"|"lift"|"male"|"female" = "hotdot"
+  typeChange(ev:any){
+    this.type = ev?.detail?.value || ev?.value || 'hotdot'
+    console.log(this.type)
+  }
+  // constructor(private modalCtrl:ModalController) { }
+  constructor() { }
   cards: Array<CloudObject> = [];
   async loadCards() {
     let query = new CloudQuery('HotDot');
-    query.equalTo('category', 'HotDot');
+    // query.equalTo('category', 'HotDot');
     // query.greaterThan('views', 1000); // 查询 views 大于 1000 的文章
-    if (this.hotDot == 1) {
+    if (this.type == 'hotdot') {
 
     }
-    if (this.hotDot == 2) {
+    if (this.type == 'hotdot') {
 
     }
-    if (this.hotDot == 3) {
+    if (this.type == 'hotdot') {
 
     }
-    if (this.hotDot == 4) {
+    if (this.type == 'male') {
       query.equalTo('category', 'MaleHealth')
     }
-    if (this.hotDot == 5) {
+    if (this.type == 'female') {
       query.equalTo("category", "FemaleHealth")
     }
     // query.greaterThan('views', 1000); // 查询 views 大于 1000 的文章
-    
     this.cards = await query.find();
     console.log(this.cards);
   }

+ 29 - 31
wisdom-app/src/lib/user/modal-user-login/modal-user-login.component.html

@@ -1,38 +1,36 @@
 <!-- 用户登录状态 -->
 <ion-card>
-     <ion-card-header>
-       <ion-card-title>
-        <ion-segment [value]="type" (ionChange)="typeChange($event)">
-          <ion-segment-button value="login">
-            <ion-label>登录</ion-label>
-          </ion-segment-button>
-          <ion-segment-button value="signup">
-            <ion-label>注册</ion-label>
-          </ion-segment-button>
-        </ion-segment>
-       </ion-card-title>
-       <ion-card-subtitle>请输入账号密码</ion-card-subtitle>
-      </ion-card-header>
-    <ion-card-content>
+  <ion-card-header>
+    <ion-card-title>
+      <ion-segment [value]="type" (ionChange)="typeChange($event)">
+        <ion-segment-button value="login">
+          <ion-label>登录</ion-label>
+        </ion-segment-button>
+        <ion-segment-button value="signup">
+          <ion-label>注册</ion-label>
+        </ion-segment-button>
+      </ion-segment>
+    </ion-card-title>
+    <ion-card-subtitle>请输入账号密码</ion-card-subtitle>
+  </ion-card-header>
+  <ion-card-content>
+    <ion-item>
+      <ion-input [value]="username" (ionChange)="usernameChange($event)" label="账号" placeholder="请您输入账号/手机号"></ion-input>
+    </ion-item>
+    <ion-item>
+      <ion-input [value]="password" (ionChange)="passwordChange($event)" label="密码" type="password" value="password"></ion-input>
+    </ion-item>
 
+    @if(type=="signup"){
       <ion-item>
-        <ion-input [value]="username" (ionChange)="usernameChange($event)" label="账号" placeholder="请您输入账号/手机号"></ion-input>
+        <ion-input [value]="password2" (ionChange)="password2Change($event)" label="密码二次" type="password" value="password"></ion-input>
       </ion-item>
-      <ion-item>
-        <ion-input [value]="password" (ionChange)="passwordChange($event)" label="密码" type="password" value="password"></ion-input>
-      </ion-item>
-      @if(type=="signup"){
-        <ion-item>
-          <ion-input [value]="password2" (ionChange)="password2Change($event)" label="密码二次" type="password" value="password"></ion-input>
-        </ion-item>
-      }
-    
-      @if(type=="login"){
-        <ion-button expand="block" (click)="login()">登录</ion-button>
-      }
-      @if(type=="signup"){
-        <ion-button expand="block" (click)="signup()">注册</ion-button>
-      }
-
+    }
+    @if(type=="login"){
+      <ion-button expand="block" (click)="login()">登录</ion-button>
+    }
+    @if(type=="signup"){
+      <ion-button expand="block" (click)="signup()">注册</ion-button>
+    }
   </ion-card-content>
 </ion-card>