cainiao-hue há 4 meses atrás
pai
commit
1846b7b372

+ 9 - 1
soul-app/src/app/tab1/tab1.page.html

@@ -52,7 +52,14 @@
 <section>
   <ion-card>
     <ion-card-header>
+      <ion-toolbar>
       <ion-card-title>用户评价</ion-card-title>
+      <ion-buttons slot="end">
+        <ion-button (click)="evaluate()" color="primary" fill="solid">
+          <span class="button-text">点击评价</span>
+        </ion-button>
+      </ion-buttons>
+    </ion-toolbar>
     </ion-card-header>
     <ion-card-content>
       <ion-list>
@@ -62,7 +69,8 @@
           </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-icon name="star" *ngFor="let star of [].constructor(review.rating); let i = index" [attr.aria-hidden]="true"></ion-icon>-->
+            <ion-icon name="star" *ngFor="let star of createFilledArray(review.rating); let i = index" [attr.aria-hidden]="true"></ion-icon>
           </ion-label>
         </ion-item>
       </ion-list>

+ 18 - 1
soul-app/src/app/tab1/tab1.page.scss

@@ -19,8 +19,8 @@ ion-content {
     margin-top: 8px; /* 上间距,仅在需要时添加 */
     text-transform: none; /* 按钮文字不变形 */
     height: 35px;
+
 }
