| | |
| | | const routes = [ |
| | | { |
| | | path: "/", |
| | | redirect: "/projectList/list", |
| | | redirect: "/login", |
| | | }, |
| | | { |
| | | path: "/login", |
| | |
| | | keepAlive: true, |
| | | }, |
| | | component: () => import("../views/projectList/addProject"), |
| | | }, |
| | | { |
| | | path: "editProject", |
| | | name: "EditProject", |
| | | meta: { |
| | | title: "编辑项目组", |
| | | hide: true, |
| | | }, |
| | | component: () => import("../views/projectList/editProject"), |
| | | }, |
| | | { |
| | | path: "detailProject", |
| | | name: "DetailProject", |
| | | meta: { |
| | | title: "项目组详情", |
| | | hide: true, |
| | | }, |
| | | component: () => import("../views/projectList/detailProject"), |
| | | } |
| | | ] |
| | | }, |
| | |
| | | { |
| | | path: "add", |
| | | meta: { |
| | | title: "新增可行报告", |
| | | title: "新增可研报告", |
| | | hide: true, |
| | | keepAlive: true, |
| | | }, |
| | | component: () => import("../views/reportLibrary/feasibilityStudy/add.vue"), |
| | | }, |
| | | { |
| | | path: "edit", |
| | | meta: { |
| | | title: "编辑可研报告", |
| | | hide: true, |
| | | keepAlive: true, |
| | | }, |
| | | component: () => import("../views/reportLibrary/feasibilityStudy/add.vue"), |
| | | }, |
| | | |
| | | { |
| | | path: "feasibilityReport", |
| | | meta: { |
| | |
| | | component: () => import("../views/reportLibrary/feasibilityReport/index.vue"), |
| | | }, |
| | | { |
| | | path: "addFeasibility", |
| | | meta: { |
| | | title: "新增可行报告", |
| | | hide: true, |
| | | keepAlive: true, |
| | | }, |
| | | component: () => import("../views/reportLibrary/feasibilityReport/add.vue"), |
| | | }, |
| | | { |
| | | path: "editFeasibility", |
| | | meta: { |
| | | title: "编辑可行报告", |
| | | hide: true, |
| | | keepAlive: true, |
| | | }, |
| | | component: () => import("../views/reportLibrary/feasibilityReport/add.vue"), |
| | | }, |
| | | |
| | | |
| | | { |
| | | path: "processDevelopment", |
| | | meta: { |
| | | title: "工艺开发工具", |
| | |
| | | }, |
| | | component: () => import("../views/reportLibrary/processDevelopment/index.vue"), |
| | | }, |
| | | |
| | | { |
| | | path: "addProcessDevelopment", |
| | | meta: { |
| | | title: "新增工艺开发工具", |
| | | hide: true, |
| | | keepAlive: true, |
| | | }, |
| | | component: () => import("../views/reportLibrary/processDevelopment/add.vue"), |
| | | }, |
| | | { |
| | | path: "editProcessDevelopment", |
| | | meta: { |
| | | title: "编辑工艺开发工具", |
| | | hide: true, |
| | | keepAlive: true, |
| | | }, |
| | | component: () => import("../views/reportLibrary/processDevelopment/add.vue"), |
| | | }, |
| | | |
| | | |
| | | |
| | | { |
| | | path: "verificationRelease", |
| | | meta: { |
| | |
| | | document.title = to.meta.title || '实验室流程'; |
| | | |
| | | // 登录验证 |
| | | // if (to.path === "/login") { |
| | | // sessionStorage.removeItem('userInfo') |
| | | // next() |
| | | // } else if (!sessionStorage.getItem('userInfo')) { |
| | | // next('/login') |
| | | // } else { |
| | | // // 判断是否拥有要跳转菜单权限 |
| | | // let menus = store.state.menus |
| | | // if (to.meta.hasOwnProperty('privilege') && !menus.includes(to.meta.privilege)) { |
| | | // return |
| | | // } |
| | | // 排除登录页的校验 |
| | | if (to.path === "/login") { |
| | | if (sessionStorage.getItem('token')) { |
| | | next('/system'); // 已登录状态访问登录页时重定向到系统首页 |
| | | return; |
| | | } |
| | | next(); |
| | | return; |
| | | } |
| | | |
| | | // 登录状态校验 |
| | | const isAuthenticated = sessionStorage.getItem('token'); |
| | | if (!isAuthenticated) { |
| | | next('/login'); // 未登录用户重定向到登录页 |
| | | return; |
| | | } |
| | | |
| | | // 判断是否拥有要跳转菜单权限 |
| | | let menus = store.state.menus |
| | | if (to.meta.hasOwnProperty('privilege') && !menus.includes(to.meta.privilege)) { |
| | | return |
| | | } |
| | | |
| | | // 设置标签列表 |
| | | if (!to.meta.hide || !to.meta.oneself) { |
| | |
| | | const tagInfo = { |
| | | path: to.path, |
| | | name: to.name, |
| | | meta: to.meta |
| | | meta: to.meta, |
| | | query: to.query, |
| | | } |
| | | tagList.push(tagInfo) |
| | | sessionStorage.setItem('tagList', JSON.stringify(tagList)) |
| | |
| | | } |
| | | |
| | | next() |
| | | // } |
| | | }); |
| | | |
| | | export default router; |