fix: 历史聊天active绑定

This commit is contained in:
yangzhe 2025-07-11 13:43:04 +08:00
parent e918f808a4
commit e3834d5428
2 changed files with 23 additions and 5 deletions

View File

@ -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)"
>
<!-- currentActiveGroup === groupIndex &&
currentActiveIndex === index, -->
<text class="chat-text">{{ item.title }}</text>
</view>
</view>
@ -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", {

View File

@ -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 {