-  
   /* 设置搜索框的样式 */
   ion-searchbar {
     padding: 10px; /* 内边距 */
@@ -32,4 +32,21 @@ ion-content {
   ion-icon[name="star"] {
     color: gold; /* 星星颜色 */
     font-size: 1.2rem; /* 星星大小 */
+  }
+  ion-card-header {
+    --background: #ffffff; /* 使用CSS变量设置背景颜色为白色 */
+    /* 或者,如果你不使用CSS变量,可以直接使用background-color属性 */
+    position: relative; /* 设置相对定位 */
+  }
+   
+  /* 实际上,ion-toolbar默认会继承ion-card-header的样式,但你可以显式地设置它以确保一致性 */
+  ion-toolbar {
+    --background: #ffffff; /* 同样使用CSS变量,但通常不是必需的 */
+  }
+   
+  /* 确保按钮的文本颜色是白色 */
+  .button-text {
+    color: #ffffff !important; /* 使用!important可以确保这个规则具有更高的优先级,但通常不推荐,除非确实需要 */
+    /* 然而,在这个例子中,由于按钮本身可能有自己的颜色设置,你可能不需要为.button-text设置颜色,
+       而是应该确保按钮的color属性正确,并在需要时覆盖按钮的默认颜色设置 */
   }

+ 20 - 4
soul-app/src/app/tab1/tab1.page.ts

@@ -6,6 +6,7 @@ import { CommonModule } from '@angular/common';
 import {  TopicDetailComponent } from '../topic-detail/topic-detail.component';
 import { Router } from '@angular/router';
 import { TopicDetail2Component } from '../topic-detail2/topic-detail2.component';
+import { TopicDetail3Component } from '../topic-detail3/topic-detail3.component';
 @Component({
   selector: 'app-tab1',
   templateUrl: 'tab1.page.html',
@@ -14,8 +15,10 @@ import { TopicDetail2Component } from '../topic-detail2/topic-detail2.component'
   imports: [IonHeader,IonToolbar,IonTitle,IonContent,ExploreContainerComponent,
     IonButtons,IonButton,IonIcon,
     IonCard,IonCardContent,IonCardHeader,
-    IonLabel,IonList,IonItem,IonAvatar,IonInput,IonSearchbar,
-    CommonModule,TopicDetailComponent,TopicDetail2Component
+    IonLabel,IonList,IonItem,IonAvatar,
+    IonInput,IonSearchbar,
+    CommonModule,
+    TopicDetailComponent,TopicDetail2Component,TopicDetail3Component
   ],
   schemas: [CUSTOM_ELEMENTS_SCHEMA],
 })
@@ -83,6 +86,7 @@ export class Tab1Page {
   constructor(private router: Router) {
     // 其他构造函数代码
   }
+  
   viewDetails(topicId: number): void {
     let route: string;
     switch (topicId) {
@@ -93,8 +97,7 @@ export class Tab1Page {
         route = 'topic-detail2';
         break;
       case 3:
-        // 如果有第三个详情页面
-        route = 'another-detail';
+        route = 'topic-detail3';
         break;
       default:
         route = 'topic-detail'; // 默认路由
@@ -102,8 +105,21 @@ export class Tab1Page {
     // 导航到指定的路由,并可以传递参数(如果需要)
     this.router.navigate([`tabs/${route}`, { id: topicId }]);
   }
+
   bookConsultation(consultant: any) {
     // 预约咨询逻辑
     console.log(`预约咨询: ${consultant.name}`);
   }
+
+  evaluate() {
+    // 处理点击评价的逻辑
+    console.log('用户点击了“点击评价”按钮');
+    // 您可以导航到一个新的页面来让用户填写评价,或者显示一个模态框等。
+  }
+  review: any = { rating: 5 };  // 示例数据
+ 
+  // 创建一个方法,用于生成填充了 null 的数组
+  createFilledArray(length: number): any[] {
+    return Array(length).fill(null);
+  }
 }

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

@@ -31,6 +31,11 @@ export const routes: Routes = [
         loadComponent: () =>
           import('../topic-detail2/topic-detail2.component').then((m) => m.TopicDetail2Component),
       },
+      {
+        path: 'topic-detail3',
+        loadComponent: () =>
+          import('../topic-detail3/topic-detail3.component').then((m) => m.TopicDetail3Component),
+      },
       {
         path: '',
         redirectTo: '/tabs/tab1',

+ 1 - 1
soul-app/src/app/topic-detail/README.md

@@ -48,4 +48,4 @@
 示例内容:
 主题: “分享你的焦虑管理经验”
 链接: “参与讨论”
-请您作为一名专业的Ionic前端工程师,帮我运用ionic v7 或v8及以上的angular版本standalone模式编写,选择合适的ionic组件来重构以上产品页面的各个区域和内容,如果涉及到图形效果请用ion-icon。并给出整个页面的edit-detail.component.html代码还有edit-detail.component.ts代码
+请您作为一名专业的Ionic前端工程师,帮我运用ionic v7 或v8及以上的angular版本standalone模式编写,选择合适的ionic组件来重构以上产品页面的各个区域和内容,如果涉及到图形效果请用ion-icon。并给出整个页面的topic-detail.component.html代码还有topic-detail.component.ts代码

+ 4 - 2
soul-app/src/app/topic-detail/topic-detail.component.ts

@@ -10,8 +10,10 @@ import { ExploreContainerComponent } from '../explore-container/explore-containe
   styleUrls: ['./topic-detail.component.scss'],
   standalone: true,
   imports: [IonHeader,IonToolbar,IonTitle,IonContent,ExploreContainerComponent,
-    IonList,IonListHeader,IonItem,IonInput,IonSearchbar,
-    IonLabel,IonIcon,IonButton,CommonModule
+    IonList,IonListHeader,IonItem,
+    IonLabel,IonIcon,IonButton,
+    IonInput,IonSearchbar,
+    CommonModule
   ]
 })
 export class TopicDetailComponent  implements OnInit {

+ 53 - 0
soul-app/src/app/topic-detail3/README.md

@@ -0,0 +1,53 @@
+页面结构
+1. 页面标题区
+组件: 页面标题
+元素:
+标题文本(H1)
+示例内容: “提升自信心的技巧”
+2. 提升自信心的技巧区
+组件: 技巧列表
+元素:
+列表项(每个技巧可以展开)
+示例内容:
+技巧一: 设定小目标
+描述: “通过设定并完成小目标来增强自信心。”
+详细说明: “每完成一个小目标,都会增强你的成就感。”
+技巧二: 积极自我对话
+描述: “通过积极的自我对话来改变消极思维。”
+详细说明: “用积极的语言鼓励自己,提升自我肯定感。”
+技巧三: 练习身体语言
+描述: “通过开放的身体语言来传达自信。”
+详细说明: “站直、微笑和保持眼神接触可以帮助你感到更自信。”
+3. 实用工具区
+组件: 工具推荐
+元素:
+工具名称
+工具描述
+使用链接或下载按钮
+示例内容:
+工具一: 自信心提升APP
+描述: “提供每日自信心练习和积极的提醒。”
+按钮: “下载APP”
+工具二: 在线课程
+描述: “学习更多关于自信心提升的技巧。”
+按钮: “查看课程”
+4. 资源区
+组件: 文章和视频推荐
+元素:
+文章标题
+视频缩略图
+资源链接
+示例内容:
+文章: “提升自信心的五个有效方法”
+链接: “阅读更多”
+视频: “如何在公众面前自信演讲”
+链接: “观看视频”
+5. 社区支持区
+组件: 社区讨论
+元素:
+讨论主题
+参与链接
+示例内容:
+主题: “分享你的自信提升故事”
+链接: “参与讨论”
+请您作为一名专业的Ionic前端工程师,帮我运用ionic v7 或v8及以上的angular版本standalone模式编写,选择合适的ionic组件来重构以上产品页面的各个区域和内容,如果涉及到图形效果请用ion-icon。并给出整个页面的topic-detail3.component.html代码还有topic-detail3.component.ts代码

+ 72 - 0
soul-app/src/app/topic-detail3/topic-detail3.component.html

@@ -0,0 +1,72 @@
+<ion-header>
+  <ion-toolbar>
+    <ion-title>提升自信心的技巧</ion-title>
+  </ion-toolbar>
+</ion-header>
+
+<ion-content>
+  <!-- 提升自信心的技巧区 -->
+  <section>
+    <ion-list>
+      <ion-list-header>
+        <ion-label>提升自信心的技巧</ion-label>
+      </ion-list-header>
+      <ion-item *ngFor="let tip of tips">
+        <ion-label>
+          <h2>{{ tip.title }}</h2>
+          <p>{{ tip.description }}</p>
+        </ion-label>
+        <ion-icon name="chevron-down" slot="end" (click)="tip.expanded = !tip.expanded"></ion-icon>
+        <ion-item *ngIf="tip.expanded">
+          <ion-label>{{ tip.details }}</ion-label>
+        </ion-item>
+      </ion-item>
+    </ion-list>
+  </section>
+
+  <!-- 实用工具区 -->
+  <section>
+    <ion-list>
+      <ion-list-header>
+        <ion-label>实用工具推荐</ion-label>
+      </ion-list-header>
+      <ion-item *ngFor="let tool of tools">
+        <ion-label>
+          <h2>{{ tool.name }}</h2>
+          <p>{{ tool.description }}</p>
+        </ion-label>
+        <ion-button slot="end" [href]="tool.link">{{ tool.buttonText }}</ion-button>
+      </ion-item>
+    </ion-list>
+  </section>
+
+  <!-- 资源区 -->
+  <section>
+    <ion-list>
+      <ion-list-header>
+        <ion-label>相关文章和视频</ion-label>
+      </ion-list-header>
+      <ion-item *ngFor="let resource of resources">
+        <ion-label>
+          <h2>{{ resource.title }}</h2>
+        </ion-label>
+        <ion-button slot="end" [href]="resource.link">{{ resource.buttonText }}</ion-button>
+      </ion-item>
+    </ion-list>
+  </section>
+
+  <!-- 社区支持区 -->
+  <section>
+    <ion-list>
+      <ion-list-header>
+        <ion-label>社区讨论</ion-label>
+      </ion-list-header>
+      <ion-item *ngFor="let discussion of discussions">
+        <ion-label>
+          <h2>{{ discussion.title }}</h2>
+        </ion-label>
+        <ion-button slot="end" [href]="discussion.link">参与讨论</ion-button>
+      </ion-item>
+    </ion-list>
+  </section>
+</ion-content>

+ 28 - 0
soul-app/src/app/topic-detail3/topic-detail3.component.scss

@@ -0,0 +1,28 @@
+/* 设置页面背景色 */
+ion-content {
+    --background: #ffffff; /* 白色背景 */
+}
+ion-title {
+    font-size: 24px; /* 增大字体大小 */
+    font-weight: bold; /* 加粗 */
+}
+/* 设置卡片的样式 */
+ion-list {
+    margin: 10px; /* 卡片之间的间距 */
+    border-radius: 10px; /* 圆角效果 */
+    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); /* 阴影效果 */
+  }
+
+/* 设置列表项的样式 */
+ion-item {
+    margin: 5px 0; /* 列表项之间的间距 */
+  }
+
+/* 设置按钮的样式(如果按钮不在顶部方框内) */
+ion-button {
+    font-size: 15px; /* 增大字体大小 */
+    padding: 8px 16px; /* 内边距 */
+    margin-top: 8px; /* 上间距,仅在需要时添加 */
+    text-transform: none; /* 按钮文字不变形 */
+    height: 50px;
+}

+ 22 - 0
soul-app/src/app/topic-detail3/topic-detail3.component.spec.ts

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

+ 79 - 0
soul-app/src/app/topic-detail3/topic-detail3.component.ts

@@ -0,0 +1,79 @@
+import { Component, OnInit } from '@angular/core';
+import { IonButton, IonContent, IonHeader, IonIcon, IonInput, IonItem, IonLabel, IonList, IonListHeader, 
+  IonSearchbar, IonTitle, IonToolbar } from '@ionic/angular/standalone';
+import { ExploreContainerComponent } from '../explore-container/explore-container.component';
+import { CommonModule } from '@angular/common';
+
+@Component({
+  selector: 'app-topic-detail3',
+  templateUrl: './topic-detail3.component.html',
+  styleUrls: ['./topic-detail3.component.scss'],
+  standalone: true,
+  imports:[IonHeader,IonToolbar,IonTitle,IonContent,ExploreContainerComponent,
+    IonList,IonListHeader,IonLabel,IonItem,IonIcon,IonButton,
+    IonInput,IonSearchbar,
+    CommonModule
+  ],
+})
+export class TopicDetail3Component  implements OnInit {
+  tips = [
+    {
+      title: '设定小目标',
+      description: '通过设定并完成小目标来增强自信心。',
+      details: '每完成一个小目标,都会增强你的成就感。',
+      expanded: false,
+    },
+    {
+      title: '积极自我对话',
+      description: '通过积极的自我对话来改变消极思维。',
+      details: '用积极的语言鼓励自己,提升自我肯定感。',
+      expanded: false,
+    },
+    {
+      title: '练习身体语言',
+      description: '通过开放的身体语言来传达自信。',
+      details: '站直、微笑和保持眼神接触可以帮助你感到更自信。',
+      expanded: false,
+    },
+  ];
+
+  tools = [
+    {
+      name: '自信心提升APP',
+      description: '提供每日自信心练习和积极的提醒。',
+      link: 'https://www.liqucn.com/rj/9679961013722.shtml',
+      buttonText: '下载APP',
+    },
+    {
+      name: '在线视频',
+      description: '学习更多关于自信心提升的技巧。',
+      link: 'https://www.bilibili.com/video/BV1GQBsYfECG/',
+      buttonText: '查看视频',
+    },
+  ];
+
+  resources = [
+    {
+      title: '提升自信心的有效方法',
+      link: 'https://m.baidu.com/bh/m/detail/ar_4782723165528593464',
+      buttonText: '阅读更多',
+    },
+    {
+      title: '如何在公众面前自信演讲',
+      link: 'https://www.bilibili.com/video/BV1eH4y1f7d1/',
+      buttonText: '观看视频',
+    },
+  ];
+
+  discussions = [
+    {
+      title: '分享你的自信提升故事',
+      link: 'https://example.com/community',
+    },
+  ];
+
+  constructor() { }
+
+  ngOnInit() {}
+
+}