...
This commit is contained in:
@@ -2,12 +2,13 @@
|
||||
<view class="message--cell">
|
||||
<view class="avatar">
|
||||
<u-badge max="99" shape="horn" absolute :offset="[-5, -8]" :value="item.unreadMessageCount" />
|
||||
<u-avatar :src="contact(item.targetId).portraitUrl" shape="square" :size="avatarSize" />
|
||||
<!-- <u-avatar :src="item.portraitUrl !== '' ? contact(item.targetId).portraitUrl : require('@/static/user/cover-s.png')" shape="square" :size="avatarSize" /> -->
|
||||
<u-avatar :src="require('@/static/user/cover-s.png')" shape="square" :size="avatarSize" />
|
||||
</view>
|
||||
<view class="content">
|
||||
<view class="header">
|
||||
<view class="name">
|
||||
{{ contact(item.targetId).name }}
|
||||
{{ contact(item.targetId).name }} {{item.portraitUrl}}
|
||||
<text v-if="item.conversationType === 3" class='group'>[群]</text>
|
||||
</view>
|
||||
<view class="time">{{ item.sentTime|timeCustomCN }}</view>
|
||||
|
||||
@@ -5,7 +5,9 @@
|
||||
<view class="custom-header">
|
||||
<view class="header-flex">
|
||||
<view class="tabs">
|
||||
<view class="item active">聊聊</view>
|
||||
<view class="item" @click="tabsClick('all')" :class="activeId === 'all'?'active':''">全部</view>
|
||||
<view class="item" @click="tabsClick('self')" :class="activeId === 'self'?'active':''">私聊</view>
|
||||
<view class="item" @click="tabsClick('group')" :class="activeId === 'group'?'active':''">群聊</view>
|
||||
</view>
|
||||
<view class="btns">
|
||||
<view class="item" @click="scanQrCode">
|
||||
@@ -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() {
|
||||
// 好友申请数量
|
||||
this.checkNewFriendPending()
|
||||
|
||||
if (this.$store.state.token !== '') {
|
||||
this.getConversationList()
|
||||
}
|
||||
@@ -76,11 +81,14 @@
|
||||
})
|
||||
},
|
||||
onHide() {
|
||||
// 页面隐藏的时候,不监听了,性能可能会好一点
|
||||
uni.$off('onReceiveMessage')
|
||||
uni.$off('onConnectionStatusChange')
|
||||
},
|
||||
methods: {
|
||||
// 切换聊天模式
|
||||
tabsClick(type){
|
||||
this.activeId = type
|
||||
},
|
||||
checkNewFriendPending() {
|
||||
im.getPendingList((pendings) => {
|
||||
this.hasNewFriends = pendings.length
|
||||
@@ -104,6 +112,8 @@
|
||||
conversations
|
||||
}) => {
|
||||
if (code === 0) {
|
||||
console.log(conversations)
|
||||
console.log("item.conversationType === 3............")
|
||||
this.conversations = conversations
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user