Commit f2f7fc4d by 施宇

1111

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