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" v-for="(item, index) in group.conversation"
:key="'conv-' + groupIndex + '-' + index" :key="'conv-' + groupIndex + '-' + index"
:class="{ :class="{
'chat-item-active': 'chat-item-active': item.isActiveChat,
currentActiveGroup === groupIndex &&
currentActiveIndex === index,
}" }"
@click="selectChatItem(groupIndex, index, item.id)" @click="selectChatItem(groupIndex, index, item.id)"
> >
<!-- currentActiveGroup === groupIndex &&
currentActiveIndex === index, -->
<text class="chat-text">{{ item.title }}</text> <text class="chat-text">{{ item.title }}</text>
</view> </view>
</view> </view>
@ -99,8 +99,8 @@ export default {
}, },
methods: { methods: {
selectChatItem(groupIndex, index, conversationId) { selectChatItem(groupIndex, index, conversationId) {
this.currentActiveGroup = groupIndex; // this.currentActiveGroup = groupIndex;
this.currentActiveIndex = index; // this.currentActiveIndex = index;
// //
this.$emit("select-conversation", { this.$emit("select-conversation", {

View File

@ -394,6 +394,21 @@ export default {
handleLeftClick() { handleLeftClick() {
this.$u.api.GetConversationPage().then((res) => { this.$u.api.GetConversationPage().then((res) => {
this.chatHistoryList3 = res.data; 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); console.log("this.chatHistoryList3", this.chatHistoryList3);
this.popupShow = true; this.popupShow = true;
@ -543,6 +558,8 @@ export default {
// //
return timeA - timeB; return timeA - timeB;
}); });
this.scrollToBottom();
}); });
}, },
@ -571,6 +588,7 @@ page {
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: 100% 100%; background-size: 100% 100%;
background-position: 0 88rpx; background-position: 0 88rpx;
// overflow-y: scroll;
} }
.home-container { .home-container {