cainiao-hue 4 сар өмнө
parent
commit
2ecb4057c8

+ 4 - 1
soul-app/angular.json

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

+ 2 - 2
soul-app/src/app/app.routes.ts

@@ -1,8 +1,8 @@
 import { Routes } from '@angular/router';
 
 export const routes: Routes = [
-  {
+    {
     path: '',
     loadChildren: () => import('./tabs/tabs.routes').then((m) => m.routes),
-  },
+    },
 ];

+ 13 - 0
soul-app/src/app/settings/settings.page.html

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

+ 0 - 0
soul-app/src/app/settings/settings.page.scss


+ 17 - 0
soul-app/src/app/settings/settings.page.spec.ts

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

+ 20 - 0
soul-app/src/app/settings/settings.page.ts

@@ -0,0 +1,20 @@
+import { Component, OnInit } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { FormsModule } from '@angular/forms';
+import { IonContent, IonHeader, IonTitle, IonToolbar } from '@ionic/angular/standalone';
+
+@Component({
+  selector: 'app-settings',
+  templateUrl: './settings.page.html',
+  styleUrls: ['./settings.page.scss'],
+  standalone: true,
+  imports: [IonContent, IonHeader, IonTitle, IonToolbar, CommonModule, FormsModule]
+})
+export class SettingsPage implements OnInit {
+
+  constructor() { }
+
+  ngOnInit() {
+  }
+
+}

+ 69 - 5
soul-app/src/app/tab1/tab1.page.html

@@ -1,17 +1,81 @@
 <ion-header [translucent]="true">
   <ion-toolbar>
+    <!--
     <ion-title>
       首页
     </ion-title>
+    -->
+    <ion-buttons slot="end">
+        <ion-searchbar>
+        </ion-searchbar>
+    </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-title size="large">首页</ion-title>
     </ion-toolbar>
   </ion-header>
-
-  <app-explore-container name="Tab 1 page"></app-explore-container>
-</ion-content>
+<app-explore-container name="Tab 1 page"></app-explore-container>-->
+  <section>
+  <ion-card>
+    <ion-card-header>
+      <ion-card-title>专业心理咨询</ion-card-title>
+    </ion-card-header>
+    <ion-card-content>
+      <ion-list>
+        <ion-item *ngFor="let consultant of consultants">
+          <ion-avatar slot="start">
+            <img [src]="consultant.avatar" alt="{{ consultant.name }}"/>
+          </ion-avatar>
+          <ion-label>
+            <h2>{{ consultant.name }}</h2>
+            <p>{{ consultant.fields.join(', ') }}</p>
+          </ion-label>
+          <ion-button slot="end" (click)="bookConsultation(consultant)">预约咨询</ion-button>
+        </ion-item>
+      </ion-list>
+    </ion-card-content>
+  </ion-card>
+</section>
+<section>
+  <ion-card>
+    <ion-card-header>
+      <ion-card-title>热门话题</ion-card-title>
+    </ion-card-header>
+    <ion-card-content>
+      <ion-list>
+        <ion-item *ngFor="let topic of topics">
+          <ion-label>
+            <h2>{{ topic.title }}</h2>
+            <p>{{ topic.description }}</p>
+          </ion-label>
+          <ion-button slot="end" [routerLink]="['/topic', topic.id]">查看详情</ion-button>
+        </ion-item>
+      </ion-list>
+    </ion-card-content>
+  </ion-card>
+</section>
+<section>
+  <ion-card>
+    <ion-card-header>
+      <ion-card-title>用户评价</ion-card-title>
+    </ion-card-header>
+    <ion-card-content>
+      <ion-list>
+        <ion-item *ngFor="let review of reviews">
+          <ion-avatar slot="start">
+            <img [src]="review.avatar" alt="用户头像"/>
+          </ion-avatar>
+          <ion-label>
+            <p>{{ review.content }}</p>
+            <ion-icon name="star" *ngFor="let star of [].constructor(review.rating); let i = index" [attr.aria-hidden]="true"></ion-icon>
+          </ion-label>
+        </ion-item>
+      </ion-list>
+    </ion-card-content>
+  </ion-card>
+</section>
+</ion-content>

+ 46 - 0
soul-app/src/app/tab1/tab1.page.scss

