Commit 265739a4 by 施宇

32

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