diff --git a/im-uniapp/components/chat-item/chat-item.vue b/im-uniapp/components/chat-item/chat-item.vue index 9c9b1c3..d697e87 100644 --- a/im-uniapp/components/chat-item/chat-item.vue +++ b/im-uniapp/components/chat-item/chat-item.vue @@ -3,7 +3,7 @@ - + @@ -45,7 +45,7 @@ export default { methods: { showChatBox() { // 初始化期间进入会话会导致消息不刷新 - if (!getApp().$vm.isInit || this.chatStore.isLoading()) { + if (!this.configStore.appInit || this.chatStore.isLoading()) { uni.showToast({ title: "正在初始化页面,请稍后...", icon: 'none' @@ -86,6 +86,13 @@ export default { nodesText() { let text = this.$str.html2Escape(this.chat.lastContent); return this.$emo.transform(text, 'emoji-small') + }, + online() { + if (this.chat.type == 'PRIVATE') { + let friend = this.friendStore.findFriend(this.chat.targetId); + return friend && friend.online; + } + return false; } } } diff --git a/im-web/src/components/chat/ChatItem.vue b/im-web/src/components/chat/ChatItem.vue index c050020..c997ef4 100644 --- a/im-web/src/components/chat/ChatItem.vue +++ b/im-web/src/components/chat/ChatItem.vue @@ -2,7 +2,7 @@
+ :id="chat.type == 'PRIVATE' ? chat.targetId : 0" :isShowUserInfo="false" :online="online">
{{ chat.unreadCount }}
@@ -16,7 +16,8 @@
{{ atText }}
{{ chat.sendNickName + ': ' }}
-
+
@@ -102,6 +103,13 @@ export default { color: '#F56C6C' }) return items; + }, + online() { + if (this.chat.type == 'PRIVATE') { + let friend = this.friendStore.findFriend(this.chat.targetId); + return friend && friend.online; + } + return false; } } }