From 4e6cdf4bdd3c99f71ef2440e7e2c843d1ae8a7c6 Mon Sep 17 00:00:00 2001
From: wangdongbo <949818794@qq.com>
Date: Tue, 10 Feb 2026 16:41:07 +0800
Subject: [PATCH] no message
---
.env.development | 2 +-
.env.localhost | 2 +-
pages/message/components/chat-input.vue | 2 +-
pages/message/index.vue | 39 +++++++++++++------------
pages/message/message.vue | 30 +++++++++----------
utils/tim-chat.js | 19 ++++++------
6 files changed, 47 insertions(+), 47 deletions(-)
diff --git a/.env.development b/.env.development
index db76d4c..70e7c7a 100644
--- a/.env.development
+++ b/.env.development
@@ -1,4 +1,4 @@
MP_API_BASE_URL=https://patient.youcan365.com
MP_CACHE_PREFIX=development
MP_WX_APP_ID=wx6ee11733526b4f04
-MP_TIM_SDK_APP_ID=1600123876
\ No newline at end of file
+MP_TIM_SDK_APP_ID=1600126296
\ No newline at end of file
diff --git a/.env.localhost b/.env.localhost
index caeee5d..2031b21 100644
--- a/.env.localhost
+++ b/.env.localhost
@@ -1,4 +1,4 @@
MP_API_BASE_URL=http://localhost:8080
MP_CACHE_PREFIX=development
MP_WX_APP_ID=wx6ee11733526b4f04
-MP_TIM_SDK_APP_ID=1600123876
+MP_TIM_SDK_APP_ID=1600126296
diff --git a/pages/message/components/chat-input.vue b/pages/message/components/chat-input.vue
index b13a052..6e04776 100644
--- a/pages/message/components/chat-input.vue
+++ b/pages/message/components/chat-input.vue
@@ -8,7 +8,7 @@
+ :auto-height="true" :show-confirm-bar="false" :adjust-position="true" :cursor-spacing="40" />
diff --git a/pages/message/index.vue b/pages/message/index.vue
index 7c4ce07..35862c9 100644
--- a/pages/message/index.vue
+++ b/pages/message/index.vue
@@ -9,7 +9,11 @@
>{{ patientInfo.sex }} · {{ patientInfo.age }}岁
-
+
{{ chatStatusInfo.badgeText }}
@@ -289,11 +293,11 @@ const fetchGroupOrderStatus = async () => {
if (result.success && result.data) {
orderStatus.value = result.data.orderStatus || "";
corpId.value = result.data.corpId || "";
-
+
// 更新导航栏标题为团队名称
const teamName = result.data.team?.name || "群聊";
updateNavigationTitle(teamName);
-
+
// 更新患者信息
if (result.data.patient) {
patientInfo.value = {
@@ -307,10 +311,10 @@ const fetchGroupOrderStatus = async () => {
if (result.data.patientId) {
patientId.value = result.data.patientId.toString();
}
-
+
// 更新聊天状态栏信息
updateChatStatusInfo(result.data);
-
+
console.log("获取群组订单状态:", {
orderStatus: orderStatus.value,
corpId: corpId.value,
@@ -328,7 +332,7 @@ const fetchGroupOrderStatus = async () => {
// 更新聊天状态栏信息
const updateChatStatusInfo = (groupData) => {
const status = groupData.orderStatus || "";
-
+
let statusConfig = {
show: false,
title: "",
@@ -336,7 +340,7 @@ const updateChatStatusInfo = (groupData) => {
badgeText: "",
badgeClass: "",
};
-
+
switch (status) {
case "pending":
statusConfig = {
@@ -386,7 +390,7 @@ const updateChatStatusInfo = (groupData) => {
default:
statusConfig.show = false;
}
-
+
chatStatusInfo.value = statusConfig;
};
@@ -571,7 +575,6 @@ const initTIMCallbacks = async () => {
uniqueMessages.push(message);
}
});
-
messageList.value = uniqueMessages;
console.log(
"消息列表已更新,原始",
@@ -663,7 +666,7 @@ const loadMessageList = async () => {
// 获取群组订单状态
await fetchGroupOrderStatus();
- timChatManager.enterConversation(chatInfo.value.conversationID || "test1");
+ timChatManager.enterConversation(chatInfo.value.conversationID);
// 标记会话为已读 - 确保清空未读数
if (
@@ -758,6 +761,7 @@ const onScroll = throttle((e) => {
// 处理上滑加载更多
const handleScrollToUpper = async () => {
console.log("【handleScrollToUpper】触发上滑事件,准备加载更多");
+ return;
console.log(
" 当前状态: isLoadingMore=",
isLoadingMore.value,
@@ -827,15 +831,12 @@ onShow(() => {
checkLoginAndInitTIM();
} else if (timChatManager.tim && !timChatManager.isLoggedIn) {
timChatManager.ensureIMConnection();
- } else if (timChatManager.tim && timChatManager.isLoggedIn && chatInfo.value.conversationID) {
-
- messageList.value = [];
- isCompleted.value = false;
- lastFirstMessageId.value = "";
- loadMessageList();
- }
-
- startIMMonitoring(30000);
+ } else if (
+ timChatManager.tim &&
+ timChatManager.isLoggedIn &&
+ chatInfo.value.conversationID
+ )
+ startIMMonitoring(30000);
});
// 页面隐藏
diff --git a/pages/message/message.vue b/pages/message/message.vue
index 24d6587..af2576e 100644
--- a/pages/message/message.vue
+++ b/pages/message/message.vue
@@ -1,9 +1,6 @@
-
-
+
{
// 加载会话列表
const loadConversationList = async () => {
+ debugger
if (loading.value) return;
// loading.value = true;
@@ -487,18 +485,7 @@ const handleRefresh = async () => {
};
// 页面加载
-onLoad(() => {
- console.log("消息列表页面加载");
-});
-
-// 清理消息文本(移除换行符)
-const cleanMessageText = (text) => {
- if (!text) return "";
- return text.replace(/[\r\n]+/g, " ").trim();
-};
-
-// 页面显示
-onShow(async () => {
+onLoad( async() => {
try {
// 初始化IM
const imReady = await initIM();
@@ -514,6 +501,17 @@ onShow(async () => {
}
});
+// 清理消息文本(移除换行符)
+const cleanMessageText = (text) => {
+ if (!text) return "";
+ return text.replace(/[\r\n]+/g, " ").trim();
+};
+
+// 页面显示
+onShow(async () => {
+
+});
+
// 页面隐藏
onHide(() => {
// 清除防抖定时器
diff --git a/utils/tim-chat.js b/utils/tim-chat.js
index f926c02..ae105a3 100644
--- a/utils/tim-chat.js
+++ b/utils/tim-chat.js
@@ -1439,15 +1439,15 @@ class TimChatManager {
// 更新当前会话ID
this.currentConversationID = conversationID
- // 清空当前消息列表
- this.messageList = []
+ // 不清空消息列表,只重置分页状态
+ // this.messageList = []
// 重置分页状态
this.nextReqMessageID = ""
this.isCompleted = false
this.isLoadingMore = false
- console.log(" 会话ID已更新,消息列表已清空,分页状态已重置")
+ console.log(" 会话ID已更新,分页状态已重置")
// 进入群聊会话,默认加载20条消息
this.enterGroupConversation(conversationID, 20)
@@ -1455,6 +1455,7 @@ class TimChatManager {
// 进入群聊会话
async enterGroupConversation(groupID, count = 20) {
+
console.log("【enterGroupConversation】进入群聊会话, groupID:", groupID, "count:", count)
let conversationID = groupID
@@ -1470,8 +1471,8 @@ class TimChatManager {
console.log(" conversationID:", conversationID, "actualGroupID:", actualGroupID)
- // 清空消息列表,准备加载新会话的消息
- this.messageList = []
+ // 不清空消息列表,只在首次进入时清空
+ // this.messageList = []
// 确保设置当前会话ID,防止消息混淆
this.currentConversationID = conversationID
@@ -2220,8 +2221,8 @@ class TimChatManager {
// 确保使用当前会话的conversationID
const conversationID = this.conversation.conversationID || this.currentConversationID
- // 获取图片尺寸信息
- const imageInfo = await this.getImageInfo(imageFile);
+ // 使用默认尺寸,不调用接口获取图片信息
+ const defaultImageInfo = { width: 400, height: 300 }
const localMessage = {
ID: `local_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
@@ -2230,8 +2231,8 @@ class TimChatManager {
payload: {
imageInfoArray: [{
url: this.getImageUrl(imageFile),
- width: imageInfo.width,
- height: imageInfo.height
+ width: defaultImageInfo.width,
+ height: defaultImageInfo.height
}]
},
lastTime: Date.now(),