yuebuzu-creater преди 4 месеца
родител
ревизия
c4f1c12a70

+ 4 - 4
wisdom-app/src/app/component/article-card/article-card.component.html

@@ -1,10 +1,10 @@
 <div class="card">
-  <img [src]="card.image" alt="Image">
+  <img [src]="card.get('image')" alt="Image">
   <div class="content">
-    <h3>{{ card.title }}</h3>
-    <p>{{ card.topic }} &nbsp; {{ card.date }}</p>
+    <h3>{{ card.get('title') }}</h3>
+    <p>{{ card.get('topic') }} &nbsp; {{ card.get('date') }}</p>
     <p>
-      阅读量: {{ card.views }} &nbsp; 赞: {{ card.likes }}
+      阅读量: {{ card.get('views') }} &nbsp; 赞: {{ card.get('likes') }}
     </p>
   </div>
 </div>

+ 4 - 5
wisdom-app/src/app/component/sale-card/sale-card.component.html

@@ -1,12 +1,12 @@
-<ion-card>
+
   <ion-card-header>
-    <ion-card-title>{{ title }}</ion-card-title>
-    <ion-card-subtitle>{{ subtitle }}</ion-card-subtitle>
+    <ion-card-title>{{ product.title }}</ion-card-title>
+    <ion-card-subtitle>{{ product.subtitle }}</ion-card-subtitle>
   </ion-card-header>
   <ion-card-content>
     <ion-grid>
       <ion-row>
-        <ion-col size="6" *ngFor="let product of products">
+        <ion-col size="6">
           <ion-item>
             <ion-thumbnail slot="start">
               <img [src]="product.image">
@@ -20,4 +20,3 @@
       </ion-row>
     </ion-grid>
   </ion-card-content>
-</ion-card>

+ 1 - 3
wisdom-app/src/app/component/sale-card/sale-card.component.ts

@@ -18,8 +18,6 @@ export class SaleCardComponent  implements OnInit {
 
   ngOnInit() {}
 
-  @Input() title: string = '';
-  @Input() subtitle: string = '';
-  @Input() products: { name: string, price: string, image: string }[] = [];
+  @Input() product: any;
 
 }

+ 26 - 12
wisdom-app/src/app/tab2/tab2.page.html

@@ -6,22 +6,36 @@
   </ion-toolbar>
 </ion-header>
 
-<ion-content [fullscreen]="true">
+<ion-content class="knowledge" [fullscreen]="true">
   <div class="search-bar">
     <input type="text" placeholder="输入关键词搜索科普文章">
   </div>
-  
-  <div class="tabs">
-    <span class="tab active">热点</span>
-    <span class="tab">专家科普</span>
-    <span class="tab">生活</span>
-    <span class="tab">睡眠</span>
-    <span class="tab">男性</span>
-    <span class="tab">女性</span>
-    <span class="tab">&#9660;</span>
-  </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>
+      <app-article-card *ngFor="let card of cards" [card]="card"></app-article-card>
   </div>
+
 </ion-content>

+ 29 - 22
wisdom-app/src/app/tab2/tab2.page.scss

@@ -1,30 +1,37 @@
-// 
 .search-bar {
     padding: 10px;
     text-align: center;
   }
   
-  .search-bar input {
-    width: 80%;
-    padding: 8px;
-    border: 1px solid #ccc;
-    border-radius: 4px;
-  }
-  
-  .tabs {
-    display: flex;
-    justify-content: space-around;
-    padding: 10px 0;
-    background-color: #f8f8f8;
-  }
-  
-  .tab {
-    cursor: pointer;
-    padding: 5px 10px;
-  }
+.search-bar input {
+  width: 80%;
+  padding: 8px;
+  border: 1px solid #ccc;
+  border-radius: 4px;
+}
   
-  .tab.active {
-    color: green;
-  }
+.tabs {
+  display: flex;
+  justify-content: space-around;
+  padding: 0px 0;
+  background-color: #f8f8f8;
+}
+
+.tabs ion-button {
+
+  flex: 1;
+  text-align: center;
+  border: none;
+  background-color: rgb(195, 195, 194);
+  color: #333;
+}
+
+.tab {
+  cursor: pointer;
+  color: red;
+  padding: 0px 0px;
+  // background-color: rgb(235, 238, 65);
+}
+
 
 //

+ 58 - 31
wisdom-app/src/app/tab2/tab2.page.ts

@@ -1,11 +1,12 @@
 import { Component } from '@angular/core';
