...
This commit is contained in:
@@ -2,12 +2,13 @@
|
|||||||
<view class="message--cell">
|
<view class="message--cell">
|
||||||
<view class="avatar">
|
<view class="avatar">
|
||||||
<u-badge max="99" shape="horn" absolute :offset="[-5, -8]" :value="item.unreadMessageCount" />
|
<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>
|
||||||
<view class="content">
|
<view class="content">
|
||||||
<view class="header">
|
<view class="header">
|
||||||
<view class="name">
|
<view class="name">
|
||||||
{{ contact(item.targetId).name }}
|
{{ contact(item.targetId).name }} {{item.portraitUrl}}
|
||||||
<text v-if="item.conversationType === 3" class='group'>[群]</text>
|
<text v-if="item.conversationType === 3" class='group'>[群]</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="time">{{ item.sentTime|timeCustomCN }}</view>
|
<view class="time">{{ item.sentTime|timeCustomCN }}</view>
|
||||||
|
|||||||
@@ -5,7 +5,9 @@
|
|||||||
<view class="custom-header">
|
<view class="custom-header">
|
||||||
<view class="header-flex">
|
<view class="header-flex">
|
||||||
<view class="tabs">
|
<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>
|
||||||
<view class="btns">
|
<view class="btns">
|
||||||
<view class="item" @click="scanQrCode">
|
<view class="item" @click="scanQrCode">
|
||||||
@@ -46,7 +48,8 @@
|
|||||||
return {
|
return {
|
||||||
conversations: [], // 会话列表
|
conversations: [], // 会话列表
|
||||||
connection: 0,
|
connection: 0,
|
||||||
hasNewFriends: 0
|
hasNewFriends: 0,
|
||||||
|
activeId:'all',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
@@ -54,12 +57,14 @@
|
|||||||
connectionStatus
|
connectionStatus
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
// 好友申请数量
|
|
||||||
this.checkNewFriendPending()
|
|
||||||
// 监听新的好友申请
|
// 监听新的好友申请
|
||||||
uni.$on('onNewContactConversation', this.checkNewFriendPending)
|
uni.$on('onNewContactConversation', this.checkNewFriendPending)
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
|
// 好友申请数量
|
||||||
|
this.checkNewFriendPending()
|
||||||
|
|
||||||
if (this.$store.state.token !== '') {
|
if (this.$store.state.token !== '') {
|
||||||
this.getConversationList()
|
this.getConversationList()
|
||||||
}
|
}
|
||||||
@@ -76,11 +81,14 @@
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
onHide() {
|
onHide() {
|
||||||
// 页面隐藏的时候,不监听了,性能可能会好一点
|
|
||||||
uni.$off('onReceiveMessage')
|
uni.$off('onReceiveMessage')
|
||||||
uni.$off('onConnectionStatusChange')
|
uni.$off('onConnectionStatusChange')
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 切换聊天模式
|
||||||
|
tabsClick(type){
|
||||||
|
this.activeId = type
|
||||||
|
},
|
||||||
checkNewFriendPending() {
|
checkNewFriendPending() {
|
||||||
im.getPendingList((pendings) => {
|
im.getPendingList((pendings) => {
|
||||||
this.hasNewFriends = pendings.length
|
this.hasNewFriends = pendings.length
|
||||||
@@ -103,7 +111,9 @@
|
|||||||
code,
|
code,
|
||||||
conversations
|
conversations
|
||||||
}) => {
|
}) => {
|
||||||
if (code === 0) {
|
if (code === 0) {
|
||||||
|
console.log(conversations)
|
||||||
|
console.log("item.conversationType === 3............")
|
||||||
this.conversations = conversations
|
this.conversations = conversations
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user