From 1d648f2dc12ae2cf71aa7ba6e3ce8c8501d51834 Mon Sep 17 00:00:00 2001 From: zhangdongxue Date: Wed, 23 Feb 2022 17:08:28 +0800 Subject: [PATCH] ... --- pages/im/components/messageCell.vue | 5 +++-- pages/im/index.vue | 26 ++++++++++++++++++-------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/pages/im/components/messageCell.vue b/pages/im/components/messageCell.vue index 87ec20e..0e465d6 100644 --- a/pages/im/components/messageCell.vue +++ b/pages/im/components/messageCell.vue @@ -2,12 +2,13 @@ - + + - {{ contact(item.targetId).name }} + {{ contact(item.targetId).name }} {{item.portraitUrl}} [群] {{ item.sentTime|timeCustomCN }} diff --git a/pages/im/index.vue b/pages/im/index.vue index ef370a6..c513af7 100644 --- a/pages/im/index.vue +++ b/pages/im/index.vue @@ -5,7 +5,9 @@ - 聊聊 + 全部 + 私聊 + 群聊 @@ -46,7 +48,8 @@ return { conversations: [], // 会话列表 connection: 0, - hasNewFriends: 0 + hasNewFriends: 0, + activeId:'all', } }, components: { @@ -54,12 +57,14 @@ connectionStatus }, onLoad() { - // 好友申请数量 - this.checkNewFriendPending() + // 监听新的好友申请 uni.$on('onNewContactConversation', this.checkNewFriendPending) }, - onShow() { + onShow() { + // 好友申请数量 + this.checkNewFriendPending() + if (this.$store.state.token !== '') { this.getConversationList() } @@ -76,11 +81,14 @@ }) }, onHide() { - // 页面隐藏的时候,不监听了,性能可能会好一点 uni.$off('onReceiveMessage') uni.$off('onConnectionStatusChange') }, - methods: { + methods: { + // 切换聊天模式 + tabsClick(type){ + this.activeId = type + }, checkNewFriendPending() { im.getPendingList((pendings) => { this.hasNewFriends = pendings.length @@ -103,7 +111,9 @@ code, conversations }) => { - if (code === 0) { + if (code === 0) { + console.log(conversations) + console.log("item.conversationType === 3............") this.conversations = conversations } })