no message
This commit is contained in:
parent
1e5881043b
commit
4e6cdf4bdd
@ -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
|
||||
MP_TIM_SDK_APP_ID=1600126296
|
||||
@ -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
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
<view class="input-area">
|
||||
<textarea v-if="!showVoiceInput" class="text-input" v-model="inputText" placeholder="我来说两句..."
|
||||
@confirm="sendTextMessage" @focus="handleInputFocus" @input="handleInput"
|
||||
:auto-height="true" :show-confirm-bar="false" :adjust-position="true" :cursor-spacing="80" />
|
||||
:auto-height="true" :show-confirm-bar="false" :adjust-position="true" :cursor-spacing="40" />
|
||||
<input v-else class="voice-input-btn" :class="{ recording: isRecording }" @touchstart="startRecord"
|
||||
@touchmove="onRecordTouchMove" @touchend="stopRecord" @touchcancel="cancelRecord" :placeholder="isRecording ? '松开发送' : '按住说话'" disabled>
|
||||
</input>
|
||||
|
||||
@ -9,7 +9,11 @@
|
||||
>{{ patientInfo.sex }} · {{ patientInfo.age }}岁</text
|
||||
>
|
||||
</view>
|
||||
<view class="status-badge" :class="chatStatusInfo.badgeClass" v-if="chatStatusInfo.badgeText">
|
||||
<view
|
||||
class="status-badge"
|
||||
:class="chatStatusInfo.badgeClass"
|
||||
v-if="chatStatusInfo.badgeText"
|
||||
>
|
||||
<text class="badge-text">{{ chatStatusInfo.badgeText }}</text>
|
||||
</view>
|
||||
</view>
|
||||
@ -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);
|
||||
});
|
||||
|
||||
// 页面隐藏
|
||||
|
||||
@ -1,9 +1,6 @@
|
||||
<template>
|
||||
<view class="message-page">
|
||||
<!-- 标题栏 -->
|
||||
<view class="message-header">
|
||||
<text class="header-title">咨询</text>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 消息列表 -->
|
||||
<scroll-view
|
||||
@ -201,6 +198,7 @@ const initIM = async () => {
|
||||
|
||||
// 加载会话列表
|
||||
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(() => {
|
||||
// 清除防抖定时器
|
||||
|
||||
@ -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(),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user