From e3834d5428bcd17cae7e3622f779d90727b5ce8c Mon Sep 17 00:00:00 2001 From: yangzhe Date: Fri, 11 Jul 2025 13:43:04 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8E=86=E5=8F=B2=E8=81=8A=E5=A4=A9acti?= =?UTF-8?q?ve=E7=BB=91=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/ChatHistory.vue | 10 +++++----- pages/home/index/index.vue | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/components/ChatHistory.vue b/components/ChatHistory.vue index bd5931f..f375c9f 100644 --- a/components/ChatHistory.vue +++ b/components/ChatHistory.vue @@ -29,12 +29,12 @@ v-for="(item, index) in group.conversation" :key="'conv-' + groupIndex + '-' + index" :class="{ - 'chat-item-active': - currentActiveGroup === groupIndex && - currentActiveIndex === index, + 'chat-item-active': item.isActiveChat, }" @click="selectChatItem(groupIndex, index, item.id)" > + {{ item.title }} @@ -99,8 +99,8 @@ export default { }, methods: { selectChatItem(groupIndex, index, conversationId) { - this.currentActiveGroup = groupIndex; - this.currentActiveIndex = index; + // this.currentActiveGroup = groupIndex; + // this.currentActiveIndex = index; // 向父组件发送选中的对话信息 this.$emit("select-conversation", { diff --git a/pages/home/index/index.vue b/pages/home/index/index.vue index 12b6448..99ae034 100644 --- a/pages/home/index/index.vue +++ b/pages/home/index/index.vue @@ -394,6 +394,21 @@ export default { handleLeftClick() { this.$u.api.GetConversationPage().then((res) => { this.chatHistoryList3 = res.data; + if (this.chatHistoryList3.length > 0) { + this.chatHistoryList3 = res.data.map((group) => { + // 对每个组的conversation数组进行倒序排序 + return { + ...group, + conversation: group.conversation.sort((a, b) => { + // 将日期字符串转换为时间戳并比较(倒序) + return ( + new Date(b.startTime).getTime() - + new Date(a.startTime).getTime() + ); + }), + }; + }); + } console.log("this.chatHistoryList3", this.chatHistoryList3); this.popupShow = true; @@ -543,6 +558,8 @@ export default { // 否则按时间升序排列 return timeA - timeB; }); + + this.scrollToBottom(); }); }, @@ -571,6 +588,7 @@ page { background-repeat: no-repeat; background-size: 100% 100%; background-position: 0 88rpx; + // overflow-y: scroll; } .home-container {