Merge remote-tracking branch 'origin/dev' into test

This commit is contained in:
fan 2020-01-16 13:29:31 +08:00
commit ab10720308

View File

@ -52,7 +52,6 @@ StompClient.prototype = {
const that = this; const that = this;
this.clientIns.connect({ 'X-Token': getToken() }, () => { this.clientIns.connect({ 'X-Token': getToken() }, () => {
if (notFirstConnect) { if (notFirstConnect) {
store.dispatch('app/SET_DIALOG_MESSAGE', '');
setTimeout(()=>{ Message.success('连接成功'); }); setTimeout(()=>{ Message.success('连接成功'); });
} }
console.info('连接成功.'); console.info('连接成功.');
@ -65,21 +64,17 @@ StompClient.prototype = {
}); });
// sock断开回调 // sock断开回调
this.clientIns.ws.onclose = () => { that.clientIns.ws.onclose = () => {
// MessageBox.confirm('连接已经断开'); Message.error(`通信连接已断开!`);
store.dispatch('app/SET_DIALOG_MESSAGE', 'socket连接已断开');
notFirstConnect = true; notFirstConnect = true;
checkLoginLine().then(() => { checkLoginLine().then(() => {
this.status = false; that.status = false;
this.count++; that.count++;
this.reconnect(this.count); that.reconnect(that.count);
}).catch((err) => { }).catch((err) => {
this.logOut(err); that.logOut(err);
}); });
}; };
this.clientIns.ws.onerror = ()=>{
console.log(1111);
};
resolve(this); resolve(this);
}, () => { }, () => {
checkLoginLine().then(() => { checkLoginLine().then(() => {
@ -110,7 +105,7 @@ StompClient.prototype = {
// 恢复链接 // 恢复链接
reconnect(count) { reconnect(count) {
console.info(`尝试第${count || 1}次连接.`); console.info(`尝试第${count || 1}次连接.`);
store.dispatch('app/SET_DIALOG_MESSAGE', `正在尝试第${count || 1}次连接.`); Message.warning(`正在尝试第${count || 1}次通讯连接。`);
const that = this; const that = this;
setTimeout(() => { setTimeout(() => {
that.connect().then(() => { }).catch(() => { that.connect().then(() => { }).catch(() => {