yuebuzu-creater пре 3 месеци
родитељ
комит
a2499cf3cc

+ 0 - 0
wisdom-app/src/app/edit-rating-star/edit-rating-star.component.html → wisdom-app/src/app/component/edit-rating-star/edit-rating-star.component.html


+ 0 - 0
wisdom-app/src/app/edit-rating-star/edit-rating-star.component.scss → wisdom-app/src/app/component/edit-rating-star/edit-rating-star.component.scss


+ 0 - 0
wisdom-app/src/app/edit-rating-star/edit-rating-star.component.spec.ts → wisdom-app/src/app/component/edit-rating-star/edit-rating-star.component.spec.ts


+ 0 - 0
wisdom-app/src/app/edit-rating-star/edit-rating-star.component.ts → wisdom-app/src/app/component/edit-rating-star/edit-rating-star.component.ts


+ 0 - 0
wisdom-app/src/app/edit-tag/edit-tag.component.html → wisdom-app/src/app/component/edit-tag/edit-tag.component.html


+ 0 - 0
wisdom-app/src/app/edit-tag/edit-tag.component.scss → wisdom-app/src/app/component/edit-tag/edit-tag.component.scss


+ 0 - 0
wisdom-app/src/app/edit-tag/edit-tag.component.spec.ts → wisdom-app/src/app/component/edit-tag/edit-tag.component.spec.ts


+ 5 - 0
wisdom-app/src/app/edit-tag/edit-tag.component.ts → wisdom-app/src/app/component/edit-tag/edit-tag.component.ts

