|
@@ -28,6 +28,8 @@ import { mapGetters, mapState } from "vuex";
|
|
|
import Logo from "./Logo";
|
|
|
import SidebarItem from "./SidebarItem";
|
|
|
import variables from "@/assets/styles/variables.scss";
|
|
|
+import {Message} from "element-ui";
|
|
|
+import router from "@/router";
|
|
|
|
|
|
export default {
|
|
|
components: { SidebarItem, Logo },
|
|
@@ -66,7 +68,8 @@ export default {
|
|
|
timeoutObj: null, //心跳心跳倒计时
|
|
|
serverTimeoutObj: null, //心跳倒计时
|
|
|
timeoutnum: null, //断开 重连倒计时
|
|
|
- sessionid:null
|
|
|
+ sessionid:null,
|
|
|
+ jumpsign:'1'
|
|
|
}
|
|
|
|
|
|
|
|
@@ -79,6 +82,7 @@ export default {
|
|
|
destroyed() {
|
|
|
//页面销毁时关闭长连接
|
|
|
clearTimeout(this.timeoutObj);
|
|
|
+ // console.log('销毁页面')
|
|
|
this.websocketclose();
|
|
|
|
|
|
},
|
|
@@ -124,16 +128,34 @@ export default {
|
|
|
this.start();
|
|
|
},
|
|
|
websocketonerror(e) {
|
|
|
+ // Message({
|
|
|
+ // message: '后端超出探活数量,不允许再次连接',
|
|
|
+ // type: 'error',
|
|
|
+ // duration: 5 * 1000
|
|
|
+ // })
|
|
|
+ this.jumpsign='0'
|
|
|
+ this.$alert('后端超出探活数量,不允许再次连接!', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ callback: action => {
|
|
|
+ location.replace('about:blank');
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // this.$router.push('/404')
|
|
|
//连接失败事件
|
|
|
//错误
|
|
|
- console.log("WebSocket连接发生错误");
|
|
|
+ // console.log("WebSocket连接发生错误");
|
|
|
//重连
|
|
|
// this.reconnect();
|
|
|
},
|
|
|
websocketclose(e) {
|
|
|
//连接关闭事件
|
|
|
//提示关闭
|
|
|
- // console.log("连接已关闭");
|
|
|
+ if (this.jumpsign=='1'){
|
|
|
+ this.$router.go(0)
|
|
|
+ // console.log("连接已关闭");
|
|
|
+ }
|
|
|
+
|
|
|
//重连
|
|
|
// this.reconnect();
|
|
|
},
|