import Vue from 'vue' import Router from 'vue-router' import { getSession, message } from './../util/item' import Login from '@/components/login' import Index from '@/components/index' import Overview from '@/components/overview'//概览页面 import PreviewOfSiteStatus from '@/components/site/previewOfSiteStatus' //站点状况预览图 import NewFiberSearch from '@/components/newFiber/NewFiberSearch' //新烽查询系统 // 配置中心 import AlarmConfiguration from '@/components/configure/AlarmConfiguration' //报警配置 import PushRules from '@/components/configure/PushRules' //推送规则 import AlarmLog from '@/components/configure/AlarmLog' //推送规则 // 消息管理 import MessageQuery from '@/components/MessageManagement/MessageQuery' //消息查询 import MessageStatistics from '@/components/MessageManagement/MessageStatistics' //消息统计 Vue.use(Router) import axios from 'axios' import qs from 'qs' Vue.prototype.$axios = axios //全局注册,使用方法为:this.$axios Vue.prototype.qs = qs //全局注册,使用方法为:this.qs const router = new Router({ routes: [{ path: '/index', name: 'index', component: Index, children: [{ path: '/overview', name: 'overview', component: Overview },{ path: '/site/previewOfSiteStatus',//站点状况预览图--站点状况预览图 name: 'PreviewOfSiteStatus', component: PreviewOfSiteStatus },{ path: '/newFiber/NewFiberSearch',//新烽查询系统 name: 'NewFiberSearch', component: NewFiberSearch },{ path: '/configure/AlarmConfiguration',// 配置中心--报警配置 name: 'AlarmConfiguration', component: AlarmConfiguration },{ path: '/configure/PushRules',// 配置中心--推送规则 name: 'PushRules', component: PushRules },{ path: '/configure/AlarmLog',// 配置中心--报警日志 name: 'AlarmLog', component: AlarmLog },,{ path: '/MessageManagement/MessageQuery',// 消息管理--消息查询 name: 'MessageQuery', component: MessageQuery },,{ path: '/MessageManagement/MessageStatistics',// 消息管理--消息统计 name: 'MessageStatistics', component: MessageStatistics },] },{ path: '/login', name: 'login', component: Login }, { path: '/', redirect: "/site/previewOfSiteStatus" }, { path: "*", redirect: "/" } ] }) // router.beforeEach((to, from, next) => { // /* 使用过程为, // 先判断vuex里面一条数据, // 判断是否登陆 */ // if (to.name == 'login') { // next(); // } else if (JSON.parse(getSession('logins')) == 'true') { // next(); // } else { // message({ // 'data': { // 'code': 1, // 'message': '登录已过期,请重新登录!' // } // }); // next({ // 'path': '/login' // }); // } // }); export default router;