-import { IonHeader, IonToolbar, IonTitle, IonContent, IonList, IonItem, IonLabel, IonAvatar } from '@ionic/angular/standalone';
+import { IonHeader, IonToolbar, IonTitle, IonContent, IonList, IonItem, IonLabel, IonAvatar, IonButton } 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 { ArticleCardComponent } from '../component/article-card/article-card.component';
 import { CommonModule } from '@angular/common';
+import { CloudObject, CloudQuery } from 'src/lib/ncloud';
 addIcons({ airplane, bluetooth, call, wifi });
 
 interface Article {
@@ -23,41 +24,67 @@ interface Article {
   styleUrls: ['tab2.page.scss'],
   standalone: true,
   imports: [IonHeader, IonToolbar, IonTitle, IonContent, ExploreContainerComponent,
-    IonLabel,IonItem,IonList,IonAvatar,ArticleCardComponent,CommonModule
+    IonLabel,IonItem,IonList,IonAvatar,ArticleCardComponent,CommonModule,IonButton,
   ]
 })
 
-
 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();
+  }
+
+  cards: Array<CloudObject> = [];
+  async loadCards() {
+    let query = new CloudQuery('HotDot');
+    query.equalTo('category', 'HotDot');
+    // query.greaterThan('views', 1000); // 查询 views 大于 1000 的文章
+    if (this.hotDot == 1) {
+
+    }
+    if (this.hotDot == 2) {
+
+    }
+    if (this.hotDot == 3) {
+
+    }
+    if (this.hotDot == 4) {
+      query.equalTo('category', 'MaleHealth')
+    }
+    if (this.hotDot == 5) {
+      query.equalTo("category", "FemaleHealth")
+    }
+    // query.greaterThan('views', 1000); // 查询 views 大于 1000 的文章
+    
+    this.cards = await query.find();
+    console.log(this.cards);
+  }
+
+  ngOnInit() {
+    this.loadCards();
+  }
 
-  cards = [
-    {
-      image: 'https://picsum.photos/800/400?random=1',
-      title: '电话—麻烦?为何年轻人这么讨厌接电话',
-      topic: '生活',
-      date: '11月29日',
-      views: '1.2万',
-      likes: 132
-    },
-    {
-      image: 'https://picsum.photos/800/400?random=2',
-      title: '眼睛也会“高血压”?',
-      topic: '生活',
-      date: '11月26日',
-      views: '1.2万',
-      likes: 150
-    },
-    {
-      image: 'https://picsum.photos/800/400?random=3',
-      title: '眼睛也会“高血压”?',
-      topic: '生活',
-      date: '11月26日',
-      views: '1.2万',
-      likes: 150
-    },
-    // 添加更多卡片数据
-  ];
 }

+ 4 - 18
wisdom-app/src/app/tab3/tab3.page.html

@@ -20,7 +20,7 @@
     </ion-row>
   </ion-grid>
 
-  <ion-card>
+  <!-- <ion-card>
     <ion-card-header>
       <ion-card-title>健康护肤专场</ion-card-title>
     </ion-card-header>
@@ -35,24 +35,10 @@
         </ion-label>
       </ion-item>
     </ion-card-content>
+  </ion-card> -->
+  <ion-card>
+    <app-sale-card *ngFor="let product of products" [product]="product"></app-sale-card>
   </ion-card>
 
-  <app-sale-card
-  title="健康护肤专场"
-  subtitle="医用更安心"
-  [products]="[
-    { name: '产品1', price: '到手价 ¥158', image: '../../assets/image/doctor7.png' },
-    { name: '产品2', price: '到手价 ¥158', image: '../../assets/image/doctor7.png' }
-  ]">
-</app-sale-card>
-
-<app-sale-card
-  title="健康生活季"
-  subtitle="品质优选更有心"
-  [products]="[
-    { name: '产品3', price: '热销第一名', image: '../../assets/image/doctor7.png' },
-    { name: '产品4', price: '热销第二名', image: '../../assets/image/doctor7.png' }
-  ]">
-</app-sale-card>
   
 </ion-content>

+ 7 - 5
wisdom-app/src/app/tab3/tab3.page.ts

@@ -41,12 +41,14 @@ export class Tab3Page {
     { name: '男科用药', image: '../../assets/image/doctor7.png' },
   ];
   
