merge
This commit is contained in:
@@ -17,11 +17,10 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<u-alert type="warning" v-if="connection != 0" description="网络似乎断开了,请检查网络" :show-icon="true" />
|
||||
</view>
|
||||
<!-- content -->
|
||||
<view v-if="$store.state.token !== ''">
|
||||
<view @click="onDemo">临时测试用</view>
|
||||
<connection-status :connection="connection" />
|
||||
<conversation-list @refresh="getConversationList()" :conversations="conversations" />
|
||||
</view>
|
||||
<!-- 未登录 -->
|
||||
@@ -39,7 +38,8 @@
|
||||
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
||||
import im from '@/utils/im/index.js'
|
||||
import userAuth from '@/public/userAuth'
|
||||
import conversationList from './components/conversationList'
|
||||
import conversationList from './components/conversationList'
|
||||
import connectionStatus from './components/connectionStatus'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
@@ -50,20 +50,24 @@
|
||||
}
|
||||
},
|
||||
components: {
|
||||
conversationList
|
||||
conversationList,
|
||||
connectionStatus
|
||||
},
|
||||
onLoad() {
|
||||
// 好友申请数量
|
||||
this.checkNewFriendPending()
|
||||
uni.$on('onConnectionStatusChange', (status) => {
|
||||
this.connection = status
|
||||
// 监听新的好友申请
|
||||
uni.$on('onContactNotification', () => {
|
||||
this.checkNewFriendPending()
|
||||
})
|
||||
uni.$on('onContactNotification', this.checkNewFriendPending)
|
||||
},
|
||||
onShow() {
|
||||
if (this.$store.state.token !== '') {
|
||||
this.getConversationList()
|
||||
}
|
||||
uni.$on('onConnectionStatusChange', (status) => {
|
||||
this.connection = status
|
||||
})
|
||||
// 监听新消息
|
||||
uni.$on('onReceiveMessage', (msg) => {
|
||||
this.getConversationList()
|
||||
@@ -97,9 +101,12 @@
|
||||
getConversationList() {
|
||||
const count = 1000
|
||||
const timestamp = 0
|
||||
RongIMLib.getConversationList([1, 3], count, timestamp, (res) => {
|
||||
if (res.code === 0) {
|
||||
this.conversations = res.conversations
|
||||
RongIMLib.getConversationList([1, 3], count, timestamp, ({
|
||||
code,
|
||||
conversations
|
||||
}) => {
|
||||
if (code === 0) {
|
||||
this.conversations = conversations
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -137,9 +144,9 @@
|
||||
<style lang="scss" scoped>
|
||||
// contents
|
||||
.contents {
|
||||
background-color: $window-color;
|
||||
background-color: #fff;
|
||||
min-height: 100vh;
|
||||
padding-top: 90rpx + 20rpx;
|
||||
padding-top: 90rpx + 6rpx;
|
||||
box-sizing: border-box;
|
||||
|
||||
.custom-header {
|
||||
|
||||
Reference in New Issue
Block a user