Merge branch 'master' of https://git.yuzhankeji.cn/TmOct5/ZhHealth
This commit is contained in:
@@ -373,9 +373,7 @@
|
|||||||
{
|
{
|
||||||
"path": "pages/im/private/chat",
|
"path": "pages/im/private/chat",
|
||||||
"style": {
|
"style": {
|
||||||
"disableScroll": true,
|
|
||||||
"navigationBarTitleText": "聊天",
|
"navigationBarTitleText": "聊天",
|
||||||
"enablePullDownRefresh": false,
|
|
||||||
"navigationBarBackgroundColor": "#F3F6FB"
|
"navigationBarBackgroundColor": "#F3F6FB"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
:src="contact(friendItem.targetId).portraitUrl" />
|
:src="contact(friendItem.targetId).portraitUrl" />
|
||||||
<view class="info">
|
<view class="info">
|
||||||
<view class="name">{{ contact(friendItem.targetId).name }}</view>
|
<view class="name">{{ contact(friendItem.targetId).name }}</view>
|
||||||
<!-- <view class="address">Hash:{{ friendItem.address }}</view> -->
|
<!-- <view class="address">地址:{{ friendItem.address }}</view> -->
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</u-index-item>
|
</u-index-item>
|
||||||
@@ -66,13 +66,8 @@
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
checkNewFriendPending() {
|
checkNewFriendPending() {
|
||||||
// 获取是否有新的好友申请
|
im.getPendingList((pendings) => {
|
||||||
RongIMLib.getConversationList([RongIMLib.ConversationType.SYSTEM], 1000, 0, (res) => {
|
this.pendingCount = pendings.length
|
||||||
if (res.code === 0) {
|
|
||||||
this.pendingCount = res.conversations.filter((item) => {
|
|
||||||
return item.objectName == RongIMLib.ObjectName.ContactNotification
|
|
||||||
}).length
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
toGroup() {
|
toGroup() {
|
||||||
|
|||||||
@@ -5,7 +5,8 @@
|
|||||||
<view class="cell" v-for="(item, index) in messages" :key="index">
|
<view class="cell" v-for="(item, index) in messages" :key="index">
|
||||||
<view class="time">{{ item.sentTime|timeCustomCN }}</view>
|
<view class="time">{{ item.sentTime|timeCustomCN }}</view>
|
||||||
<view :class="['cell-item', item.messageDirection == 1 ? 'right' : 'left']">
|
<view :class="['cell-item', item.messageDirection == 1 ? 'right' : 'left']">
|
||||||
<u-avatar class="avatar" size="40" shape="square" @click="showUser(item.senderUserId, item.messageDirection)"
|
<u-avatar class="avatar" size="40" shape="square"
|
||||||
|
@click="showUser(item.senderUserId, item.messageDirection)"
|
||||||
:src="contact(item.senderUserId).portraitUrl" />
|
:src="contact(item.senderUserId).portraitUrl" />
|
||||||
<view class="msg">
|
<view class="msg">
|
||||||
<show-voice v-if="item.objectName === 'RC:HQVCMsg'" :guest="item.messageDirection == 1"
|
<show-voice v-if="item.objectName === 'RC:HQVCMsg'" :guest="item.messageDirection == 1"
|
||||||
@@ -56,7 +57,7 @@
|
|||||||
computed: {
|
computed: {
|
||||||
latestMessage() {
|
latestMessage() {
|
||||||
if (this.messages.length) {
|
if (this.messages.length) {
|
||||||
return this.messages[this.messages.length - 1]
|
return this.messages[0]
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
sentTime: 0
|
sentTime: 0
|
||||||
@@ -108,6 +109,7 @@
|
|||||||
1,
|
1,
|
||||||
false,
|
false,
|
||||||
(messages) => {
|
(messages) => {
|
||||||
|
console.log(messages);
|
||||||
this.messages.unshift(...messages)
|
this.messages.unshift(...messages)
|
||||||
// this.scrollBottom()
|
// this.scrollBottom()
|
||||||
})
|
})
|
||||||
@@ -158,14 +160,13 @@
|
|||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
/* 窗口 */
|
/* 窗口 */
|
||||||
.chat {
|
.chat {
|
||||||
background: $window-color;
|
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
overflow: scroll;
|
||||||
|
|
||||||
.body {
|
.body {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
overflow-y: scroll;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column-reverse;
|
flex-direction: column-reverse;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ const imLibListeners = () => {
|
|||||||
// 调用完更新之后,删除这条消息
|
// 调用完更新之后,删除这条消息
|
||||||
IMLib.deleteMessagesByIds([message.messageId])
|
IMLib.deleteMessagesByIds([message.messageId])
|
||||||
} else if (message.objectName === IMLib.ObjectName.ContactNotification) {
|
} else if (message.objectName === IMLib.ObjectName.ContactNotification) {
|
||||||
|
console.error('触发一个新好友的通知事件', message);
|
||||||
// 触发一个新好友的通知事件
|
// 触发一个新好友的通知事件
|
||||||
uni.$emit('onContactNotification', message)
|
uni.$emit('onContactNotification', message)
|
||||||
} else if (message.objectName === IMLib.ObjectName.GroupNotification) {
|
} else if (message.objectName === IMLib.ObjectName.GroupNotification) {
|
||||||
|
|||||||
@@ -57,6 +57,22 @@ const getPendingList = (callback, total) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 群组申请列表,邀请列表
|
||||||
|
const getGroupPendinglist = (targetId, callback) => {
|
||||||
|
total = total || 100
|
||||||
|
RongIMLib.getConversationList([RongIMLib.ConversationType.SYSTEM], total, 0, (res) => {
|
||||||
|
if (res.code === 0) {
|
||||||
|
const pendings = res.conversations.filter((item) => {
|
||||||
|
return item.targetId == targetId &&
|
||||||
|
item.objectName == RongIMLib.ObjectName.ContactNotification &&
|
||||||
|
item.latestMessage.operation === 'GroupPending'
|
||||||
|
})
|
||||||
|
|
||||||
|
callback(pendings)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送文本消息
|
* 发送文本消息
|
||||||
* @param {number} conversationType 消息类型
|
* @param {number} conversationType 消息类型
|
||||||
@@ -209,6 +225,7 @@ const sendFile = (conversationType, targetId, fileUrl, time, user, callback) =>
|
|||||||
export default {
|
export default {
|
||||||
getMessageList,
|
getMessageList,
|
||||||
getPendingList,
|
getPendingList,
|
||||||
|
getGroupPendinglist,
|
||||||
sentText,
|
sentText,
|
||||||
sentVoice,
|
sentVoice,
|
||||||
sentImage,
|
sentImage,
|
||||||
|
|||||||
Reference in New Issue
Block a user