修改部分规则模块删除无用前端 新增前端界面
This commit is contained in:
15
modeler/src/router/config.ts
Normal file
15
modeler/src/router/config.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* This file is part of the kernelstudio package.
|
||||
*
|
||||
* (c) 2014-2025 zlin <admin@kernelstudio.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE file
|
||||
* that was distributed with this source code.
|
||||
*/
|
||||
|
||||
import { type RouteRecordRaw } from 'vue-router';
|
||||
import { routers } from '@/views/ai/router';
|
||||
|
||||
export const routes: RouteRecordRaw[] = [
|
||||
...routers,
|
||||
]
|
||||
45
modeler/src/router/context.ts
Normal file
45
modeler/src/router/context.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* This file is part of the kernelstudio package.
|
||||
*
|
||||
* (c) 2014-2025 zlin <admin@kernelstudio.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE file
|
||||
* that was distributed with this source code.
|
||||
*/
|
||||
|
||||
import {createRouter, createWebHistory, type RouteLocationNormalized,type RouteLocationNormalizedLoaded, type NavigationGuardNext} from 'vue-router';
|
||||
import {routes} from './config'
|
||||
import {useUserSession} from '@/hooks'
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory('/'),
|
||||
routes,
|
||||
scrollBehavior: () => ({left: 0, top: 0}),
|
||||
});
|
||||
|
||||
router.beforeEach((to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded, next: NavigationGuardNext)=> {
|
||||
console.info('router from ',from)
|
||||
if (to.path === '/signin') {
|
||||
next();
|
||||
} else {
|
||||
const s = useUserSession();
|
||||
s.load().then(r => {
|
||||
if (!r.user) {
|
||||
next({
|
||||
path: '/signin',
|
||||
});
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
}).catch((e) => {
|
||||
console.error('Router error,', e);
|
||||
next({
|
||||
path: '/signin',
|
||||
});
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
export {
|
||||
router
|
||||
}
|
||||
11
modeler/src/router/index.ts
Normal file
11
modeler/src/router/index.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
/*
|
||||
* This file is part of the kernelstudio package.
|
||||
*
|
||||
* (c) 2014-2025 zlin <admin@kernelstudio.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE file
|
||||
* that was distributed with this source code.
|
||||
*/
|
||||
|
||||
export {routes} from './config'
|
||||
export {router} from './context'
|
||||
Reference in New Issue
Block a user