Commit 6873067c by 施宇

321

parent 5c4278ed
Showing with 14 additions and 7 deletions
...@@ -89,8 +89,12 @@ $(function () { ...@@ -89,8 +89,12 @@ $(function () {
}, },
customerChat: function () { customerChat: function () {
Util.delCookie('customer', cookieHostname); if (Util.getCookie('customer')) {
$(".notice_classify[userid=" + this.defaultName + "]").attr('isCustomer', true); Util.delCookie('customer', cookieHostname);
$(".notice_classify[userid=" + this.defaultName + "]").attr('isCustomer', true);
}
}, },
addUser: function (obj, isDefault, isFirst) { addUser: function (obj, isDefault, isFirst) {
...@@ -371,7 +375,7 @@ $(function () { ...@@ -371,7 +375,7 @@ $(function () {
if (!len) { if (!len) {
//新用户 //新用户
Util.delCookie('templateBoolean', cookieHostname); Util.delCookie('templateBoolean', cookieHostname);
var userStr = '<div class="notice_classify active" userid="' + message.from + '" firstClick="true" newMember="true" touserid=' + message.touserid + '>' + var userStr = '<div class="notice_classify active" userid="' + message.from + '" firstClick="true" newMember="true" touserid=' + message.touserid + '>' +
self.userHtml(0, message, regContent) + '</div>'; self.userHtml(0, message, regContent) + '</div>';
var messageStr = '<div class="chat_item active" id="' + message.from + '">' + var messageStr = '<div class="chat_item active" id="' + message.from + '">' +
...@@ -414,7 +418,7 @@ $(function () { ...@@ -414,7 +418,7 @@ $(function () {
} else { } else {
//非当前用户 //非当前用户
Util.delCookie('templateBoolean', cookieHostname); Util.delCookie('templateBoolean', cookieHostname);
var num = Number($(this).find('.num').text()); var num = Number($(this).find('.num').text());
$(this).html(self.userHtml(num + 1, message, regContent)); $(this).html(self.userHtml(num + 1, message, regContent));
var html = $(this).clone(); var html = $(this).clone();
...@@ -430,7 +434,7 @@ $(function () { ...@@ -430,7 +434,7 @@ $(function () {
} else { } else {
if (index == len - 1) { if (index == len - 1) {
//新用户 //新用户
Util.delCookie('templateBoolean', cookieHostname); Util.delCookie('templateBoolean', cookieHostname);
var userStr = '<div class="notice_classify" userid="' + var userStr = '<div class="notice_classify" userid="' +
message.from + '" newMember="true" touserid=' + message.touserid + '>' + message.from + '" newMember="true" touserid=' + message.touserid + '>' +
self.userHtml(1, message, regContent) + '</div>'; self.userHtml(1, message, regContent) + '</div>';
...@@ -451,7 +455,7 @@ $(function () { ...@@ -451,7 +455,7 @@ $(function () {
onOpened: function (message) { onOpened: function (message) {
console.log('登入成功') console.log('登入成功')
self.isLoginSuccess = true; self.isLoginSuccess = true;
self.customerChat() self.customerChat();
self.singleChat(); self.singleChat();
}, },
onTextMessage: function (message) { onTextMessage: function (message) {
...@@ -601,6 +605,7 @@ $(function () { ...@@ -601,6 +605,7 @@ $(function () {
layer.msg('消息发送失败'); layer.msg('消息发送失败');
} }
}); });
// console.log(msg.body)
this.conn.send(msg.body); this.conn.send(msg.body);
}, },
sendCmd: function (templateObj) { sendCmd: function (templateObj) {
...@@ -772,6 +777,7 @@ $(function () { ...@@ -772,6 +777,7 @@ $(function () {
layer.msg('聊天系统出错'); layer.msg('聊天系统出错');
return; return;
} }
return;
} }
if (isTemplate) { if (isTemplate) {
$(this).removeAttr('isTemplate'); $(this).removeAttr('isTemplate');
...@@ -794,7 +800,8 @@ $(function () { ...@@ -794,7 +800,8 @@ $(function () {
if (firstClick) { if (firstClick) {
$(this).removeAttr('firstClick'); $(this).removeAttr('firstClick');
if (self.isLoginSuccess) { //登入成功 获取聊天记录 if (self.isLoginSuccess) { //登入成功 获取聊天记录
self.getHistoryData(id) self.getHistoryData(id);
} else { } else {
layer.msg('聊天系统出错'); layer.msg('聊天系统出错');
return; return;
......
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