update
This commit is contained in:
@@ -30,13 +30,13 @@
|
|||||||
</block>
|
</block>
|
||||||
<block v-else>
|
<block v-else>
|
||||||
<u-alert type="warning" v-if="connection != 0" description="网络似乎断开了" :show-icon="true" />
|
<u-alert type="warning" v-if="connection != 0" description="网络似乎断开了" :show-icon="true" />
|
||||||
<view v-for="(item, index) in conversations" :key="index"
|
<view v-for="(item, index) in conversations" :key="index" :class="['message', { 'is-top': item.isTop }]"
|
||||||
:class="['message', { 'is-top': item.isTop }]" @tap="toDetail(item)"
|
@tap="toDetail(item)" @longpress="onLongPress" :data-item="item">
|
||||||
@longpress="onLongPress" :data-item="item">
|
|
||||||
<view class="avatar">
|
<view class="avatar">
|
||||||
<u-badge numberType="ellipsis" max="99" shape="horn" absolute :offset="[-5, -5]"
|
<u-badge numberType="ellipsis" max="99" shape="horn" absolute :offset="[-5, -5]"
|
||||||
:value="item.unreadMessageCount" />
|
: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>
|
||||||
<view class="content">
|
<view class="content">
|
||||||
<view class="header">
|
<view class="header">
|
||||||
@@ -99,15 +99,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
if (this.isShown) {
|
|
||||||
uni.$on('onReceiveMessage', (msg) => {
|
uni.$on('onReceiveMessage', (msg) => {
|
||||||
console.log(msg);
|
|
||||||
this.getConversationList()
|
this.getConversationList()
|
||||||
})
|
})
|
||||||
uni.$on('onConnectionStatusChange', (status) => {
|
uni.$on('onConnectionStatusChange', (status) => {
|
||||||
this.connection = status
|
this.connection = status
|
||||||
})
|
})
|
||||||
}
|
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
if (this.$store.state.token !== '') {
|
if (this.$store.state.token !== '') {
|
||||||
@@ -199,7 +196,8 @@
|
|||||||
toDetail(item) {
|
toDetail(item) {
|
||||||
this.hidePop()
|
this.hidePop()
|
||||||
uni.navigateTo({
|
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
|
// url: '/pages/im/private/index?targetId=' + item.targetId + '&conversationType=' + item.conversationType
|
||||||
@@ -417,6 +415,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.u-border-bottom {
|
.u-border-bottom {
|
||||||
border-bottom: solid 1rpx #f9f9f9 !important;
|
border-bottom: solid 1rpx #f9f9f9 !important;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ const addListeners = () => {
|
|||||||
console.log('收到消息', res.data.message);
|
console.log('收到消息', res.data.message);
|
||||||
const message = res.data.message
|
const message = res.data.message
|
||||||
if (inArray(message.objectName, notifyMsgTypes)) {
|
if (inArray(message.objectName, notifyMsgTypes)) {
|
||||||
|
console.log('new Message');
|
||||||
newMessage(message)
|
newMessage(message)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user