Commit 265739a4 by 施宇

32

parent 5aa54a93
Showing with 26 additions and 15 deletions
......@@ -81,9 +81,10 @@ $(function () {
if (JSON.stringify(this.templateObj) == '{}') {
if (this.customerNum !== this.defaultName) {
$(".notice_classify[userid=" + this.defaultName + "]").click();
$(".notice_classify[userid=" + this.defaultName + "]").attr('position', 'first')
} else {
$(".notice_classify").first().click();
$(".notice_classify").first().attr('position', 'first')
}
} else {
Util.delCookie('template', cookieHostname);
......@@ -407,6 +408,7 @@ $(function () {
var userId = $(this).attr('userid');
var isNowChat = $('.notice_classify').eq(index).hasClass('active');
var firstClick = $(this).attr('firstClick');
var position = $(this).attr('position');
if (userId == message.from) {
//已有用户
if (isNowChat) {
......@@ -415,8 +417,11 @@ $(function () {
if (Util.getCookie('templateBoolean')) {
Util.delCookie('templateBoolean', cookieHostname);
} else {
$('#' + userId).find('.notice_item_content').append(self.messageHtml(2,
htmlStr, isTemplate));
if (!position) {
$('#' + userId).find('.notice_item_content').append(self.messageHtml(2,
htmlStr, isTemplate));
}
}
var imgLen = $('#' + userId).find('img').length;
if (!imgLen) {
......@@ -574,14 +579,17 @@ $(function () {
}, //失败回调;
});
},
judgeCustomer: function (message) {//1 标题 2//图片
var obj = {name:"",img:""};
judgeCustomer: function (message) { //1 标题 2//图片
var obj = {
name: "",
img: ""
};
if (message.from == this.defaultName) {
obj.img = dist + "/images/timg.jpg";
obj.name = 'IC助手客服';
} else {
obj.img = message.ext.img || (dist + "/images/default.jpg");
obj.name = message.ext.name || '--';
obj.name = message.ext.name || '--';
}
return obj
},
......@@ -617,7 +625,7 @@ $(function () {
timer: self.curentTime(),
id: self.id,
name: self.name,
img: self.img,
img: self.img,
touserid: touserid,
name1: name,
img1: img
......@@ -731,7 +739,7 @@ $(function () {
ext: {
timer: self.curentTime(),
id: self.id,
name:self.name,
name: self.name,
img: self.img,
touserid: touserid,
name1: name,
......@@ -914,7 +922,10 @@ $(function () {
})
},
rendHistoryMessage: function (id, data, isTemplate) {
console.log(data)
var position = $(".notice_classify[userid=" + id + "]").attr('position');
if(position){
$(".notice_classify[userid=" + id + "]").removeAttr('position')
}
var chatCon = "";
for (var i = 0; i < data.length; i++) {
var fromId = data[i].from;
......@@ -927,8 +938,8 @@ $(function () {
if (typeof (data[i].data) == 'string') {
chatCon += this.messageHtml(rightOrLeft, {
message: data[i].data,
name:this.judgeCustomer(data[i]).name,
img:this.judgeCustomer(data[i]).img,
name: this.judgeCustomer(data[i]).name,
img: this.judgeCustomer(data[i]).img,
id: data[i].ext.id
}, false, true, data[i].ext.timer);
} else {
......@@ -941,8 +952,8 @@ $(function () {
}
chatCon += this.messageHtml(rightOrLeft, {
message: emojiTxt,
name:this.judgeCustomer(data[i]).name,
img:this.judgeCustomer(data[i]).img,
name: this.judgeCustomer(data[i]).name,
img: this.judgeCustomer(data[i]).img,
id: data[i].ext.id
}, false, true, data[i].ext.timer);
}
......@@ -950,8 +961,8 @@ $(function () {
} else if (data[i].url) { //图片
chatCon += this.messageHtml(rightOrLeft, {
message: '<img src ="' + data[i].url + '" class="edit_img"/>',
name:this.judgeCustomer(data[i]).name,
img:this.judgeCustomer(data[i]).img,
name: this.judgeCustomer(data[i]).name,
img: this.judgeCustomer(data[i]).img,
id: data[i].ext.id
}, false, true, data[i].ext.timer);
} else if (data[i].action == 'template') { //模板
......
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