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