123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265 |
- import Vue from 'vue'
- import store from '@/store'
- import VueRouter, { RouteConfig } from 'vue-router'
- // 解决Vue-Router升级导致的Uncaught(in promise) navigation guard问题
- const originalPush = VueRouter.prototype.push
- // @ts-ignore
- VueRouter.prototype.push = function push(location, onResolve, onReject) {
- if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject)
- // @ts-ignore
- return originalPush.call(this, location).catch((err) => err)
- }
- // @ts-ignore
- import { getPvUv } from '@/api/public.js'
- Vue.use(VueRouter)
- const routes: Array<RouteConfig> = [
- // 项目概况
- {
- path: '/',
- name: 'Overview',
- // redirect: '/otherMatter',
- component: () => import(/* webpackChunkName: "overview" */ '../views/overview/index.vue'),
- meta: {
- keepAlive: true,
- showTabbar: true,
- },
- },
- // 项目概况
- {
- path: '/overview',
- name: 'Overview',
- component: () => import(/* webpackChunkName: "overview" */ '../views/overview/index.vue'),
- meta: {
- keepAlive: true,
- showTabbar: true,
- },
- },
- // 楼层功能
- {
- path: '/floorFunc',
- name: 'FloorFunc',
- component: () => import(/* webpackChunkName: "floorFunc" */ '../views/FloorFunc.vue'),
- meta: {
- keepAlive: true,
- showTabbar: true,
- },
- },
- // 设备设施
- {
- path: '/equipmentFacilities',
- name: 'EquipmentFacilities',
- component: () => import(/* webpackChunkName: "equipmentFacilities" */ '../views/equipmentFacilities/index.vue'),
- meta: {
- keepAlive: true,
- showTabbar: true,
- },
- },
- // 设备设施 --> 设备卡片跳转到的设备列表页面
- {
- path: '/equipmentList',
- name: 'EquipmentList',
- component: () => import(/* webpackChunkName: "equipmentList" */ '../views/equipmentFacilities/EquipmentList.vue'),
- meta: {
- keepAlive: false,
- showTabbar: false,
- hideNarBar: true,
- },
- },
- // 设备设施 --> 更多设备卡片 跳转到的设备列表页面
- {
- path: '/moreEquipmentList',
- name: 'MoreEquipmentList',
- component: () => import(/* webpackChunkName: "equipmentList" */ '../views/equipmentFacilities/MoreEquipmentList.vue'),
- meta: {
- keepAlive: false,
- showTabbar: false,
- hideNarBar: true,
- },
- },
- // 设备设置 --> 机房平面布置图
- {
- path: '/engineRoomPicture',
- name: 'EngineRoomPicture',
- component: () => import(/* webpackChunkName: "engineRoomPicture" */ '../views/equipmentFacilities/EngineRoomPicture.vue'),
- meta: {
- keepAlive: false,
- showTabbar: false,
- hideNarBar: true,
- },
- },
- // 设备设置 --> 楼层分布
- {
- path: '/systemFloor',
- name: 'SystemFloor',
- component: () => import(/* webpackChunkName: "systemFloor" */ '../views/equipmentFacilities/SystemFloor.vue'),
- meta: {
- keepAlive: false,
- showTabbar: true,
- hideNarBar: true,
- },
- },
- // 设备设置 --> 电井间控制商铺范围
- {
- path: '/electricWell',
- name: 'ElectricWell',
- component: () => import(/* webpackChunkName: "electricWell" */ '../views/equipmentFacilities/ElectricWell.vue'),
- meta: {
- keepAlive: false,
- showTabbar: false,
- hideNarBar: true,
- },
- },
- // 设备设置 --> 配电室低压柜及出线明细
- {
- path: '/lowVoltageCabinet',
- name: 'LowVoltageCabinet',
- component: () => import(/* webpackChunkName: "lowVoltageCabinet" */ '../views/equipmentFacilities/LowVoltageCabinet.vue'),
- meta: {
- keepAlive: false,
- showTabbar: false,
- hideNarBar: true,
- },
- },
- // 其他事项
- {
- path: '/otherMatter',
- name: 'OtherMatter',
- component: () => import(/* webpackChunkName: "otherMatter" */ '../views/otherMatter/index.vue'),
- meta: {
- keepAlive: true,
- showTabbar: true,
- },
- },
- // 其他事项 --> 综合事项
- {
- path: '/comprehensiveMatter',
- name: 'ComprehensiveMatter',
- component: () => import(/* webpackChunkName: "comprehensiveMatter" */ '../views/otherMatter/ComprehensiveMatter.vue'),
- meta: {
- keepAlive: true,
- showTabbar: true,
- },
- },
- // 其他事项 --> 综合事项 --> 政府/其他 事项列表页面
- {
- path: '/comprehensiveMatterList',
- name: 'ComprehensiveMatterList',
- component: () => import(/* webpackChunkName: "comprehensiveMatterList" */ '../views/otherMatter/ComprehensiveMatterList.vue'),
- meta: {
- keepAlive: false,
- showTabbar: false,
- hideNarBar: true,
- },
- },
- // 其他事项 --> 辅助用房
- {
- path: '/auxiliaryRoom',
- name: 'AuxiliaryRoom',
- component: () => import(/* webpackChunkName: "auxiliaryRoom" */ '../views/otherMatter/AuxiliaryRoom.vue'),
- meta: {
- keepAlive: false,
- showTabbar: true,
- },
- },
- // 说明书更新记录
- {
- path: '/updateRecord',
- name: 'UpdateRecord',
- component: () => import(/* webpackChunkName: "updateRecord" */ '../views/overview/UpdateRecord.vue'),
- meta: {
- keepAlive: true,
- showTabbar: false,
- hideNarBar: true,
- },
- },
- // 说明书更新记录详情
- {
- path: '/updateRecordDetail',
- name: 'UpdateRecordDetail',
- component: () => import(/* webpackChunkName: "updateRecordDetail" */ '../views/overview/UpdateRecordDetail.vue'),
- meta: {
- keepAlive: false,
- showTabbar: false,
- hideNarBar: true,
- },
- },
- // 平面图查看
- {
- path: '/mapView',
- name: 'MapView',
- component: () => import(/* webpackChunkName: "mapView" */ '../views/overview/MapView.vue'),
- meta: {
- keepAlive: false,
- showTabbar: false,
- hideNarBar: true,
- },
- },
- // 平面图查看(特殊)
- {
- path: '/mapOther',
- name: 'MapOther',
- component: () => import(/* webpackChunkName: "mapOther" */ '../views/overview/MapOther.vue'),
- meta: {
- keepAlive: false,
- showTabbar: false,
- hideNarBar: true,
- },
- },
- // 全局搜索
- {
- path: '/globalSearch',
- name: 'GlobalSearch',
- component: () => import(/* webpackChunkName: "globalSearch" */ '../views/GlobalSearch.vue'),
- meta: {
- keepAlive: false,
- showTabbar: false,
- hideNarBar: true,
- },
- },
- // 设备详情页
- {
- path: '/assetDetail',
- name: 'AssetDetail',
- component: () => import(/* webpackChunkName: "assetDetail" */ '../views/AssetDetail.vue'),
- meta: {
- keepAlive: false,
- showTabbar: false,
- hideNarBar: true,
- },
- },
- ]
- const router = new VueRouter({
- mode: 'history',
- base: process.env.BASE_URL,
- routes,
- })
- // 跳入路由后要对发送pvuv
- router.afterEach((to, from) => {
- // console.log(to, from)
- // 项目概览,楼层功能,设备设施,其他事项 记录pupv
- let pupvArr = ['Overview', 'FloorFunc', 'EquipmentFacilities', 'OtherMatter']
- // tabbar对应的四个路由相互切换,发送puuv
- // @ts-ignore
- if (!pupvArr.includes(to.name) || !pupvArr.includes(from.name)) {
- return true
- }
- let postParams = {
- type: 'router',
- target: to.name,
- parameter: to.path,
- app: 'H5',
- }
- const data = {
- plazaId: store.getters['plazaId'],
- }
- getPvUv(data, postParams)
- .then((res: any) => {
- // console.log('pvuv', res)
- })
- .catch((res: any) => {
- // console.log('error', res)
- })
- })
- export default router
|