资料修改的事件通知
This commit is contained in:
@@ -62,10 +62,9 @@
|
|||||||
actionMap: [],
|
actionMap: [],
|
||||||
actionTitle: '',
|
actionTitle: '',
|
||||||
currentUser: {},
|
currentUser: {},
|
||||||
avatarSize: 45,
|
avatarSize: 40,
|
||||||
labelSize: 14,
|
labelSize: 14,
|
||||||
iconSize: 14
|
iconSize: 14
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -76,7 +75,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.avatarSize = utils.rpx2px(90)
|
this.avatarSize = utils.rpx2px(84)
|
||||||
this.labelSize = utils.rpx2px(24)
|
this.labelSize = utils.rpx2px(24)
|
||||||
this.iconSize = utils.rpx2px(26)
|
this.iconSize = utils.rpx2px(26)
|
||||||
},
|
},
|
||||||
@@ -277,7 +276,6 @@
|
|||||||
border-radius: 0 8rpx 0 0;
|
border-radius: 0 8rpx 0 0;
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 84rpx;
|
width: 84rpx;
|
||||||
height: 84rpx;
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
.admin {
|
.admin {
|
||||||
|
|||||||
@@ -55,12 +55,7 @@
|
|||||||
},
|
},
|
||||||
onLoad(e) {
|
onLoad(e) {
|
||||||
this.targetId = e.targetId
|
this.targetId = e.targetId
|
||||||
// 获取群成员数量
|
this.initGroupInfo()
|
||||||
getGroupBase(this.targetId).then(res => {
|
|
||||||
uni.setNavigationBarTitle({
|
|
||||||
title: res.name + `(${res.members})`
|
|
||||||
})
|
|
||||||
})
|
|
||||||
// 获取历史消息列表
|
// 获取历史消息列表
|
||||||
this.getMessageList()
|
this.getMessageList()
|
||||||
// 监听新消息
|
// 监听新消息
|
||||||
@@ -104,6 +99,7 @@
|
|||||||
},
|
},
|
||||||
onUnload() {
|
onUnload() {
|
||||||
uni.$off('onReceiveMessage_' + this.targetId)
|
uni.$off('onReceiveMessage_' + this.targetId)
|
||||||
|
uni.$off('onUpdateProfile_' + this.targetId)
|
||||||
uni.$off('onRecallMessage')
|
uni.$off('onRecallMessage')
|
||||||
uni.$off('onReceiptRequest')
|
uni.$off('onReceiptRequest')
|
||||||
uni.$off('onReceiptResponse')
|
uni.$off('onReceiptResponse')
|
||||||
@@ -114,6 +110,14 @@
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
initGroupInfo() {
|
||||||
|
// 获取群信息,成员数量,设置标题
|
||||||
|
getGroupBase(this.targetId).then(res => {
|
||||||
|
uni.setNavigationBarTitle({
|
||||||
|
title: res.name + `(${res.members})`
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
onScroll(e) {
|
onScroll(e) {
|
||||||
this.$refs.messageBar.onHidePopus()
|
this.$refs.messageBar.onHidePopus()
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ const onReceiveMessage = (message) => {
|
|||||||
const checkContactExists = (message) => {
|
const checkContactExists = (message) => {
|
||||||
if (!store.getters.contactIsExist(message.targetId)) {
|
if (!store.getters.contactIsExist(message.targetId)) {
|
||||||
getUserInfo(message.targetId).then(res => {
|
getUserInfo(message.targetId).then(res => {
|
||||||
|
console.log('targetId', res);
|
||||||
store.dispatch('initContact', res)
|
store.dispatch('initContact', res)
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.error('getUserInfo ERR', err)
|
console.error('getUserInfo ERR', err)
|
||||||
@@ -37,6 +38,7 @@ const checkContactExists = (message) => {
|
|||||||
}
|
}
|
||||||
if (!store.getters.contactIsExist(message.senderUserId)) {
|
if (!store.getters.contactIsExist(message.senderUserId)) {
|
||||||
getUserInfo(message.senderUserId).then(res => {
|
getUserInfo(message.senderUserId).then(res => {
|
||||||
|
console.log('senderUserId', message.senderUserId, res);
|
||||||
store.dispatch('initContact', res)
|
store.dispatch('initContact', res)
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.error('getUserInfo ERR', err)
|
console.error('getUserInfo ERR', err)
|
||||||
@@ -70,6 +72,7 @@ const imLibListeners = () => {
|
|||||||
if (utils.inArray(message.objectName, notifyMsgTypes)) {
|
if (utils.inArray(message.objectName, notifyMsgTypes)) {
|
||||||
onReceiveMessage(message)
|
onReceiveMessage(message)
|
||||||
} else if (message.objectName === IMLib.ObjectName.ProfileNotification) {
|
} else if (message.objectName === IMLib.ObjectName.ProfileNotification) {
|
||||||
|
uni.$emit('onUpdateProfile_' + message.targetId)
|
||||||
// 更新联系人信息
|
// 更新联系人信息
|
||||||
store.dispatch('updateContact', JSON.parse(message.content.data))
|
store.dispatch('updateContact', JSON.parse(message.content.data))
|
||||||
// 调用完更新之后,删除这条消息
|
// 调用完更新之后,删除这条消息
|
||||||
@@ -89,6 +92,19 @@ const imLibListeners = () => {
|
|||||||
// 发布群解散的消息
|
// 发布群解散的消息
|
||||||
uni.$emit('onGroupDismiss')
|
uni.$emit('onGroupDismiss')
|
||||||
uni.$emit('onGroupDismiss_' + message.targetId)
|
uni.$emit('onGroupDismiss_' + message.targetId)
|
||||||
|
} else if (message.content.operation === 'REMOVE') {
|
||||||
|
// 要判断是否当前用户,然后把当前用户踢出到主页去, 删除聊天记录,会话列表
|
||||||
|
if (message.content.extra == store.getters.sender.userId) {
|
||||||
|
IMLib.cleanHistoryMessages(message.conversationType, message.targetId, message.sentTime,
|
||||||
|
false)
|
||||||
|
// 解散了就删了吧
|
||||||
|
IMLib.removeConversation(message.conversationType, message.targetId)
|
||||||
|
// 为了更新群列表
|
||||||
|
uni.$emit('onGroupDismiss')
|
||||||
|
uni.$emit('onGroupRemoveYou_' + message.targetId)
|
||||||
|
}
|
||||||
|
uni.$emit('onReceiveMessage_' + message.targetId, message)
|
||||||
|
// 这个是为了更新消息列表页的
|
||||||
}
|
}
|
||||||
// 触发刷新会话列表
|
// 触发刷新会话列表
|
||||||
uni.$emit('onReceiveMessage', message)
|
uni.$emit('onReceiveMessage', message)
|
||||||
|
|||||||
@@ -1,6 +1,13 @@
|
|||||||
// 监听群解散的消息,直接跳转到会话列表页面
|
// 监听群解散的消息,直接跳转到会话列表页面
|
||||||
const onGroupDismiss = {
|
const onGroupDismiss = {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
currentTargetId: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
onLoad(e) {
|
onLoad(e) {
|
||||||
|
this.currentTargetId = e.targetId
|
||||||
|
|
||||||
uni.$once('onGroupDismiss_' + e.targetId, () => {
|
uni.$once('onGroupDismiss_' + e.targetId, () => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
@@ -10,6 +17,19 @@ const onGroupDismiss = {
|
|||||||
url: '/pages/im/index'
|
url: '/pages/im/index'
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
uni.$once('onGroupRemoveYou_' + e.targetId, () => {
|
||||||
|
uni.showToast({
|
||||||
|
icon: 'none',
|
||||||
|
title: '您已被移出群聊'
|
||||||
|
})
|
||||||
|
uni.switchTab({
|
||||||
|
url: '/pages/im/index'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
onUnload() {
|
||||||
|
uni.$off('onGroupDismiss_' + this.currentTargetId)
|
||||||
|
uni.$off('onGroupRemoveYou_' + this.currentTargetId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user