diff --git a/src/utils/baseUrl.js b/src/utils/baseUrl.js index 2e575c51e..72be3b2f1 100644 --- a/src/utils/baseUrl.js +++ b/src/utils/baseUrl.js @@ -3,8 +3,8 @@ export function getBaseUrl() { let BASE_API; if (process.env.NODE_ENV === 'development') { // BASE_API = 'https://joylink.club/jlcloud'; - BASE_API = 'https://test.joylink.club/jlcloud'; - // BASE_API = 'http://192.168.3.5:9000'; // 袁琪 + // BASE_API = 'https://test.joylink.club/jlcloud'; + BASE_API = 'http://192.168.3.5:9000'; // 袁琪 // BASE_API = 'http://192.168.3.6:9000'; // 旭强 // BASE_API = 'http://192.168.3.4:9000' // 琰培 } else { diff --git a/src/utils/sock.js b/src/utils/sock.js index 067667776..f7654975c 100644 --- a/src/utils/sock.js +++ b/src/utils/sock.js @@ -80,8 +80,8 @@ StompClient.prototype = { this.status = false; this.count++; this.reconnect(this.count); - }).catch(() => { - this.logOut(); + }).catch((err) => { + this.logOut(err); }); }; } @@ -103,30 +103,27 @@ StompClient.prototype = { this.reconnect(this.count); } }).catch((err) => { - if (err.code == 40003 || err.code == 40004 || err.code == 40005 || err.code == 50012) { - this.logOut(); - } - if (err.code == 50008 || err.code == 50014) { - this.url = websocketUrl + handleToken(); - this.status = false; - this.count++; - this.reconnect(this.count); - } + this.logOut(err); }); } }, 30000); } resolve(this); }, () => { - // console.log('向服务器发起websocket连接', 222222); if (this.checkTimer) { clearInterval(this.checkTimer); this.checkTimer = null; } checkLoginLine().then(() => { this.connect(); - }).catch(() => { - this.logOut(); + }).catch((err) => { + if (err.code == 40003 || err.code == 40004 || err.code == 40005 || err.code == 50012) { + this.logOut(); + } + if (err.code == 50008 || err.code == 50014) { + this.url = websocketUrl + handleToken(); + this.connect(); + } }); }); } catch (err) { @@ -135,16 +132,24 @@ StompClient.prototype = { }); }, - logOut() { - MessageBox.confirm('你已被登出,请重新登录', '确定登出', { - confirmButtonText: '重新登录', - showCancelButton: false, - type: 'warning' - }).then(() => { - store.dispatch('FedLogOut', gainClientId()).then(() => { - location.reload();// 为了重新实例化vue-router对象 避免bug + logOut(err) { + if (err.code == 40003 || err.code == 40004 || err.code == 40005 || err.code == 50012) { + MessageBox.confirm('你已被登出,请重新登录', '确定登出', { + confirmButtonText: '重新登录', + showCancelButton: false, + type: 'warning' + }).then(() => { + store.dispatch('FedLogOut', gainClientId()).then(() => { + location.reload();// 为了重新实例化vue-router对象 避免bug + }); }); - }); + } + if (err.code == 50008 || err.code == 50014) { + this.url = websocketUrl + handleToken(); + this.status = false; + this.count++; + this.reconnect(this.count); + } }, // 恢复链接 reconnect(count) { diff --git a/src/views/orderauthor/author/detail.vue b/src/views/orderauthor/author/detail.vue index 96c2e59ff..521c9e7b5 100644 --- a/src/views/orderauthor/author/detail.vue +++ b/src/views/orderauthor/author/detail.vue @@ -1,5 +1,5 @@