diff --git a/pages/message/chat.scss b/pages/message/chat.scss index a5f27fb..ab9fca4 100644 --- a/pages/message/chat.scss +++ b/pages/message/chat.scss @@ -366,10 +366,8 @@ $primary-color: #0877F1; height: 80rpx; display: flex; align-items: center; + justify-content: center; padding: 0 46rpx; -} - -.voice-input-btn { text-align: center; line-height: 80rpx; } @@ -933,7 +931,16 @@ $primary-color: #0877F1; .text-input::-moz-placeholder, .text-input:-ms-input-placeholder, .text-input::placeholder { - line-height: 96rpx; + line-height: normal; +} + +.voice-input-btn::-webkit-input-placeholder, +.voice-input-btn:-moz-placeholder, +.voice-input-btn::-moz-placeholder, +.voice-input-btn:-ms-input-placeholder, +.voice-input-btn::placeholder { + line-height: 80rpx; + text-align: center; } /* 时间分割线 */ diff --git a/pages/message/index.vue b/pages/message/index.vue index 79bfd3e..0f49ee9 100644 --- a/pages/message/index.vue +++ b/pages/message/index.vue @@ -291,12 +291,6 @@ function handleSystemMessageReceived(message) { } } -// 检查是否有待接诊的系统消息 -function checkConsultPendingStatus() { - // 直接获取最新的订单状态 - fetchGroupOrderStatus(); -} - // 获取消息气泡样式类 function getBubbleClass(message) { // 图片消息不需要气泡背景 @@ -393,27 +387,23 @@ const initTIMCallbacks = async () => { handleSystemMessageReceived(message); } - // 检查是否有待接诊的系统消息 - checkConsultPendingStatus(); - // 立即滚动到底部,不使用延迟 nextTick(() => { scrollToBottom(true); }); // 立即标记会话为已读,确保未读数为0 - if (timChatManager.tim && timChatManager.isLoggedIn && chatInfo.value.conversationID) { + if ( + timChatManager.tim && + timChatManager.isLoggedIn && + chatInfo.value.conversationID + ) { timChatManager.tim .setMessageRead({ conversationID: chatInfo.value.conversationID, }) .then(() => { console.log("✓ 收到新消息后已标记为已读"); - // 触发会话列表更新,确保未读数为0 - timChatManager.triggerCallback('onConversationListUpdated', { - conversationID: chatInfo.value.conversationID, - unreadCount: 0 - }); }) .catch((error) => { console.error("✗ 标记已读失败:", error); @@ -473,9 +463,6 @@ const initTIMCallbacks = async () => { isCompleted.value = data.isCompleted || false; isLoadingMore.value = false; - // 检查是否有待接诊的系统消息 - checkConsultPendingStatus(); - nextTick(() => { if (data.isRefresh) { console.log("后台刷新完成,保持当前滚动位置"); @@ -570,11 +557,6 @@ const loadMessageList = async () => { }) .then(() => { console.log("✓ 会话已标记为已读:", chatInfo.value.conversationID); - // 触发会话列表更新回调,通知消息列表页面清空未读数 - timChatManager.triggerCallback('onConversationListUpdated', { - conversationID: chatInfo.value.conversationID, - unreadCount: 0 - }); }) .catch((error) => { console.error("✗ 标记会话已读失败:", error); @@ -731,6 +713,9 @@ onShow(() => { // 页面隐藏 onHide(() => { stopIMMonitoring(); + // 清空当前会话ID,避免离开页面后收到的消息被错误标记为已读 + timChatManager.currentConversationID = null; + console.log("✓ 页面隐藏,已清空当前会话ID"); }); // 处理取消申请 diff --git a/utils/conversation-merger.js b/utils/conversation-merger.js index d859d38..186bf5a 100644 --- a/utils/conversation-merger.js +++ b/utils/conversation-merger.js @@ -46,7 +46,7 @@ export async function mergeConversationWithGroupDetails(conversationList, option ...options // 支持传入额外的查询参数(corpId, teamId, keyword等) } - const response = await api('getGroupList', requestData) + const response = await api('getGroupList', requestData, false) // 4. 检查响应 if (!response || !response.success) { diff --git a/utils/tim-chat.js b/utils/tim-chat.js index c741ed8..399bf67 100644 --- a/utils/tim-chat.js +++ b/utils/tim-chat.js @@ -379,7 +379,7 @@ class TimChatManager { async getUserInfoAndLogin(userID) { try { console.log('getUserInfoAndLogin 开始,传入 userID:', userID) - + if (userID) { this.currentUserID = userID uni.setStorageSync('userInfo', { userID }) @@ -388,18 +388,18 @@ class TimChatManager { console.log('未传入 userID,尝试从本地存储获取') const userInfo = uni.getStorageSync('userInfo') console.log('本地存储的 userInfo:', userInfo) - + if (!userInfo?.userID) { throw new Error('未找到用户信息,请先登录') } this.currentUserID = userInfo.userID console.log('从本地存储获取到 userID:', this.currentUserID) } - + console.log('开始获取 userSig...') this.currentUserSig = await this.getUserSig(this.currentUserID) console.log('userSig 获取成功') - + console.log('开始登录 TIM...') await this.loginTIM() console.log('TIM 登录成功') @@ -1488,8 +1488,7 @@ class TimChatManager { this.markConversationAsRead(conversationID) - // 首先从本地接口加载聊天记录 - console.log(" 开始从本地接口加载聊天记录,groupID:", actualGroupID) + await this.loadMessagesFromLocalAPI(actualGroupID, count) } @@ -2542,8 +2541,8 @@ class TimChatManager { return '[自定义消息]' } - const customData = typeof payload.data === 'string' - ? JSON.parse(payload.data) + const customData = typeof payload.data === 'string' + ? JSON.parse(payload.data) : payload.data const messageType = customData.messageType || customData.type