@@ -8,6 +8,7 @@ import { IonInput,IonButton, IonLabel, IonChip } from '@ionic/angular/standalone
   standalone: true,
   imports:[
     IonInput,IonButton,IonChip,IonLabel
+    
   ]
 })
 export class EditTagComponent  implements OnInit {
@@ -25,6 +26,10 @@ export class EditTagComponent  implements OnInit {
    */
   tags:Array<string> = [];
   addTag(){
+    // 如果标签为空,则不添加
+    if(this.userInput==""){
+      return;
+    }
     this.tags.push(this.userInput);
     this.userInput = "";
     this.onTagChange.emit(this.tags);

+ 36 - 0
wisdom-app/src/app/page-test/page-test.component.html

@@ -0,0 +1,36 @@
+
+<div>
+  <app-edit-tag (onTagChange)="setTagValue($event)"></app-edit-tag>
+  <ul>
+    @for(tag of editTags; track tag;){
+      <li>{{tag}}</li>
+    }
+  </ul>
+  <edit-rating-star 
+   [score]="currentScore" 
+    [scoreMax]="5" 
+   (onScoreChange)="handleScoreChange($event)">
+  </edit-rating-star>
+<span>当前分值:{{currentScore}}</span>
+
+<ion-list>
+  <ion-item>
+    <ion-label>请选择您的性别:</ion-label>
+    <!-- <ion-select [(ngModel)]="gender"> -->
+    <ion-select>
+      <ion-select-option value="male">男</ion-select-option>
+      <ion-select-option value="female">女</ion-select-option>
+    </ion-select>
+  </ion-item>
+  <ion-item>
+    <ion-textarea [value]="symptomDesc" (ionInput)="onInput($event)" label="请描述您的病情:" placeholder="具体描述您的病情,以便医生为您制定治疗方案" [autoGrow]="true"></ion-textarea>
+  </ion-item>
+  <ion-item>
+    <ion-button expand="block" color="primary" (click)="analyseSymptom()">分析病情</ion-button>
+  </ion-item>
+</ion-list>
+
+</div>
+
+
+  

+ 0 - 0
wisdom-app/src/app/page-test/page-test.component.scss


+ 22 - 0
wisdom-app/src/app/page-test/page-test.component.spec.ts

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

+ 60 - 0
wisdom-app/src/app/page-test/page-test.component.ts

@@ -0,0 +1,60 @@
+import { CommonModule } from '@angular/common';
+import { Component, OnInit } from '@angular/core';
+import { EditRatingStarComponent } from '../component/edit-rating-star/edit-rating-star.component';
+import { EditTagComponent } from '../component/edit-tag/edit-tag.component';
+import { IonButton, IonItem, IonLabel, IonList, IonSelect, IonSelectOption, IonTextarea } from '@ionic/angular/standalone';
+
+@Component({
+  selector: 'app-page-test',
+  templateUrl: './page-test.component.html',
+  styleUrls: ['./page-test.component.scss'],
+  standalone: true,
+  imports: [
+    CommonModule,EditTagComponent,EditRatingStarComponent,IonItem,IonTextarea,IonList,
+    IonSelect,IonSelectOption,IonLabel,IonButton
+  ]
+})
+export class PageTestComponent  implements OnInit {
+
+  constructor() { }
+
+    /**
+   * 星星打分
+   */
+    currentScore:number = 0; // 初始分值
+
+    handleScoreChange(newScore: number) {
+      this.currentScore = newScore;
+      console.log('新分值:', newScore); // 处理分值变化
+    }
+  
+    /**
+     * 标签编辑
+     */
+    editTags:Array<string> = []
+    setTagValue(ev:any){
+      console.log("setTagValue:",ev)
+      this.editTags = ev
+    }
+    
+    symptomDesc:string = ""
+    /**
+     * 记录病情
+     */
+    analyseSymptom(){
+      console.log("记录病情")
+      console.log("symptomDesc:",this.symptomDesc)
+      this.symptomDesc = ""
+    }
+    
+    /**
+     * 得到输入框内容
+     * @param ev 输入框内容
+     */
+    onInput(ev:any) {
+      this.symptomDesc = ev.detail.value;
+    }
+
+  ngOnInit() {}
+
+}

+ 13 - 26
wisdom-app/src/app/tab1/tab1.page.html

@@ -1,38 +1,25 @@
 <ion-header [translucent]="true">
   <ion-toolbar>
     <ion-title>
-      智养
+      智养人生
     </ion-title>
   </ion-toolbar>
 </ion-header>
 
 <ion-content [fullscreen]="true">
-  <div>
-    <ion-button
-    expand="block"
-    color="primary"
-    size="large"
-    (click)="goToPage()"
-    >
-    记录梦境
-    </ion-button>
-  </div>
-
-  <app-edit-tag (onTagChange)="setTagValue($event)"></app-edit-tag>
-  <h1>
-    <ul>
-      @for(tag of editTags; track tag;){
-        <li>{{tag}}</li>
-      }
-    </ul>
-  </h1>
+  <div class="inquery" style="margin-top: 10px">
+    <div class="inquery-ai">
+      <ion-button color="primary" size="large" (click)="goToPage()">
+        AI问诊
+      </ion-button>
+    </div>
+    <div class="inquery-human">
+      <ion-button color="primary" size="large" (click)="goToPage()">
+        AI问诊
+      </ion-button>
+    </div>
 
-  <edit-rating-star 
-    [score]="currentScore" 
-    [scoreMax]="5" 
-    (onScoreChange)="handleScoreChange($event)">
-  </edit-rating-star>
-  <span>{{currentScore}}</span>
+  </div>
 
   <app-explore-container name="智养3"></app-explore-container>
 </ion-content>

+ 27 - 0
wisdom-app/src/app/tab1/tab1.page.scss

@@ -0,0 +1,27 @@
+.inquery{
+    width:100%;
+    height:100px;
+    background-color: #f5f5f5;
+    padding: 0 0px;
+    box-sizing: border-box;
+    ion-button{
+        width: 100%;
+        height: 100%;
+        background-color: crimson;
+        display: inline-block;
+    }
+    .inquery-ai{
+        height: 100%;
+        width: 48%;
+        display: inline-block;
+        margin: 0;
+        padding: 0;
+    }
+    .inquery-human{
+        height: 100%;
+        width: 48%;
+        display: inline-block;
+        margin-left: 2%;
+        padding: 0;
+    }
+}

+ 7 - 22
wisdom-app/src/app/tab1/tab1.page.ts

@@ -3,8 +3,9 @@ import { IonHeader, IonToolbar, IonTitle, IonContent, IonTabButton } from '@ioni
 import { ExploreContainerComponent } from '../explore-container/explore-container.component';
 import { IonButton } from '@ionic/angular/standalone';
 import { IonIcon } from '@ionic/angular/standalone';
-import { EditTagComponent } from '../edit-tag/edit-tag.component';
-import { EditRatingStarComponent } from '../edit-rating-star/edit-rating-star.component';
+import { EditTagComponent } from '../component/edit-tag/edit-tag.component';
+import { EditRatingStarComponent } from '../component/edit-rating-star/edit-rating-star.component';
+import { Router } from '@angular/router';
 
 
 @Component({
@@ -14,33 +15,17 @@ import { EditRatingStarComponent } from '../edit-rating-star/edit-rating-star.co
   standalone: true,
   imports: [
     IonHeader, IonToolbar, IonTitle, IonContent, ExploreContainerComponent, IonTabButton, IonButton,
-    IonIcon,EditTagComponent,EditRatingStarComponent
+    IonIcon,
   ],
 })
 export class Tab1Page {
 
-  /**
-   * 星星打分
-   */
-  currentScore:number = 0; // 初始分值
-
-  handleScoreChange(newScore: number) {
-    this.currentScore = newScore;
-    console.log('新分值:', newScore); // 处理分值变化
-  }
+  constructor(private router: Router) {}
 
   /**
-   * 标签编辑
+   * Go to the page-test page
    */
-  editTags:Array<string> = []
-  setTagValue(ev:any){
-    console.log("setTagValue:",ev)
-    this.editTags = ev
-  }
-
   goToPage(){
-    alert('go to page');
+    this.router.navigate(['/tabs/page-test'])
   }
-
-  constructor() {}
 }

+ 5 - 0
wisdom-app/src/app/tabs/tabs.routes.ts

@@ -26,6 +26,11 @@ export const routes: Routes = [
         loadComponent: () =>
           import('../tab4/tab4.page').then((m) => m.Tab4Page),
       },
+      {
+        path: 'page-test',
+        loadComponent: () =>
+          import('../page-test/page-test.component').then((m) => m.PageTestComponent),
+      },
       {
         path: '',
         redirectTo: '/tabs/tab1',