Commit ed85262c by 施宇

1111

parent 7ab8c457
Showing with 24 additions and 7 deletions
...@@ -8,16 +8,17 @@ $(function () { ...@@ -8,16 +8,17 @@ $(function () {
templateObj: JSON.parse(Util.getCookie('template') || "{}"), templateObj: JSON.parse(Util.getCookie('template') || "{}"),
customerText: Util.getCookie('customer') || "", customerText: Util.getCookie('customer') || "",
isLoginSuccess: false, isLoginSuccess: false,
chatList: [],
img: "", img: "",
name: "", name: "",
id: "", id: "",
init: function () { init: function () {
if(this.ieFun()){ if (this.ieFun()) {
this.getUserInfo(); this.getUserInfo();
this.connection(); this.connection();
this.connListen(); this.connListen();
this.bindFunction(); this.bindFunction();
}else{ } else {
layer.open({ layer.open({
title: '提示', title: '提示',
content: '浏览器不兼容聊天系统,建议使用其他浏览器!' content: '浏览器不兼容聊天系统,建议使用其他浏览器!'
...@@ -57,6 +58,9 @@ $(function () { ...@@ -57,6 +58,9 @@ $(function () {
if (res.errcode === 0) { if (res.errcode === 0) {
self.rendChatSection(res.data); self.rendChatSection(res.data);
self.login(name, password); self.login(name, password);
for (var i = 0; i < res.data.length; i++) {
self.chatList.push(res.data[i].im_username)
}
} else { } else {
layer.msg('获取历史纪录失败'); layer.msg('获取历史纪录失败');
self.deleteCookie() self.deleteCookie()
...@@ -229,8 +233,9 @@ $(function () { ...@@ -229,8 +233,9 @@ $(function () {
}, },
ieFun: function () { ieFun: function () {
if (navigator.appName == "Microsoft Internet Explorer" && (navigator.appVersion.split(";")[1].replace(/[ ]/g, "") == "MSIE8.0" || navigator.appVersion.split(";")[1].replace(/[ ]/g, "") == "MSIE9.0")) { if (navigator.appName == "Microsoft Internet Explorer" && (navigator.appVersion.split(";")[1].replace(/[ ]/g, "") == "MSIE8.0" || navigator.appVersion.split(";")[1].replace(/[ ]/g, "") == "MSIE9.0")) {
return false}else{ return false
return true } else {
return true
} }
}, },
curentTime: function () { curentTime: function () {
...@@ -505,7 +510,10 @@ $(function () { ...@@ -505,7 +510,10 @@ $(function () {
touserid: message.ext.touserid touserid: message.ext.touserid
}, false); }, false);
if (self.customerNum == self.defaultName) { if (self.customerNum == self.defaultName) {
self.addChatMember(message.ext.id) var index = self.chatList.indexOf(message.from);
if (index == -1) {
self.addChatMember(message.ext.id)
}
} }
}, //收到文本消息; }, //收到文本消息;
onEmojiMessage: function (message) { onEmojiMessage: function (message) {
...@@ -518,7 +526,10 @@ $(function () { ...@@ -518,7 +526,10 @@ $(function () {
touserid: message.ext.touserid touserid: message.ext.touserid
}, false); }, false);
if (self.customerNum == self.defaultName) { if (self.customerNum == self.defaultName) {
self.addChatMember(message.ext.id) var index = self.chatList.indexOf(message.from);
if (index == -1) {
self.addChatMember(message.ext.id)
}
} }
}, //收到表情消息; }, //收到表情消息;
...@@ -555,7 +566,10 @@ $(function () { ...@@ -555,7 +566,10 @@ $(function () {
touserid: message.ext.touserid touserid: message.ext.touserid
}, false); }, false);
if (self.customerNum == self.defaultName) { if (self.customerNum == self.defaultName) {
self.addChatMember(message.ext.id) var index = self.chatList.indexOf(message.from);
if (index == -1) {
self.addChatMember(message.ext.id)
}
} }
}; };
options.onFileDownloadError = function () { options.onFileDownloadError = function () {
...@@ -704,7 +718,10 @@ $(function () { ...@@ -704,7 +718,10 @@ $(function () {
action: "template", action: "template",
ext: params, ext: params,
success: function () { success: function () {
var index = self.chatList.indexOf(userId);
if (index == -1) {
self.addChatMember(templateObj.targetId); self.addChatMember(templateObj.targetId);
}
$('#' + userId).find('.notice_item_content').append(self.messageHtml(1, $('#' + userId).find('.notice_item_content').append(self.messageHtml(1,
params, true)); params, true));
var imgLen = $('#' + userId).find('img').length; var imgLen = $('#' + userId).find('img').length;
......
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