优化
This commit is contained in:
@@ -41,6 +41,10 @@ export function getConversationList(goeasy) {
|
||||
},
|
||||
onFailed: function (error) { //获取失败
|
||||
console.log("获取会话列表失败, code:" + error.code + " content:" + error.content);
|
||||
uni.showToast({
|
||||
title: "获取会话列表失败",
|
||||
icon: "none",
|
||||
});
|
||||
},
|
||||
});
|
||||
});
|
||||
@@ -61,6 +65,10 @@ export function getConversationMessages(goeasy, userid, imestamp) {
|
||||
}, //查询成功
|
||||
onFailed: function (error) {
|
||||
console.log("获取消息列表失败, code:" + error.code + " content:" + error.content);
|
||||
uni.showToast({
|
||||
title: "获取消息列表失败",
|
||||
icon: "none",
|
||||
});
|
||||
}, //查询失败
|
||||
});
|
||||
});
|
||||
@@ -88,6 +96,10 @@ export function sendMessage(goeasy, userid, message, avatar, nickname) {
|
||||
},
|
||||
onFailed: function (error) { //发送失败
|
||||
console.log('发送消息失败,code:' + error.code + ' ,error ' + error.content);
|
||||
uni.showToast({
|
||||
title: "发送消息失败",
|
||||
icon: "none",
|
||||
});
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
@@ -107,6 +119,10 @@ export function messageRead(goeasy, userid) {
|
||||
},
|
||||
onFailed: function (error) {
|
||||
console.log('标记私聊已读失败', error);
|
||||
uni.showToast({
|
||||
title: "标记私聊已读失败",
|
||||
icon: "none",
|
||||
});
|
||||
},
|
||||
});
|
||||
});
|
||||
@@ -135,6 +151,10 @@ export function sendCustomMessage(goeasy, type, userid, order, avatar, nickname)
|
||||
},
|
||||
onFailed: function (error) { //发送失败
|
||||
console.log('Failed to send message,code:' + error.code + ',error' + error.content);
|
||||
uni.showToast({
|
||||
title: "发送自定义消息失败",
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -146,14 +166,18 @@ export function conversationTop(goeasy, conversation, top) {
|
||||
var im = goeasy.im;
|
||||
im.topConversation({
|
||||
conversation: conversation,
|
||||
top:top ,//或者 false
|
||||
top: top,//或者 false
|
||||
onSuccess: function () {
|
||||
resolve('成功');
|
||||
},
|
||||
onFailed: function (error) {
|
||||
console.log( '失败:', error);
|
||||
console.log('失败:', error);
|
||||
uni.showToast({
|
||||
title: "置顶会话失败",
|
||||
icon: "none",
|
||||
});
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
//删除会话
|
||||
@@ -166,8 +190,32 @@ export function conversationDelete(goeasy, conversation) {
|
||||
resolve('删除会话成功');
|
||||
},
|
||||
onFailed: function (error) {
|
||||
console.log(error);
|
||||
console.log(error);
|
||||
uni.showToast({
|
||||
title: "删除会话失败",
|
||||
icon: "none",
|
||||
});
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
//发送消息
|
||||
export function sendGroupMessage(goeasy, message) {
|
||||
return new Promise((resolve, reject) => {
|
||||
var im = goeasy.im;
|
||||
//发送消息
|
||||
im.sendMessage({
|
||||
message: message,
|
||||
onSuccess: () => {
|
||||
resolve(message);
|
||||
},
|
||||
onFailed: function (error) {
|
||||
uni.showToast({
|
||||
title: "发送消息失败",
|
||||
icon: "none",
|
||||
});
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user