文件消息,地理位置消息
This commit is contained in:
@@ -55,7 +55,8 @@ const notifyMsgTypes = [
|
||||
IMLib.ObjectName.Location,
|
||||
IMLib.ObjectName.Voice,
|
||||
IMLib.ObjectName.HQVoice,
|
||||
IMLib.ObjectName.Sight
|
||||
IMLib.ObjectName.Sight,
|
||||
'RC:IWNormalMsg'
|
||||
]
|
||||
|
||||
const imLibListeners = () => {
|
||||
|
||||
@@ -18,7 +18,8 @@ const getMessageList = (conversationType, targetId, timeStamp, count, isForward,
|
||||
'RC:CombineMsg',
|
||||
'RC:GrpNtf',
|
||||
'RC:InfoNtf',
|
||||
'RC:RcNtf'
|
||||
'RC:RcNtf',
|
||||
'RC:IWNormalMsg'
|
||||
]
|
||||
|
||||
RongIMLib.getHistoryMessagesByTimestamp(
|
||||
@@ -184,10 +185,13 @@ const sentFile = (conversationType, targetId, fileUrl) => {
|
||||
targetId: String(targetId),
|
||||
content: {
|
||||
objectName: 'RC:FileMsg',
|
||||
local: 'file:///' + plus.io.convertLocalFileSystemURL(fileUrl),
|
||||
local: plus.io.convertLocalFileSystemURL(fileUrl),
|
||||
userInfo: store.getters.sender
|
||||
}
|
||||
}
|
||||
|
||||
console.log('发送文件', msg);
|
||||
|
||||
RongIMLib.sendMediaMessage(msg, {
|
||||
success: (messageId) => {
|
||||
resolve(messageId)
|
||||
@@ -201,6 +205,48 @@ const sentFile = (conversationType, targetId, fileUrl) => {
|
||||
})
|
||||
}
|
||||
|
||||
// 发送地理位置
|
||||
const sentLocation = (conversationType, targetId, location) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const msg = {
|
||||
conversationType: conversationType,
|
||||
targetId: String(targetId),
|
||||
objectName: 'RC:LBSMsg',
|
||||
content: {
|
||||
customType: 2,
|
||||
objectName: 'RC:LBSMsg',
|
||||
customFields: {
|
||||
name: location.name,
|
||||
latitude: Number(location.latitude),
|
||||
longitude: Number(location.longitude),
|
||||
thumbnail: ''
|
||||
},
|
||||
userInfo: store.getters.sender,
|
||||
}
|
||||
}
|
||||
|
||||
RongIMLib.sendMessage(msg, ({
|
||||
code,
|
||||
messageId
|
||||
}) => {
|
||||
if (code === 0) {
|
||||
if (conversationType == 3) {
|
||||
RongIMLib.sendReadReceiptRequest(messageId, (res) => {
|
||||
console.log('发送回执请求', res);
|
||||
})
|
||||
}
|
||||
resolve(messageId)
|
||||
} else {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '发送失败' + code
|
||||
})
|
||||
reject(code)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export default {
|
||||
getMessageList,
|
||||
getPendingList,
|
||||
@@ -208,5 +254,6 @@ export default {
|
||||
sentText,
|
||||
sentVoice,
|
||||
sentImage,
|
||||
sentFile
|
||||
sentFile,
|
||||
sentLocation
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user