|
@@ -23,26 +23,33 @@ const router = createRouter({
|
|
|
{
|
|
|
path: "/",
|
|
|
redirect: "/kmplatform/home",
|
|
|
+ meta: {
|
|
|
+ auth: false,
|
|
|
+ }
|
|
|
},
|
|
|
{
|
|
|
path: "/login",
|
|
|
name: "login",
|
|
|
component: Login,
|
|
|
meta: {
|
|
|
-
|
|
|
+ auth: false,
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
path: "/kmplatform",
|
|
|
name: "kmplatform",
|
|
|
component: Layout,
|
|
|
- redirect: "/kmplatform/home",
|
|
|
+ // redirect: "/kmplatform/home",
|
|
|
+ meta: {
|
|
|
+ auth: false,
|
|
|
+ },
|
|
|
children: [
|
|
|
{
|
|
|
path: "home",
|
|
|
name: "kmplatform-home",
|
|
|
meta: {
|
|
|
title: "主页",
|
|
|
+ auth: true,
|
|
|
},
|
|
|
component: Home,
|
|
|
children: [],
|
|
@@ -53,6 +60,7 @@ const router = createRouter({
|
|
|
meta: {
|
|
|
title: "知识库",
|
|
|
keepAlive: true,
|
|
|
+ auth: true,
|
|
|
},
|
|
|
component: KnowledgeBase,
|
|
|
redirect: "/kmplatform/knowledgebase/kbm",
|
|
@@ -63,6 +71,7 @@ const router = createRouter({
|
|
|
meta: {
|
|
|
title: "知识库",
|
|
|
keepAlive: true,
|
|
|
+ auth: true,
|
|
|
},
|
|
|
component: KnowledgeBaseManagement,
|
|
|
},
|
|
@@ -72,6 +81,7 @@ const router = createRouter({
|
|
|
meta: {
|
|
|
title: "知识库",
|
|
|
keepAlive: false,
|
|
|
+ auth: true,
|
|
|
},
|
|
|
component: KnowledgeManagement,
|
|
|
},
|
|
@@ -82,6 +92,7 @@ const router = createRouter({
|
|
|
name: "kgbuilder",
|
|
|
meta: {
|
|
|
title: "知识图谱构建",
|
|
|
+ auth: true,
|
|
|
},
|
|
|
redirect: "/kmplatform/kgbuilder/home",
|
|
|
component: AppCopy,
|
|
@@ -90,6 +101,9 @@ const router = createRouter({
|
|
|
path: "home",
|
|
|
name: "home",
|
|
|
component: HomeView,
|
|
|
+ meta: {
|
|
|
+ auth: true,
|
|
|
+ },
|
|
|
},
|
|
|
{
|
|
|
path: "workspace",
|
|
@@ -100,21 +114,33 @@ const router = createRouter({
|
|
|
path: "queue/:id",
|
|
|
name: "queue",
|
|
|
component: () => import("@/views/QueueView.vue"),
|
|
|
+ meta: {
|
|
|
+ auth: true,
|
|
|
+ },
|
|
|
},
|
|
|
{
|
|
|
path: "worker",
|
|
|
name: "worker",
|
|
|
component: () => import("@/views/WorkerView.vue"),
|
|
|
+ meta: {
|
|
|
+ auth: true,
|
|
|
+ },
|
|
|
},
|
|
|
{
|
|
|
path: "graph",
|
|
|
name: "graph",
|
|
|
component: () => import("@/views/GraphView.vue"),
|
|
|
+ meta: {
|
|
|
+ auth: true,
|
|
|
+ },
|
|
|
},
|
|
|
{
|
|
|
path: "graph-mgr/:id",
|
|
|
name: "graph-mgr",
|
|
|
component: () => import("@/views/GraphManagement.vue"),
|
|
|
+ meta: {
|
|
|
+ auth: true,
|
|
|
+ },
|
|
|
},
|
|
|
],
|
|
|
},
|
|
@@ -122,6 +148,9 @@ const router = createRouter({
|
|
|
path: "about",
|
|
|
name: "about",
|
|
|
component: () => import("@/views/AboutView.vue"),
|
|
|
+ meta: {
|
|
|
+ auth: true,
|
|
|
+ },
|
|
|
},
|
|
|
]
|
|
|
},
|
|
@@ -131,14 +160,19 @@ const router = createRouter({
|
|
|
redirect: "/kmplatform/openplatform/queue/0",
|
|
|
meta: {
|
|
|
title: "开放平台",
|
|
|
+ auth: false,
|
|
|
+
|
|
|
},
|
|
|
component: OpenPlatform,
|
|
|
children: [
|
|
|
- {
|
|
|
- path: "queue/:id",
|
|
|
- name: "platformText",
|
|
|
- component: () => import("@/views/KMPlatform/OpenPlatform/platformText.vue"),
|
|
|
- },
|
|
|
+ {
|
|
|
+ path: "queue/:id",
|
|
|
+ name: "platformText",
|
|
|
+ component: () => import("@/views/KMPlatform/OpenPlatform/platformText.vue"),
|
|
|
+ meta: {
|
|
|
+ auth: false,
|
|
|
+ },
|
|
|
+ },
|
|
|
],
|
|
|
},
|
|
|
{
|
|
@@ -146,6 +180,7 @@ const router = createRouter({
|
|
|
name: "kgpermission",
|
|
|
meta: {
|
|
|
title: "系统权限",
|
|
|
+ auth: true,
|
|
|
},
|
|
|
redirect: "/kmplatform/kgpermission/AccountManage",
|
|
|
component: PermissionManage,
|
|
@@ -155,6 +190,7 @@ const router = createRouter({
|
|
|
name: "kgb-RoleManage",
|
|
|
meta: {
|
|
|
title: "角色管理",
|
|
|
+ auth: true,
|
|
|
},
|
|
|
component: RoleManage,
|
|
|
},
|
|
@@ -163,6 +199,7 @@ const router = createRouter({
|
|
|
name: "kgb-AccountManage",
|
|
|
meta: {
|
|
|
title: "账号管理",
|
|
|
+ auth: true,
|
|
|
},
|
|
|
component: AccountManage,
|
|
|
},
|
|
@@ -171,6 +208,7 @@ const router = createRouter({
|
|
|
name: "kgb-Organizational",
|
|
|
meta: {
|
|
|
title: "账号管理",
|
|
|
+ auth: true,
|
|
|
},
|
|
|
component: () => import("@/views/KMPlatform/Permission/Organizational.vue"),
|
|
|
},
|
|
@@ -181,18 +219,21 @@ const router = createRouter({
|
|
|
],
|
|
|
});
|
|
|
|
|
|
-router.beforeEach((to, from, next) => {
|
|
|
- if (
|
|
|
- getSessionVar("session_id") == null &&
|
|
|
+function isLogin() {
|
|
|
+ return getSessionVar("session_id") == null &&
|
|
|
getSessionVar("username") == null
|
|
|
- ) {
|
|
|
- if (to.name !== "login") {
|
|
|
- next({ name: "login" }); // 重定向到登录页面
|
|
|
+}
|
|
|
+
|
|
|
+router.beforeEach((to, from, next) => {
|
|
|
+ if (isLogin()) {
|
|
|
+ // console.log("a,", to.meta && to.name !== 'login')
|
|
|
+ if (to.meta.auth && to.name !== 'login') {
|
|
|
+ next({ name: 'login' });
|
|
|
} else {
|
|
|
- next(); // 确认转移
|
|
|
+ next()
|
|
|
}
|
|
|
} else {
|
|
|
- next(); // 确认转移
|
|
|
+ next()
|
|
|
}
|
|
|
});
|
|
|
|