Newer
Older
operation_web / src / router / index.js
@zhangqy zhangqy on 17 Dec 2019 4 KB 1
import Vue from 'vue'
import Router from 'vue-router'
import {
  getSession,
  message
} from './../util/item'


const routerPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return routerPush.call(this, location).catch(error=> error)
}


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' //消息统计
// 数据分析
import DataScreening from '@/components/DataAnalysis/dataScreening' //数据总览
import StatisticalReport from '@/components/DataAnalysis/StatisticalReport' //统计报表
// 工业物联网云平台
import VideoSurveillance from '@/components/NFCloudPlatform/VideoSurveillance' //视频监控
// import GroundFloor from '@/components/NFCloudPlatform/GroundFloor' //视频监控-一楼泵站
// import Attic from '@/components/NFCloudPlatform/Attic' //视频监控-顶楼泵站
import RealTime from '@/components/NFCloudPlatform/RealTime' //实时监控

// 工程作业
import Nowfault from '@/components/Engineering/Nowfault' //查询实时故障数据
import HistoricalFault from '@/components/Engineering/HistoricalFault' //查询历史故障数据



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: '/DataAnalysis/dataScreening',// 数据分析--数据总览
    name: 'DataScreening',
    component: DataScreening
  },{
    path: '/DataAnalysis/StatisticalReport',// 数据分析--统计报表
    name: 'StatisticalReport',
    component: StatisticalReport
  },{
    path: '/NFCloudPlatform/VideoSurveillance',// 工业物联网云平台--视频监控
    name: 'VideoSurveillance',
    component: VideoSurveillance
  },
  // {
  //   path: '/NFCloudPlatform/GroundFloor',// 工业物联网云平台--视频监控-一楼泵站
  //   name: 'GroundFloor',
  //   component: GroundFloor
  // },{
  //   path: '/NFCloudPlatform/Attic',// 工业物联网云平台--视频监控-顶楼泵站
  //   name: 'Attic',
  //   component: Attic
  // },
  {
    path: '/NFCloudPlatform/RealTime',// 工业物联网云平台--实时监控
    name: 'RealTime',
    component: RealTime
  },{
    path: '/Engineering/Nowfault',// 查询实时故障数据
    name: 'Nowfault',
    component: Nowfault
  },{
    path: '/Engineering/HistoricalFault',// 查询历史故障数据
    name: 'HistoricalFault',
    component: HistoricalFault
  },]
  },{
    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;