@@ -0,0 +1,46 @@
+/* 设置页面背景色 */
+ion-content {
+    --background: #f9f9f9; /* 设置内容背景色 */
+  }
+  
+  /* 设置卡片的样式 */
+  ion-card {
+    margin: 10px; /* 卡片之间的间距 */
+    border-radius: 10px; /* 圆角效果 */
+    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); /* 阴影效果 */
+  }
+  
+  /* 设置标题的样式 */
+  ion-card-title {
+    font-size: 1.5rem; /* 标题字体大小 */
+    font-weight: bold; /* 加粗 */
+  }
+  
+  /* 设置列表项的样式 */
+  ion-item {
+    margin: 5px 0; /* 列表项之间的间距 */
+  }
+  
+  /* 设置搜索框的样式 */
+  ion-searchbar {
+    padding: 10px; /* 内边距 */
+    border-radius: 4px; /* 圆角 */
+    font-size: 16px; /* 字体大小 */
+  }
+  
+  /* 设置滑块的样式 */
+  ion-slides {
+    margin: 10px 0; /* 滑块与其他内容之间的间距 */
+  }
+  
+  /* 设置滑块中的图片样式 */
+  ion-slide img {
+    width: 100%; /* 图片宽度100% */
+    border-radius: 10px; /* 图片圆角 */
+  }
+  
+  /* 设置用户评价星星的样式 */
+  ion-icon[name="star"] {
+    color: gold; /* 星星颜色 */
+    font-size: 1.2rem; /* 星星大小 */
+  }

+ 5 - 6
soul-app/src/app/tab1/tab1.page.spec.ts

@@ -7,12 +7,11 @@ describe('Tab1Page', () => {
   let fixture: ComponentFixture<Tab1Page>;
 
   beforeEach(async () => {
-    fixture = TestBed.createComponent(Tab1Page);
-    component = fixture.componentInstance;
-    fixture.detectChanges();
+  fixture = TestBed.createComponent(Tab1Page);
+  component = fixture.componentInstance;
+  fixture.detectChanges();
   });
-
   it('should create', () => {
-    expect(component).toBeTruthy();
+  expect(component).toBeTruthy();
   });
-});
+});

+ 75 - 6
soul-app/src/app/tab1/tab1.page.ts

@@ -1,14 +1,83 @@
-import { Component } from '@angular/core';
-import { IonHeader, IonToolbar, IonTitle, IonContent } from '@ionic/angular/standalone';
+import { Component,CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
+import { IonHeader, IonToolbar, IonTitle, IonContent, IonAvatar, IonButton, IonButtons, IonCard, IonCardContent, IonCardHeader, IonLabel, IonList,
+   IonItem,IonIcon,IonCardTitle,IonInput,IonSearchbar } from '@ionic/angular/standalone';
 import { ExploreContainerComponent } from '../explore-container/explore-container.component';
-
+import { CommonModule } from '@angular/common';
 @Component({
   selector: 'app-tab1',
   templateUrl: 'tab1.page.html',
   styleUrls: ['tab1.page.scss'],
   standalone: true,
-  imports: [IonHeader, IonToolbar, IonTitle, IonContent, ExploreContainerComponent],
+  imports: [IonHeader,IonToolbar,IonTitle,IonContent,ExploreContainerComponent,
+    IonButtons,IonButton,IonIcon,
+    IonCard,IonCardContent,IonCardHeader,IonCardTitle,
+    IonLabel,IonList,IonItem,IonAvatar,IonInput,IonSearchbar,
+    CommonModule,
+  ],
+  schemas: [CUSTOM_ELEMENTS_SCHEMA],
 })
 export class Tab1Page {
-  constructor() {}
-}
+  onSearch(event: any) {
+    const searchTerm = event.target.value; // 获取用户输入的搜索内容
+    console.log('搜索内容:', searchTerm);
+    // 在这里添加搜索逻辑,例如过滤列表或导航到搜索结果页面
+  }
+  consultants = [
+    {
+      name: '李医生',
+      avatar: 'img/1.png',
+      fields: ['焦虑', '抑郁']
+    },
+    {
+      name: '张医生',
+      avatar: 'img/1.png',
+      fields: ['人际关系', '情绪管理']
+    },
+    {
+      name: '王医生',
+      avatar: 'img/1.png',
+      fields: ['压力管理', '心理咨询']
+    }
+  ];
+
+  topics = [
+    {
+      id: 1,
+      title: '如何管理焦虑情绪',
+      description: '了解焦虑的来源及应对策略。'
+    },
+    {
+      id: 2,
+      title: '克服抑郁的有效方法',
+      description: '探索抑郁症的应对技巧。'
+    },
+    {
+      id: 3,
+      title: '提升自信心的技巧',
+      description: '学习如何建立自信。'
+    }
+  ];
+
+  reviews = [
+    {
+      avatar: 'img/1.png',
+      content: '这款APP真的帮助了我,感谢陪聊师!',
+      rating: 4
+    },
+    {
+      avatar: 'img/1.png',
+      content: '非常实用的心理咨询平台!',
+      rating: 5
+    },
+    {
+      avatar: 'img/1.png',
+      content: '我喜欢这里的热门话题!',
+      rating: 4
+    }
+  ];
+
+  bookConsultation(consultant: any) {
+    // 预约咨询逻辑
+    console.log(`预约咨询: ${consultant.name}`);
+  }
+}

BIN
soul-app/src/assets/img/1.png