Authored by 李奇

评价完成之后检查连接可用后发送评价成功消息

@@ -147,7 +147,6 @@ let chat = { @@ -147,7 +147,6 @@ let chat = {
147 }, 147 },
148 148
149 bootSocket: function() { 149 bootSocket: function() {
150 - console.log(new Date().getTime(), 'boot');  
151 const self = this; 150 const self = this;
152 151
153 let actions = { 152 let actions = {
@@ -298,12 +297,14 @@ let chat = { @@ -298,12 +297,14 @@ let chat = {
298 conversationId: cmEntity.conversationId, 297 conversationId: cmEntity.conversationId,
299 }); 298 });
300 }).on('rating-success', function(e, data) { 299 }).on('rating-success', function(e, data) {
  300 + const state = (window.socket || {}).readyState;
  301 +
301 self._sysInfo(`您对我们的服务评价为:${data}`); 302 self._sysInfo(`您对我们的服务评价为:${data}`);
302 self.canEvalute = false; 303 self.canEvalute = false;
303 cmEntity.type = socketConf.recType.EVALUTE_SUCCESS; 304 cmEntity.type = socketConf.recType.EVALUTE_SUCCESS;
304 - socket.send(JSON.stringify(cmEntity));  
305 -  
306 - // resizeFooter(); 305 + if (state === WebSocket.OPEN) {
  306 + socket.send(JSON.stringify(cmEntity));
  307 + }
307 }); 308 });
308 309
309 310
@@ -356,7 +357,6 @@ let chat = { @@ -356,7 +357,6 @@ let chat = {
356 this.canLeaveMSG = true; 357 this.canLeaveMSG = true;
357 this.$chat.toggleClass('online', false); 358 this.$chat.toggleClass('online', false);
358 this.toggleMenu(false); 359 this.toggleMenu(false);
359 - console.log('bind one');  
360 this._sysInfo(`<p>${content}<span class="blue">连接客服</span></p>`) 360 this._sysInfo(`<p>${content}<span class="blue">连接客服</span></p>`)
361 .one('touchend', function() { 361 .one('touchend', function() {
362 self.connect(); 362 self.connect();
@@ -567,7 +567,6 @@ let chat = { @@ -567,7 +567,6 @@ let chat = {
567 * 处理 接收到的信息 567 * 处理 接收到的信息
568 */ 568 */
569 handleReceiveMSG: function(rec) { 569 handleReceiveMSG: function(rec) {
570 - console.log(new Date().getTime(), rec);  
571 let recType = rec.type, 570 let recType = rec.type,
572 chatMessage = rec.chatMessage, 571 chatMessage = rec.chatMessage,
573 msgType = chatMessage.type, 572 msgType = chatMessage.type,
@@ -62,12 +62,11 @@ function sendMsg(msg) { @@ -62,12 +62,11 @@ function sendMsg(msg) {
62 socket.send(msg); 62 socket.send(msg);
63 } else { 63 } else {
64 sendFailCallback(); 64 sendFailCallback();
65 - console.log('The socket is not open.');  
66 } 65 }
67 } 66 }
68 67
69 module.exports = { 68 module.exports = {
70 init: socketInit, 69 init: socketInit,
71 - send: sendMsg 70 + send: sendMsg,
72 }; 71 };
73 72