import Vue from "vue"; import Router from "vue-router"; Vue.use(Router); /* Layout */ import Layout from "@/layout"; /* 所有角色可以访问/没有权限要求的基页 */ import codemenu from "./modules/codemenu"; export const constantRoutes = [ { path: "/redirect", component: Layout, hidden: true, children: [ { path: "/redirect/:path(.*)", component: () => import("@/views/redirect/index.vue"), }, ], }, { path: "/", redirect: "index", }, { path: "/login", component: () => import("@/views/login/login.vue"), }, { path: "/daping", component: () => import("@/views/daping/daping.vue"), name: "daping", }, { path: "/home", component: () => import("@/views/Home/Home.vue"), name: "home", }, { path: "/index", component: Layout, redirect: "/index", children: [ { path: "/index", component: () => import("@/views/index.vue"), name: "index", meta: { title: "主页", noCache: true, affix: true, }, }, ], }, { path: "/monitor", component: Layout, redirect: null, meta: { title: "视频中心", }, children: [ { path: "/monitor/videos", component: () => import("@/views/monitor/videos/index.vue"), name: "index", meta: { title: "视频中心", }, }, ], }, //// // { // path: "/gongyingshanggaunli", // component: Layout, // redirect: "/gongyingshang/gongyingshanggaunli", // meta: { // title: "视频中心1", // }, // children: [ // { // path: "/gongyingshang/gongyingshanggaunli", // component: () => // import("@/views/gongyingshang/gongyingshanggaunli.vue"), // name: "gongyingshanggaunli", // meta: { // title: "视频中心1", // noCache: true, // }, // }, // ], // }, ////人脸识别 { path: "/renlianshibieList", component: Layout, redirect: "/renlianshibie/renlianshibieList", meta: { title: "人脸识别", }, children: [ { path: "/renlianshibie/renlianshibieList", component: () => import("@/views/renlianshibie/renlianshibieList.vue"), name: "renlianshibieList", meta: { title: "人脸识别", noCache: true, }, }, ], }, //设备台账 { path: "/shebeitaizhangList", component: Layout, redirect: "/shebeitaizhang/shebeitaizhangList", meta: { title: "设备台账", }, children: [ { path: "/shebeitaizhang/shebeitaizhangList", component: () => import("@/views/shebeitaizhang/shebeitaizhangList.vue"), name: "shebeitaizhangList", meta: { title: "设备台账", noCache: true, }, }, ], }, ////报警查询 { path: "/baojingchaxunList", component: Layout, redirect: "/baojingchaxun/baojingchaxunList", meta: { title: "报警查询", }, children: [ { path: "/baojingchaxun/baojingchaxunList", component: () => import("@/views/baojingchaxun/baojingchaxunList.vue"), name: "baojingchaxunList", meta: { title: "报警查询", noCache: true, }, }, ], }, ////设备状态 { path: "/shebeizhuangtaiList", component: Layout, redirect: "/shebeizhuangtai/shebeizhuangtaiList", meta: { title: "设备状态", }, children: [ { path: "/shebeizhuangtai/shebeizhuangtaiList", component: () => import("@/views/shebeizhuangtai/shebeizhuangtaiList.vue"), name: "shebeizhuangtaiList", meta: { title: "设备状态", noCache: true, }, }, ], }, ////设备日志 { path: "/shebeirizhiList", component: Layout, redirect: "/shebeirizhi/shebeirizhiList", meta: { title: "设备日志", }, children: [ { path: "/shebeirizhi/shebeirizhiList", component: () => import("@/views/shebeirizhi/shebeirizhiList.vue"), name: "shebeirizhiList", meta: { title: "设备日志", noCache: true, }, }, ], }, ////电子巡更 // { // path: "/dianzixungengL", // component: Layout, // redirect: "/dianzixungeng/dianzixungengL", // meta: { // title: "电子巡更", // }, // children: [ // { // path: "/dianzixungeng/dianzixungengL", // component: () => import("@/views/dianzixungeng/dianzixungengL.vue"), // name: "dianzixungengL", // meta: { // title: "电子巡更", // noCache: true, // }, // }, // ], // }, ////消防报警 { path: "/xiaofangbaojingL", component: Layout, redirect: "/xiaofangbaojing/xiaofangbaojingL", meta: { title: "消防报警", }, children: [ { path: "/xiaofangbaojing/xiaofangbaojingL", component: () => import("@/views/xiaofangbaojing/xiaofangbaojingL.vue"), name: "xiaofangbaojingL", meta: { title: "消防报警", noCache: true, }, }, ], }, ////消息 { path: "/xiaoxiList", component: Layout, redirect: "/xiaoxi/xiaoxiList", meta: { title: "消息", }, children: [ { path: "/xiaoxi/xiaoxiList", component: () => import("@/views/xiaoxi/xiaoxiList.vue"), name: "xiaoxiList", meta: { title: "消息", noCache: true, }, }, ], }, //// ...codemenu, { path: "/404", component: () => import("@/views/404"), hidden: true, }, // 404 page must be placed at the end !!! // { path: '*', redirect: '/404', hidden: true } ]; const createRouter = () => new Router({ // mode: 'history', // require service support scrollBehavior: () => ({ y: 0, }), routes: constantRoutes, }); const router = createRouter(); // Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465 export function resetRouter() { const newRouter = createRouter(); router.matcher = newRouter.matcher; // reset router } export default router;