This commit is contained in:
2022-01-30 15:41:02 +08:00
parent 81db40ac22
commit 3ae6ab881b
2 changed files with 20 additions and 20 deletions

View File

@@ -30,13 +30,13 @@
</block>
<block v-else>
<u-alert type="warning" v-if="connection != 0" description="网络似乎断开了" :show-icon="true" />
<view v-for="(item, index) in conversations" :key="index"
:class="['message', { 'is-top': item.isTop }]" @tap="toDetail(item)"
@longpress="onLongPress" :data-item="item">
<view v-for="(item, index) in conversations" :key="index" :class="['message', { 'is-top': item.isTop }]"
@tap="toDetail(item)" @longpress="onLongPress" :data-item="item">
<view class="avatar">
<u-badge numberType="ellipsis" max="99" shape="horn" absolute :offset="[-5, -5]"
:value="item.unreadMessageCount" />
<u-avatar :src="friend(item.targetId).portraitUrl || require('@/static/user/cover.png')" shape="square" size="46" />
<u-avatar :src="friend(item.targetId).portraitUrl || require('@/static/user/cover.png')"
shape="square" size="46" />
</view>
<view class="content">
<view class="header">
@@ -99,15 +99,12 @@
}
},
onLoad() {
if (this.isShown) {
uni.$on('onReceiveMessage', (msg) => {
console.log(msg);
this.getConversationList()
})
uni.$on('onConnectionStatusChange', (status) => {
this.connection = status
})
}
},
onShow() {
if (this.$store.state.token !== '') {
@@ -199,7 +196,8 @@
toDetail(item) {
this.hidePop()
uni.navigateTo({
url: '/pages/im/private/chat?targetId=' + item.targetId + '&conversationType=' + item.conversationType
url: '/pages/im/private/chat?targetId=' + item.targetId + '&conversationType=' + item
.conversationType
})
// url: '/pages/im/private/index?targetId=' + item.targetId + '&conversationType=' + item.conversationType
@@ -417,7 +415,8 @@
}
}
}
.u-border-bottom{
.u-border-bottom {
border-bottom: solid 1rpx #f9f9f9 !important;
}
</style>

View File

@@ -118,6 +118,7 @@ const addListeners = () => {
console.log('收到消息', res.data.message);
const message = res.data.message
if (inArray(message.objectName, notifyMsgTypes)) {
console.log('new Message');
newMessage(message)
}
})