Commit 6873067c by 施宇

321

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