fix: 历史聊天active绑定
This commit is contained in:
parent
e918f808a4
commit
e3834d5428
|
@ -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", {
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue