Commit 5c55a957 by 施宇

1312

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