feat: 新增linux文件上传成功后websocket通知

This commit is contained in:
meilin.huang
2021-11-11 15:56:02 +08:00
parent f6fb732911
commit 78d6c3d1a4
26 changed files with 379 additions and 150 deletions

View File

@@ -8,6 +8,7 @@ import { NextLoading } from '@/common/utils/loading.ts';
import { dynamicRoutes, staticRoutes, pathMatch } from './route.ts'
import { imports } from './imports';
import openApi from '@/common/openApi';
import sockets from '@/common/sockets';
// 添加静态路由
const router = createRouter({
@@ -203,6 +204,9 @@ if (!isRequestRoutes) {
initBackEndControlRoutesFun();
}
let SysWs: any;
// 路由加载前
router.beforeEach((to, from, next) => {
NProgress.configure({ showSpinner: false });
@@ -223,10 +227,18 @@ router.beforeEach((to, from, next) => {
clearSession();
resetRoute();
NProgress.done();
if (SysWs) {
SysWs.close();
SysWs = null;
}
} else if (token && to.path === '/login') {
next('/');
NProgress.done();
} else {
if (!SysWs) {
SysWs = sockets.sysMsgSocket();
}
if (store.state.routesList.routesList.length > 0) next();
}
}