Commit f2f7fc4d by 施宇

1111

parent 4592519d
......@@ -211,7 +211,7 @@ $(function () {
'</div>'
}
},
messageHtml: function (leftOrRight, html, isTemplate) {
messageHtml: function (leftOrRight, html, isTemplate,isHistory,time) {
//右边消息的dom拼接 isTemplate 是否是模板
var htmlp = '<p>' + html + '</p>';
if (isTemplate) {
......@@ -242,7 +242,7 @@ $(function () {
'<img src="' + dist + '/images/default.jpg" alt="" class="fr user_logo">' +
'<div class="notice_content">' +
htmlp +
'<div>' + this.curentTime() + '</div>' +
'<div>' +(isHistory?time:this.curentTime()) + '</div>' +
'</div>'+
'</div>'
} else {
......@@ -255,7 +255,7 @@ $(function () {
'<img src="' + dist + '/images/default.jpg" alt="" class="fl user_logo">' +
'<div class="notice_content">' +
htmlp +
'<div>' + this.curentTime() + '</div>' +
'<div>' + (isHistory?time:this.curentTime()) + '</div>' +
'</div>'+
'</div>'
} else {
......@@ -374,7 +374,6 @@ $(function () {
}, //收到表情消息;
onCmdMessage: function (message) {
console.log(message)
self.receiveData(1, message, true);
self.addChatMember(message.from)
}, //收到命令消息;
......@@ -438,6 +437,9 @@ $(function () {
msg.set({
msg: content, // 消息内容;
to: userId, // 接收消息对象;
ext:{
timer:self.curentTime()
},
success: function (id, serverMsgId) {
$('#' + userId).find('.notice_item_content').append(self.messageHtml(1,
emojiMessage, false));
......@@ -458,15 +460,16 @@ $(function () {
var userId = $('.notice_left ').find('.active').attr('userid');
var id = this.conn.getUniqueId();
var msg = new WebIM.default.message('cmd', id);
var params = $.extend({},templateObj,{timer:self.curentTime()});
msg.set({
msg: 'template',
to: userId,
action: "template",
ext: templateObj,
ext: params,
success: function () {
self.addChatMember(userId)
$('#' + userId).find('.notice_item_content').append(self.messageHtml(1,
templateObj, true));
params, true));
var contentHeight = $('#' + userId).find('.notice_item_content')
.height();
$('#' + userId).find('.notice_list').scrollTop(contentHeight);
......@@ -476,7 +479,7 @@ $(function () {
}
});
this.conn.send(msg.body);
console.log(msg.body)
},
sendPrivateImg: function () {
......@@ -491,6 +494,9 @@ $(function () {
apiUrl: WebIM.config.apiURL,
file: file,
to: userId,
ext:{
timer:self.curentTime()
},
flashUpload: WebIM.flashUpload,
onFileUploadError: function () {
console.log('失败')
......@@ -598,7 +604,7 @@ $(function () {
}
if (data[i].data) { //消息或者表情
if (typeof (data[i].data) == 'string') {
chatCon += this.messageHtml(rightOrLeft, data[i].data);
chatCon += this.messageHtml(rightOrLeft, data[i].data,false,true,data[i].ext.timer);
} else {
for (var j = 0; j < data[i].data.length; j++) {
if (data[i].data[j].type == "txt") {
......@@ -607,15 +613,15 @@ $(function () {
emojiTxt += '<img src ="' + data[i].data[j].data + '" width=25 height=25/>';
}
}
chatCon += this.messageHtml(rightOrLeft, emojiTxt);
chatCon += this.messageHtml(rightOrLeft, emojiTxt,false,true,data[i].ext.timer);
}
} else if (data[i].url) { //图片
chatCon += this.messageHtml(rightOrLeft, '<img src ="' + data[i].url + '" class="edit_img"/>');
chatCon += this.messageHtml(rightOrLeft, '<img src ="' + data[i].url + '" class="edit_img"/>',false,true,data[i].ext.timer);
} else if (data[i].action == 'template') { //模板
chatCon += this.messageHtml(rightOrLeft, data[i].ext,true);
chatCon += this.messageHtml(rightOrLeft, data[i].ext,true,true,data[i].ext.timer);
}
}
......
This diff could not be displayed because it is too large.
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