Commit ed85262c by 施宇

1111

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