+  // 商品列表
   products = [
-    { name: '清宫长春胶囊', price: '¥120', image: '../../assets/image/doctor7.png' },
-    { name: '知柏地黄丸', price: '¥200', image: '../../assets/image/doctor7.png' },
+    { title: '特价', subtitle: '药品', name: '清宫长春胶囊', price: '¥120', image: '../../assets/image/doctor7.png' },
+    { title: '特价', subtitle: '药品', name: '知柏地黄丸', price: '¥200', image: '../../assets/image/doctor7.png' },
+    { title: '特价', subtitle: '药品', name: '知柏地黄丸', price: '¥200', image: '../../assets/image/doctor7.png' },
   ];
 
-  goChat(){
-    this.router.navigateByUrl("/chat/session/role/2DXJkRsjXK")
-  }
+  // goChat(){
+  //   this.router.navigateByUrl("/chat/session/role/2DXJkRsjXK")
+  // }
 }

+ 1 - 0
wisdom-app/src/lib/ncloud.ts

@@ -169,6 +169,7 @@ export class CloudQuery {
         return objList || [];
     }
 
+
     async first() {
         let url = `http://dev.fmode.cn:1337/parse/classes/${this.className}?`;
 

+ 31 - 0
wisdom-prod/schema/schema.md

@@ -334,3 +334,34 @@ HealthKnowledgeCollection "1" -- "0..*" HealthKnowledge : contains
 - **ConsultationRecord** 表用于存储用户的AI问诊记录,记录咨询日期、问题和答案。
 - **HealthKnowledge** 表用于存储健康科普知识的内容。
 - **HealthKnowledgeCollection** 表用于存储用户收藏的健康知识,使用指针关联到 HealthKnowledge 表。
+
+
+## 科普模块
+
+### HotDots
+
+- **objectId**: String
+- **createdAt**: Date
+- **image**: String
+- **title**: String
+- **content**: String
+- **topic**: String
+- **date**: Date
+- **author**: Array
+- **views**: Number
+- **likes**: Number
+- **userProfile**: Pointer<UserProfile>
+
+### HotDotContent
+
+- **objectId**
+- **objectId**
+- **content1**
+- **userProfile**: Pointer<UserProfile>
+- **createdAt**
+- **hotDot**: Pointer<HotDots>
+
+### 设计说明
+
+- **HotDots** 表用于存储健康科普知识的内容。
+- **HotDotsCollection** 表用于存储用户收藏的健康科普知识,使用指针关联到 HotDots 表。

+ 1 - 1
wisdom-server/lib/ncloud.js

@@ -49,7 +49,7 @@ class CloudObject{
     }
     async destory(){
         if(!this.id) return
-        let response = await fetch("http://dev.fmode.cn:1337/parse/classes/Doctor/"+this.id, {
+        let response = await fetch("http://dev.fmode.cn:1337/parse/classes/"+this.className+"/"+this.id, {
             "headers": {
               "x-parse-application-id": "dev"
             },

+ 186 - 2
wisdom-server/migration/data.js

@@ -93,5 +93,189 @@ module.exports.DepartList = [
         "objectId": "dept005",
         "name": "神经科",
         "desc": "专注于神经系统疾病的诊断和治疗"
-      }
-    ]
+      },
+    ]
+
+// tab2 / 热点数据
+module.exports.HotDotList = [
+  {
+      "objectId": "001",
+      "category": "HotDot",
+      "image": "https://ts1.cn.mm.bing.net/th/id/R-C.604489b58d051acbf08b082baed5240b?rik=2wfk1JgczvfOQw&riu=http%3a%2f%2fpsy.china.com.cn%2fpic%2f2023-09%2f05%2f22937582-f9a1-4bfd-8f19-cc0d7369ac02.jpg&ehk=cN5yrGkIBYJHeeT8KaPLeUcl5XmS5rnUh2pSPyVqdjM%3d&risl=&pid=ImgRaw&r=0",
+      "title": "如何保持心理健康",
+      "content": "在现代社会中,保持心理健康变得尤为重要。本文将探讨一些有效的方法来管理压力和焦虑。",
+      "topic": "心理健康",
+      "date": "2024-12-14T10:00:00Z",
+      "author": ["张伟", "李娜"],
+      "views": 1500,
+      "likes": 250,
+  },
+  {
+      "objectId": "002",
+      "category": "HotDot",
+      "image": "https://tse3-mm.cn.bing.net/th/id/OIP-C.C39QnSPshcJxgj1efBr75QHaFp?w=226&h=180&c=7&r=0&o=5&dpr=1.5&pid=1.7",
+      "title": "冬季养生:如何增强免疫力",
+      "content": "冬季是流感和感冒的高发季节,本文提供一些增强免疫力的建议,包括饮食和生活习惯的调整。",
+      "topic": "健康养生",
+      "date": "2024-12-13T14:30:00Z",
+      "author": ["王芳"],
+      "views": 2300,
+      "likes": 400,
+  },
+  {
+      "objectId": "003",
+      "category": "HotDot",
+      "image": "https://img-s-msn-com.akamaized.net/tenant/amp/entityid/AA1vwPs7.img?w=640&h=426&m=6",
+      "title": "运动与健康:每周锻炼的益处",
+      "content": "定期锻炼对身体健康至关重要。本文将讨论每周锻炼的多重好处,以及如何制定适合自己的运动计划。",
+      "topic": "运动健康",
+      "date": "2024-12-12T09:15:00Z",
+      "author": ["赵强", "刘洋"],
+      "views": 1800,
+      "likes": 320,
+  },
+  {
+      "objectId": "004",
+      "category": "HotDot",
+      "image": "https://th.bing.com/th?&id=OVP.Xw33st6_8Ujcv6teydlQDwEsC7&w=285&h=160&c=7&pid=2.1&rs=1",
+      "title": "饮食与心理:食物如何影响情绪",
+      "content": "我们的饮食习惯与心理健康息息相关。本文探讨了哪些食物可以改善情绪,哪些应尽量避免。",
+      "topic": "饮食心理",
+      "date": "2024-12-11T11:45:00Z",
+      "author": ["陈刚"],
+      "views": 1200,
+      "likes": 210,
+  },
+  {
+      "objectId": "005",
+      "category": "HotDot",
+      "image": "https://tse3-mm.cn.bing.net/th/id/OIP-C._S3n4LWflXFG5drI2J8kywHaE8?w=288&h=192&c=7&r=0&o=5&dpr=1.5&pid=1.7",
+      "title": "老年人的健康管理",
+      "content": "随着年龄的增长,健康管理变得尤为重要。本文将介绍老年人应注意的健康问题及管理策略。",
+      "topic": "老年健康",
+      "date": "2024-12-10T08:30:00Z",
+      "author": ["李静", "王平"],
+      "views": 900,
+      "likes": 150,
+  },
+  {
+    "objectId": "006",
+    "category": "MaleHealth",
+    "image": "https://example.com/malehealth1.jpg",
+    "title": "男性健康:如何管理压力",
+    "content": "男性在生活和工作中面临着各种压力,如何有效管理这些压力是保持身心健康的关键。本文提供了一些实用的方法和技巧。",
+    "topic": "心理健康",
+    "date": "2024-12-14T10:00:00Z",
+    "author": ["张伟", "李强"],
+    "views": 1200,
+    "likes": 300
+  },
+  {
+    "objectId": "007",
+    "category": "MaleHealth",
+    "image": "https://example.com/malehealth2.jpg",
+    "title": "提升男性生育力的饮食建议",
+    "content": "饮食对男性的生育力有着重要影响。本文将介绍一些有助于提高生育力的食物,以及应避免的饮食习惯。",
+    "topic": "生育健康",
+    "date": "2024-12-13T14:30:00Z",
+    "author": ["王芳"],
+    "views": 1800,
+    "likes": 450
+  },
+  {
+    "objectId": "008",
+    "category": "MaleHealth",
+    "image": "https://example.com/malehealth3.jpg",
+    "title": "男性如何应对性功能障碍",
+    "content": "性功能障碍是许多男性面临的问题。本文将探讨其可能的原因及有效的应对策略,包括心理咨询和医疗建议。",
+    "topic": "性健康",
+    "date": "2024-12-12T09:15:00Z",
+    "author": ["赵强", "刘洋"],
+    "views": 2200,
+    "likes": 500
+  },
+  {
+    "objectId": "009",
+    "category": "MaleHealth",
+    "image": "https://example.com/malehealth4.jpg",
+    "title": "男性学习:如何提高注意力",
+    "content": "在快节奏的生活中,男性如何提高注意力和学习效率是一个重要课题。本文将分享一些提高注意力的技巧和方法。",
+    "topic": "学习与成长",
+    "date": "2024-12-11T11:45:00Z",
+    "author": ["陈刚"],
+    "views": 1500,
+    "likes": 320
+  },
+  {
+    "objectId": "010",
+    "category": "MaleHealth",
+    "image": "https://example.com/malehealth5.jpg",
+    "title": "男性的健康体检:你需要知道的",
+    "content": "定期体检对男性健康至关重要。本文将介绍男性在不同年龄阶段应关注的健���检查项目及其重要性。",
+    "topic": "健康管理",
+    "date": "2024-12-10T08:30:00Z",
+    "author": ["李静", "王平"],
+    "views": 900,
+    "likes": 200
+  },
+  {
+    "objectId": "011",
+    "category": "FemaleHealth",
+    "image": "https://example.com/femalehealth1.jpg",
+    "title": "女性健康:月经周期的管理",
+    "content": "了解和管理月经周期对女性健康至关重要。本文将探讨如何更好地理解月经周期及其对身体的影响。",
+    "topic": "生理健康",
+    "date": "2024-12-14T10:00:00Z",
+    "author": ["张伟", "李娜"],
+    "views": 1400,
+    "likes": 280
+  },
+  {
+    "objectId": "012",
+    "category": "FemaleHealth",
+    "image": "https://example.com/femalehealth2.jpg",
+    "title": "女性心理健康:应对焦虑与压力",
+    "content": "女性在生活中常常面临各种压力,了解应对焦虑的方法非常重要。本文将提供实用的建议,帮助女性管理心理健康。",
+    "topic": "心理健康",
+    "date": "2024-12-13T14:30:00Z",
+    "author": ["王芳"],
+    "views": 2200,
+    "likes": 450
+  },
+  {
+    "objectId": "013",
+    "category": "FemaleHealth",
+    "image": "https://example.com/femalehealth3.jpg",
+    "title": "孕期保健:健康饮食与锻炼",
+    "content": "孕期是女性生命中重要的阶段,合理的饮食与适当的锻炼对母婴健康至关重要。本文将介绍孕期的饮食和锻炼建议。",
+    "topic": "孕产健康",
+    "date": "2024-12-12T09:15:00Z",
+    "author": ["赵强", "陈刚"],
+    "views": 1800,
+    "likes": 320
+  },
+  {
+    "objectId": "014",
+    "category": "FemaleHealth",
+    "image": "https://example.com/femalehealth4.jpg",
+    "title": "女性生育力与年龄的关系",
+    "content": "女性的生育力与年龄密切相关。本文将探讨年龄对生育力的影响以及如何在不同年龄段保持生育健康。",
+    "topic": "生育健康",
+    "date": "2024-12-11T11:45:00Z",
+    "author": ["李静"],
+    "views": 1500,
+    "likes": 210
+  },
+  {
+    "objectId": "015",
+    "category": "FemaleHealth",
+    "image": "https://example.com/femalehealth5.jpg",
+    "title": "女性职场中的心理健康",
+    "content": "在职场中,女性常常面临独特的挑战。本文将探讨如何在职场中维护心理健康,提升工作效率。",
+    "topic": "职场心理",
+    "date": "2024-12-10T08:30:00Z",
+    "author": ["王平", "李强"],
+    "views": 1600,
+    "likes": 250
+  }
+]

+ 26 - 14
wisdom-server/migration/import-data.js

@@ -1,25 +1,37 @@
 const { CloudQuery, CloudObject } = require("../lib/ncloud");
-const { DepartList, DoctorList } = require("./data");
+const { DepartList, DoctorList, HotDotList} = require("./data");
 inportDapartAndDoctor()
 
 DataMap = {
     Doctor:{},
-    Department:{}
+    Department:{},
+    HotDot:{},
 }
 
 async function inportDapartAndDoctor(){
-    // 导入科室数据
-    let departList = DepartList
-    for (let index = 0; index < departList.length; index++) {
-        let depart = departList[index];
-        depart = await importObject("Department",depart)
-    }
-    // 导入医生数据
-    let doctorList = DoctorList
-    for (let index = 0; index < doctorList.length; index++) {
-        let doctor = doctorList[index];
-        doctor = await importObject("Doctor",doctor)
-    }
+    // // 导入科室数据
+    // let departList = DepartList
+    // for (let index = 0; index < departList.length; index++) {
+    //     let depart = departList[index];
+    //     depart = await importObject("Department",depart)
+    // }
+
+    // // 导入医生数据
+    // let doctorList = DoctorList
+    // for (let index = 0; index < doctorList.length; index++) {
+    //     let doctor = doctorList[index];
+    //     doctor = await importObject("Doctor",doctor)
+    // }
+
+    // 导入热点数据
+    // let hotDotList = HotDotList
+    // for (let index = 0; index < hotDotList.length; index++) {
+    //     let hotDot = hotDotList[index];
+    //     hotDot = await importObject("HotDot",hotDot)
+    // }
+    let query = new CloudQuery('HotDot');
+    query.equalTo('category', 'HotDot');
+    console.log(await query.find())
     // console.log(DataMap["Doctor"])
 }