Authored by 陈轩

fix im 区分 会话断开与网络断开

... ... @@ -23,7 +23,7 @@
<a href="javascript:;" class="input-method input-text"></a>
</span>--}}
<span class="table-cell cell-max">
<input type="text" class="input-in text-in">
<input type="text" class="input-in text-in" placeholder="发送新消息">
</span>
<span class="table-cell">
<a href="javascript:;" class="menu-trigger"></a>
... ...
... ... @@ -209,11 +209,14 @@ var chat = {
});
window.addEventListener('online', function() {
self.$netTip.toggleClass('hide', true);
self.connect();
});
window.addEventListener('offline', function() {
self.disconnect();
self.$chat.toggleClass('online', false);
self.$netTip.toggleClass('hide', false);
// self.disconnect();
});
},
... ... @@ -221,7 +224,6 @@ var chat = {
* 当连接时
*/
connect() {
this.$netTip.toggleClass('hide', true);
cmEntity.type = 1;
this.bootSocket();
... ... @@ -234,9 +236,8 @@ var chat = {
disconnect() {
var self = this;
this.$chat.toggleClass('online', false);
this.$netTip.toggleClass('hide', false);
this._sysInfo('<p>网络断开,点击<span class="blue">重连</span></p>')
this._sysInfo('<p>会话断开,点击<span class="blue">重连</span></p>')
.one('click', function() {
self.connect();
});
... ... @@ -493,6 +494,9 @@ var chat = {
this._manualState(chatMessage.type, rec);
break;
case allTypes.CS_CHANGE_STATE:
if (msgType === 5) { // 重复登陆
this._sysInfo(chatMessage.content);
}
break;
default: break;
}
... ...
... ... @@ -6,7 +6,6 @@
.input-method,
.menu-trigger {
display: block;
width: 60px;
height: 60px;
background-repeat: no-repeat;
... ... @@ -15,6 +14,7 @@
/* 输入方式 */
.input-method {
display: block;
margin-right: 20px;
}
... ... @@ -36,6 +36,7 @@
}
.menu-trigger {
display: none;
margin-left: 20px;
background-image: resolve("service/chat/menu-trigger.png");
}
... ...
... ... @@ -134,5 +134,9 @@
.chat-status {
background-color: #4cd964 !important;
}
.menu-trigger {
display: block !important;
}
}
}
... ...