Commit 5c55a957 by 施宇

1312

parent 00fb5f97
Showing with 22 additions and 23 deletions
......@@ -48,17 +48,16 @@ $(function () {
});
},
addChatMember: function (id) {
console.log(id)
// IcController.getData(apis.addrecord, 'GET', {
// "token": Util.getCookie('token') || '',
// "user_id": id
// }, function (res) {
// if (res.errcode === 0) {
IcController.getData(apis.addrecord, 'GET', {
"token": Util.getCookie('token') || '',
"user_id": id
}, function (res) {
if (res.errcode === 0) {
// } else {
// console.log('添加聊天成员失败')
// }
// },false);
} else {
console.log('添加聊天成员失败')
}
},false);
},
rendChatSection: function (data) {
console.log('获取成员')
......@@ -361,7 +360,7 @@ $(function () {
self.userHtml(0, message, regContent) + '</div>';
var messageStr = '<div class="chat_item active" id="' + message.from + '">' +
messageSigleStr + '</div>'
$(".notice_classify[userid=" + this.defaultName + "]").after(userStr);
$(".notice_classify[userid=" + self.defaultName + "]").after(userStr);
// $('.notice_left_content').append(userStr);
$('.chat_item_content').append(messageStr)
} else {
......@@ -390,8 +389,7 @@ $(function () {
$(this).html(self.userHtml(num + 1, message, regContent));
var html = $(this).clone();
$(this).remove();
$(".notice_classify[userid=" + this.defaultName + "]").after(html);
$(".notice_classify[userid=" + self.defaultName + "]").after(html);
if (!firstClick) {
$('#' + userId).find('.notice_item_content').append(self.messageHtml(2,
htmlStr, isTemplate));
......@@ -402,13 +400,14 @@ $(function () {
} else {
if (index == len - 1) {
//新用户
console.log('新用户')
var userStr = '<div class="notice_classify" userid="' +
message.from + '" newMember="true">' +
self.userHtml(1, message, regContent) + '</div>';
var messageStr = '<div class="chat_item" id="' +
message.from + '">' +
messageSigleStr + '</div>'
$(".notice_classify[userid=" + this.defaultName + "]").after(userStr)
messageSigleStr + '</div>';
$(".notice_classify[userid=" + self.defaultName + "]").after(userStr);
$('.chat_item_content').append(messageStr)
}
}
......@@ -426,18 +425,18 @@ $(function () {
},
onTextMessage: function (message) {
self.receiveData(1, {
name: message.ext.name,
name: message.ext.name||'--',
id: message.ext.id,
img: message.ext.img,
img: message.ext.img||(dist + "/images/default.jpg"),
message: message.data,
from: message.from
}, false)
}, //收到文本消息;
onEmojiMessage: function (message) {
self.receiveData(3, {
name: message.ext.name,
name: message.ext.name||'--',
id: message.ext.id,
img: message.ext.img,
img: message.ext.img||(dist + "/images/default.jpg"),
message: message.data,
from: message.from,
}, false)
......@@ -445,9 +444,9 @@ $(function () {
}, //收到表情消息;
onCmdMessage: function (message) {
self.receiveData(1, {
name: message.ext.name,
name: message.ext.name||'--',
id: message.ext.id,
img: message.ext.img,
img: message.ext.img||(dist + "/images/default.jpg"),
from: message.from,
type: message.ext.type,
price: message.ext.price,
......@@ -467,9 +466,9 @@ $(function () {
options.onFileDownloadComplete = function () {
// 图片下载成功;
self.receiveData(2, {
name: message.ext.name,
name: message.ext.name||'--',
id: message.ext.id,
img: message.ext.img,
img: message.ext.img||(dist + "/images/default.jpg"),
from: message.from,
url: message.url
}, false)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment