张田田 před 3 měsíci
rodič
revize
c3d4c5cc69

+ 20 - 37
miniprogram/module/chats/components/message-consult/message-consult.scss

@@ -12,12 +12,10 @@
 .message-content {
   display: flex;
   justify-content: center;
-  align-items: flex-start; // 改为 flex-start,避免影响内部元素
-  // min-height: 72rpx;
+  align-items: flex-start;
   font-size: 28rpx;
   color: #333;
-  
-  // Markdown 内容样式 - mp-html 组件样式
+
   .markdown-content {
     width: 100%;
     word-wrap: break-word;
@@ -26,8 +24,7 @@
     line-height: 1.5;
     font-size: 28rpx;
     display: block;
-    
-    // mp-html 生成的加粗标签样式 - 确保不会换行
+
     strong,
     b {
       display: inline !important;
@@ -38,8 +35,7 @@
       line-height: inherit !important;
       vertical-align: baseline;
     }
-    
-    // 斜体样式
+
     em,
     i {
       display: inline !important;
@@ -50,7 +46,7 @@
       line-height: inherit !important;
       vertical-align: baseline;
     }
-    
+
     // 代码块样式
     pre {
       background-color: #f5f5f5;
@@ -60,54 +56,50 @@
       margin: 16rpx 0;
       display: block;
     }
-    
+
     code {
       background-color: #f5f5f5;
       padding: 4rpx 8rpx;
       border-radius: 4rpx;
-      font-family: 'Courier New', monospace;
+      font-family: "Courier New", monospace;
       font-size: 24rpx;
       display: inline;
     }
-    
+
     pre code {
       background-color: transparent;
       padding: 0;
       display: block;
     }
-    
-    // 列表样式
+
     ul,
     ol {
       margin: 16rpx 0;
       padding-left: 40rpx;
       display: block;
     }
-    
+
     li {
       margin: 8rpx 0;
       list-style-type: disc;
       display: list-item;
-      
-      // 确保列表项内的加粗文字不会换行
+
       strong,
       b {
         display: inline !important;
       }
     }
-    
-    // 段落样式
+
     p {
       margin: 8rpx 0;
       display: block;
       line-height: 1.5;
-      
+
       strong,
       b {
         display: inline !important;
       }
-      
-      // 确保段落内的加粗不会换行
+
       &:has(strong),
       &:has(b) {
         strong,
@@ -117,13 +109,11 @@
         }
       }
     }
-    
-    // 换行处理
+
     br {
       line-height: 1.5;
     }
-    
-    // 确保所有行内元素不会换行
+
     span {
       display: inline !important;
       white-space: normal !important;
@@ -148,13 +138,12 @@
   padding: 16rpx 24rpx;
   box-sizing: border-box;
   z-index: 10;
-  // 使用更平滑的过渡,避免位置变化时的跳动
   transition: bottom 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
   will-change: bottom;
 }
 .chat-card {
   --avatar-size: 42px;
-  
+
   .image-message,
   .text-message {
     max-width: calc(90% - var(--avatar-size)) !important;
@@ -162,7 +151,7 @@
     background-color: white;
     overflow: hidden;
   }
-  
+
   &.right {
     .image-message,
     .text-message {
@@ -182,7 +171,7 @@
   display: inline-flex;
   align-items: center;
   padding: 0 24rpx;
-  height:80rpx;
+  height: 80rpx;
   line-height: 80rpx;
   border-radius: 12rpx;
   font-size: 30rpx;
@@ -219,18 +208,12 @@
   font-size: 28rpx;
   line-height: 1.9;
   box-sizing: border-box;
-  // 超过 max-height 后显示滚动条
   overflow-y: scroll !important;
   overflow-x: hidden;
-  // 启用平滑滚动(iOS 和部分 Android 支持)
   -webkit-overflow-scrolling: touch;
-  // 平滑过渡,让高度变化更自然(类似微信)
-  // 使用适中的过渡时间和缓动函数,平衡响应速度和平滑度
   transition: height 0.2s ease-out;
-  // 确保内容可以滚动和换行
   word-wrap: break-word;
   word-break: break-all;
-  // 优化滚动行为,避免突然跳动
   scroll-behavior: smooth;
 }
 
@@ -254,7 +237,7 @@
   border-radius: 8rpx;
   padding: 0 20rpx;
   flex-shrink: 0;
-  height:80rpx;
+  height: 80rpx;
   margin: 0 5rpx;
 }
 

+ 3 - 15
miniprogram/module/chats/components/message-consult/message-consult.ts

@@ -42,7 +42,7 @@ function isConsultEndMessage(msg: ConsultMessage): boolean {
   return isRealEnd;
 }
 
-// 获取的聊天消息为ConsultMessage格式
+// 获取的聊天消息为ConsultMessage格式                                           
 function transformMessage(item: AnyObject): ConsultMessage {
   const sender = sendTypeMap[item.sendType];
   return {
@@ -77,7 +77,6 @@ Component({
       const safeBottomRpx = calculateSafeBottomRpx();
       const tabBarHeight = 100; // rpx
       const baseBottom = safeBottomRpx + tabBarHeight;
-      console.log("baseBottom==输入框的位置", baseBottom);
       // 获取咨询中的id
       const consultId = wx.getStorageSync("consultId");
       let messages: ConsultMessage[] = [];
@@ -100,25 +99,17 @@ Component({
         }
       }
 
-      // 检查历史消息中是否有真正的咨询结束消息
       const hasEndMessage = messages.some((msg: ConsultMessage) =>
         isConsultEndMessage(msg)
       );
 
       const consultEnded = hasEndMessage || wx.getStorageSync("consultEnded");
-      console.log(
-        "安全区的距离",
-        safeBottomRpx,
-        "consultEnded==是否已结束咨询",
-        consultEnded
-      );
       this.setData({
         baseInputBottom: baseBottom,
         inputBoxBottom: baseBottom,
         messages,
         consultEnded: !!consultEnded,
       });
-      console.log("baseBottom==输入框的位置", baseBottom);
       this.triggerEvent("boxBottom", { inputBoxBottom: baseBottom });
       const kbHandler = (res: any) => {
         const height = res?.height ?? 0;
@@ -143,7 +134,6 @@ Component({
       const isHarmonyOS =
         systemInfo.system &&
         systemInfo.system.toLowerCase().includes("harmony");
-      console.log("isHarmonyOS==是否是鸿蒙系统", isHarmonyOS);
       const delayTime = isHarmonyOS ? 300 : 0;
 
       if (delayTime > 0) {
@@ -364,8 +354,6 @@ Component({
       }
     },
     onInputBlur() {
-      console.log("onInputBlur==输入框失焦");
-
       // 设置 focus 状态
       this.setData({
         inputFocus: false,
@@ -498,7 +486,7 @@ Component({
 
       this.setData({
         inputText: "",
-        textareaHeight: 80, 
+        textareaHeight: 80,
       });
 
       if (!wasFocused) {
@@ -591,7 +579,7 @@ Component({
         // 发送图片消息
         await this._sendMessage("2", imageUrl);
 
-        // 更新消息中的图片URL(从本地路径更新为服务器URL)
+        // 更新消息中的图片URL
         const messages = this.data.messages;
         const messageIndex = messages.findIndex(
           (msg: ConsultMessage) => msg.id === messageId

+ 1 - 17
miniprogram/pages/home/home.ts

@@ -83,9 +83,8 @@ Page({
 
     switchType: "",
 
-    carouselLoading: {} as Record<string | number, boolean>, // 用于跟踪每个轮播图的加载状态
+    carouselLoading: {} as Record<string | number, boolean>, 
 
-    // 轮播媒体列表
     carouselMediaList: [] as Array<{
       type: "image" | "video";
       src: string;
@@ -100,9 +99,7 @@ Page({
     DraggableSheetBehavior(".draggable-sheet-wrapper"),
   ],
 
-  // 获取调养计划
   async getCareLists() {
-    // 保存当前的展开状态
     const currentExpandedStates = this.data.displayList.map((item: any) => ({
       id: item.id,
       expanded: item.expanded,
@@ -342,11 +339,9 @@ Page({
       isShowPopup: e.detail.visible,
     });
   },
-  // 诊疗随访提醒
   async goComplete(e: {
     currentTarget: { dataset: { page: string; id: number; title: string } };
   }) {
-    // 防止重复点击
     if (this.data.isCompleting) {
       return;
     }
@@ -390,7 +385,6 @@ Page({
         wx.redirectTo({ url: `${page}?id=${id}` });
       }
     } finally {
-      // 延迟重置标志,防止快速连续点击
       setTimeout(() => {
         this.setData({ isCompleting: false });
       }, 500);
@@ -432,7 +426,6 @@ Page({
       return;
     }
     // 加载健康宣教的文章
-    // 每次页面显示时重置到第一页,确保返回首页时显示最新的第一页内容
     this.loadScienceList(true);
     if (!this.data._loaded) {
       getSolarTerms()
@@ -704,17 +697,14 @@ Page({
   },
 
   async loadScienceList(reset = false) {
-    // 如果正在加载,直接返回(防止重复请求)
     if (this.data.scienceListLoading) {
       return;
     }
 
-    // 如果没有更多数据且不是重置,直接返回
     if (!reset && !this.data.scienceListHasMore) {
       return;
     }
 
-    // 重置分页信息
     if (reset) {
       this.setData({
         scienceListPage: 1,
@@ -743,7 +733,6 @@ Page({
         scienceListHasMore: hasMore,
         scienceListLoading: false,
       });
-      // 分配卡片到两列,实现瀑布流布局
       this.distributeCardsToColumns(newList, reset);
     } catch (error) {
       this.setData({ scienceListLoading: false });
@@ -800,11 +789,9 @@ Page({
         0
       );
 
-    // 追加新卡片到较短的列(重置时从空数组开始)
     const leftColumn = reset ? [] : [...this.data.leftColumnList];
     const rightColumn = reset ? [] : [...this.data.rightColumnList];
 
-    // 智能分配:总是将卡片放到当前高度较短的列
     itemsToDistribute.forEach((item: any) => {
       const estimatedHeight = this.estimateCardHeight(item);
 
@@ -823,7 +810,6 @@ Page({
     });
   },
 
-  // 预估卡片高度(基于内容特征,更准确的预估)
   estimateCardHeight(item: any): number {
     let height = 0;
 
@@ -840,7 +826,6 @@ Page({
       height += imgHeight;
     }
 
-    // 内容区域
     const title = item.title || "";
     const titleLength = title.length;
     const charsPerLine = 12;
@@ -961,7 +946,6 @@ Page({
     const res = await getCareList();
     if (res && res.length > 0) {
       res.forEach((item: any) => {
-        // 查找对应的旧数据
         const oldItem = currentExpandedStates.find(
           (state) => state.id === item.id
         );