vue 访问问题,第一次访问不行,之后就可以

nginx部署vue,电脑第一次访问白名单uri,总是返回到登陆首页,之后就能正确访问这个白名单的uri了。已经排除后端问题

那你看一下的url页面做过什么拦截没有,是不是需要验证登录

你好,贴下你的路由拦截代码,应该是被拦截的缘故。

import Vue from 'vue' import Router from 'vue-router'

Vue.use(Router)

/* Layout / import Layout from '@/layout' import Layout2 from '@/layout/index2' /*

  • Note: sub-menu only appear when route children.length >= 1
  • Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
  • hidden: true if set true, item will not show in the sidebar(default is false)
  • alwaysShow: true if set true, will always show the root menu
  •                            if not set alwaysShow, when item has more than one children route,
    
  •                            it will becomes nested mode, otherwise not show the root menu
    
  • redirect: noRedirect if set noRedirect will no redirect in the breadcrumb
  • name:'router-name' the name is used by (must set!!!)
  • meta : { roles: ['admin','editor'] control the page roles (you can set multiple roles) title: 'title' the name show in sidebar and breadcrumb (recommend set) icon: 'svg-name' the icon show in the sidebar breadcrumb: false if set false, the item will hidden in breadcrumb(default is true) activeMenu: '/example/list' if set path, the sidebar will highlight the path you set }
  • /

/**

  • constantRoutes

  • a base page that does not have permission requirements

  • all roles can be accessed

  • / export const constantRoutes = [{ path: '/login', component: () => import('@/views/login/index'), hidden: true, meta: {

    title: '登录',
    

    }, }, { path: '/adminLogin', component: () => import('@/views/login/loginByAccount'), hidden: true, meta: {

    title: '登录',
    

    }, }, { path: '/404', component: () => import('@/views/404'), hidden: true, meta: {

    title: '404',
    

    }, }, { path: '/notice', component: () => import('@/views/notice'), hidden: true, meta: {

    title: '通知公告',
    

    }, }, {

      path: '/orderDetail',
      hidden: true,
      meta: {
        title: '交办单详情',//弹窗显示交办单详情
      },
      component: () => import('@/views/assignedByProcessing/orderDetail')
    },
    

    { path: '/', redirect: '/index', component: Layout2, meta: {

    title: '首页',
    // role: ['首页'],
    icon: 'menu1'
    

    }, children: [{

    path: 'index',
    name: 'Index',
    component: () => import('@/views/dataOverview/index'),
    meta: {
      title: '首页',
      // role: ['首页'],
      icon: 'menu1',
      parentMenu: '首页'
    }
    

    }] },

// 404 page must be placed at the end !!! // { path: '*', redirect: '/404', hidden: true } ]

export const asyncRoutes = [{ path: '/video', component: Layout, meta: { title: '视频督察', icon: 'menu2', role: ['视频督察'] }, children: [{ path: 'resource', name: 'VideoResource', hidden: true, meta: { title: '视频资源', role: ['视频资源'], parentMenu: '视频督察' }, component: () => import('@/views/video/videoResources') }, { path: 'videoPlay', name: 'VideoPlay', hidden: true, meta: { title: '视频播放', parentMenu: '视频督察' }, component: () => import('@/views/video/videoPlay') }, { path: 'playback', name: 'VideoPlayback', hidden: true, meta: { title: '录像回放', role: ['录像回放'], parentMenu: '视频督察' }, component: () => import('@/views/video/videoPlayBack') }, { path: 'haikang', name: 'Haikang', hidden: true, meta: { title: '海康组织配置', role: ['海康组织配置'], parentMenu: '视频督察' }, component: () => import('@/views/video/haikang') },

  // {
  //   path: 'round-robin',
  //   name:'RoundRobin',
  //   hidden: true,
  //   meta: {
  //     title: '视频轮询',
  //     role: ['视频轮询'],
  //     parentMenu:'视频督察'
  //   },
  //   component: () => import('@/views/video/videoPolling')
  // },
  // {
  //   path: 'cross',
  //   name:'VideoCross',
  //   hidden: true,
  //   meta: {
  //     title: '交叉督察',
  //     role: ['交叉督察'],
  //     parentMenu:'视频督察'
  //   },
  //   component: () => import('@/views/video/crossInspector')
  // },
  {
    path: 'equipManage',
    name: 'VideoEquipManage',
    hidden: true,
    meta: {
      title: '设备管理',
      role: ['设备管理'],
      parentMenu: '视频督察'
    },
    component: () => import('@/views/video/equipmentManagement')
  },
  {
    path: 'equipGroup',
    name: 'VideoEquipGroup',
    hidden: true,
    meta: {
      title: '设备分组管理',
      role: ['设备分组管理'],
      parentMenu: '视频督察'
    },
    component: () => import('@/views/video/equipmentGroupManagement')
  },
  {
    path: 'dataStatis/online',
    name: 'DataStatisOnline',
    hidden: true,
    meta: {
      title: '设备在线统计',
      role: ['设备在线统计'],
      parentMenu: '视频督察'
    },
    component: () => import('@/views/video/onlineEquipmentStatistics')
  },
  {
    path: 'dataStatis/use',
    name: 'DataStatisUse',
    hidden: true,
    meta: {
      title: '设备使用统计',
      role: ['设备使用统计'],
      parentMenu: '视频督察'
    },
    component: () => import('@/views/video/equipmentUsageStatistics')
  },
  {
    path: 'dataStatis/operate',
    name: 'DataStatisOperate',
    hidden: true,
    meta: {
      title: '用户操作统计',
      role: ['用户操作统计'],
      parentMenu: '视频督察'
    },
    component: () => import('@/views/video/userOperationStatistics')
  },
  {
    path: 'dataStatis/diagnosis',
    name: 'DataStatisDiagnosis',
    hidden: true,
    meta: {
      title: '视频质量诊断统计',
      role: ['视频质量诊断统计'],
      parentMenu: '视频督察'
    },
    component: () => import('@/views/video/equipmentQualityDiagnosticStatistics')
  }
]

}, { path: '/voice', component: Layout, meta: { title: '语音督察', icon: 'menu3', role: ['语音督察'] }, children: [{ path: 'check', name: 'VoiceCheck', hidden: true, meta: { title: '录音查听', role: ['录音查听'], parentMenu: '语音督察' }, component: () => import('@/views/record/recordCheck') }, // { // path: 'listen', // name: 'Voicelisten', // hidden: true, // meta: { // title: '实时监听', // role: ['实时监听'], // parentMenu: '语音督察' // }, // component: () => import('@/views/record/realTimeMonitoring') // // 没好 // }, { path: 'identify', name: 'voiceRecognition', hidden: true, meta: { title: '语音识别', role: ['语音识别'], parentMenu: '语音督察' }, component: () => import('@/views/record/voiceRecognition') }, { path: 'warnVoice', name: 'WarnVoice', hidden: true, meta: { title: '语音预警', role: ['语音预警'], parentMenu: '语音督察' }, component: () => import('@/views/record/warnVoice') }, { path: 'checkCol', name: 'CheckCol', hidden: true, meta: { title: '查听记录统计', role: ['查听记录统计'], parentMenu: '语音督察' }, component: () => import('@/views/record/voiceCheckStatistics') }, { path: 'recordCol', name: 'RecordCol', hidden: true, meta: { title: '录音信息统计', role: ['录音信息统计'], parentMenu: '语音督察' }, component: () => import('@/views/record/recordingInformationStatistics') //没好 }, { path: 'depTelCol', name: 'DepTelCol', hidden: true, meta: { title: '部门电话统计', role: ['部门电话统计'], parentMenu: '语音督察' }, component: () => import('@/views/record/departmentalTelephoneStatistics') }, { path: 'colAnalysis', name: 'ColAnalysis', hidden: true, meta: { title: '统计分析', role: ['统计分析'], parentMenu: '语音督察' }, component: () => import('@/views/record/statisticAnalysis') // 没好 }, // 删除 字典表里配置 // { // path: 'resultCfg', // name:'ResultCfg', // hidden: true, // meta: { // title: '查听结果配置', // role: ['查听结果配置'], // parentMenu:'语音督察' // }, // component: () => import('@/views/record/checkResultConfiguration') // }, { path: 'deptTelCfg', name: 'DeptTelCfg', hidden: true, meta: { title: '部门电话配置', role: ['部门电话配置'], parentMenu: '语音督察' }, component: () => import('@/views/record/departmentPhoneCheck') }, { path: 'orderSmsCfg', name: 'OrderSmsCfg', hidden: true, meta: { title: '交办单配置', role: ['交办单配置'], parentMenu: '语音督察' }, component: () => import('@/views/record/handInOrderConfiguration') //没好 }, { path: 'keywordCfg', name: 'KeywordCfg', hidden: true, meta: { title: '关键词配置', role: ['关键词配置'], parentMenu: '语音督察' }, component: () => import('@/views/record/keywordConfiguration') }, { path: 'warnTypeCfg', name: 'WarnTypeCfg', hidden: true, meta: { title: '预警类型配置', role: ['预警类型配置'], parentMenu: '语音督察' }, component: () => import('@/views/record/warnTypeConfig') }, { path: 'resultCfg',//删除,移到综合应用 字典配置 name: 'ResultCfg', hidden: true, meta: { title: '查听结果配置', role: ['查听结果配置'], parentMenu: '语音督察' }, component: () => import('@/views/record/checkResultConfiguration') } ] }, { path: '/record', component: Layout, meta: { title: '警情报备', icon: 'menu5', role: ['警情报备'] }, children: [{ path: 'totalsList', name: 'TotalsList', hidden: true, meta: { title: '汇总查询', role: ['汇总查询'], parentMenu: '警情报备' }, component: () => import('@/views/policePrepare/index') }, { path: 'addressee', name: 'Addressee', hidden: true, meta: { title: '收件人配置', role: ['收件人配置'], parentMenu: '警情报备' }, component: () => import('@/views/policePrepare/addressee') }, { path: 'detail', name: 'AlertDetail', hidden: true, meta: { title: '报备详情', parentMenu: '警情报备' }, component: () => import('@/views/policePrepare/alertDetail') }, { path: 'rightCase', name: 'RightsInfo', hidden: true, meta: { title: '民警维权事件', role: ['民警维权事件'], parentMenu: '警情报备' }, component: () => import('@/views/policePrepare/rightsInfo') }, { path: 'rightsDetail', name: 'RightsDetail', hidden: true, meta: { title: '民警维权详情', parentMenu: '警情报备' }, component: () => import('@/views/policePrepare/rightsDetail') },

  {
    path: 'rcReport',
    name: 'RightsReport',
    hidden: true,
    meta: {
      title: '民警维权事件报表',
      role: ['民警维权事件报表'],
      parentMenu: '警情报备'
    },
    component: () => import('@/views/policePrepare/rightsChart')
  },
  {
    path: 'reportedStatistics',
    name: 'ReportedStatistics',
    hidden: true,
    meta: {
      title: '报备信息汇总统计',
      role: ['报备信息汇总统计'],
      parentMenu: '警情报备'
    },
    component: () => import('@/views/policePrepare/reportedStatistics')
  },
  {
    path: 'rightsWarn',
    name: 'RightsWarn',
    hidden: true,
    meta: {
      title: '民警维权预警',
      role: ['民警维权预警'],
      parentMenu: '警情报备'
    },
    component: () => import('@/views/policePrepare/rightsWarn')
  },

]

}, { path: '/enforcement', component: Layout, meta: { title: '执法督察', icon: 'menu8', role: ['执法督察'] }, children: [{ path: 'warnPoint', name: 'WarnPoint', hidden: true, meta: { title: '风险点', role: ['风险点'], parentMenu: '执法督察' }, component: () => import('@/views/lawSupervision/warnPoint') }, { path: 'modelManage', name: 'ModelManage', hidden: true, meta: { title: '模型管理', role: ['模型管理'], parentMenu: '执法督察' }, component: () => import('@/views/lawSupervision/modelManage') }, { path: 'models', name: 'Models', hidden: true, meta: { title: '模型仓库', role: ['模型仓库'], parentMenu: '执法督察' }, component: () => import('@/views/lawSupervision/models') }, { path: 'warnNew', name: 'WarnNew', hidden: true, meta: { title: '预警信息', role: ['预警信息'], parentMenu: '执法督察' }, component: () => import('@/views/lawSupervision/warnNew') }, { path: 'warnList', name: 'WarnList', hidden: true, meta: { title: '预警汇总', role: ['预警汇总'], parentMenu: '执法督察' }, component: () => import('@/views/lawSupervision/warnList') }, { path: 'warnDetail', name: 'WarnDetail', hidden: true, meta: { title: '预警详情', // role: ['预警汇总'], parentMenu: '执法督察' }, component: () => import('@/views/lawSupervision/warnDetail') },

]

}, { path: '/location', component: Layout, meta: { title: '定位督察', icon: 'menu9', role: ['定位督察'] }, children: [{ path: 'map', name: 'Map', hidden: true, meta: { title: '实时定位', role: ['实时定位'], parentMenu: '定位督察' }, component: () => import('@/views/location/index') }, ] }, { path: '/quantify', component: Layout, meta: { title: '工作量化', icon: 'menu10', role: ['工作量化'] }, children: [{ path: 'myTask', name: 'MyTask', hidden: true, meta: { title: '我的任务', role: ['我的任务'], parentMenu: '工作量化' }, component: () => import('@/views/quantify/myTask') }, { path: 'taskDetail', name: 'TaskDetail', hidden: true, meta: { title: '任务详情', role: ['任务详情'], parentMenu: '工作量化' }, component: () => import('@/views/quantify/taskDetail') }, { path: 'allocation', name: 'Allocation', hidden: true, meta: { title: '量化分配', role: ['量化分配'], parentMenu: '工作量化' }, component: () => import('@/views/quantify/allocation') }, ] },

{ path: '/orderHandle', component: Layout, meta: { title: '交办处理', icon: 'menu6', role: ['交办处理'] }, children: [{ path: 'orderState', name: 'OrderState', hidden: true, meta: { title: '交办状态', role: ['交办状态'], parentMenu: '交办处理' }, component: () => import('@/views/assignedByProcessing/index') }, { path: 'orderList', name: 'OrderList', hidden: true, meta: { title: '交办汇总', role: ['交办汇总'], parentMenu: '交办处理' }, component: () => import('@/views/assignedByProcessing/assignList') }, { path: 'orderEdit', name: 'OrderEdit', hidden: true, meta: { title: '交办单', parentMenu: '交办处理' }, component: () => import('@/views/assignedByProcessing/orderEdit') }, { path: 'orderDetail', name: 'OrderDetail', hidden: true, meta: { title: '交办单详情', parentMenu: '交办处理' }, component: () => import('@/views/assignedByProcessing/orderDetail') }, { path: 'departmentStatistics', name: 'DepartmentStatistics', hidden: true, meta: { title: '部门问题统计', parentMenu: '交办处理' }, component: () => import('@/views/assignedStatistics/department') }, { path: 'problemTypesStatistics', name: 'ProblemTypesStatistics', hidden: true, meta: { title: '问题类型统计', parentMenu: '交办处理' }, component: () => import('@/views/assignedStatistics/problemTypes') }, { path: 'comparisonStatistics', name: 'ComparisonStatistics', hidden: true, meta: { title: '问题对比统计', parentMenu: '交办处理' }, component: () => import('@/views/assignedStatistics/comparison') }, { path: 'inspectorStatistics', name: 'InspectorStatistics', hidden: true, meta: { title: '督察交办统计', parentMenu: '交办处理' }, component: () => import('@/views/assignedStatistics/inspector') }, { path: 'problemStatistics', name: 'ProblemStatistics', hidden: true, meta: { title: '民警、辅警问题数统计', parentMenu: '交办处理' }, component: () => import('@/views/assignedStatistics/problem') },

  {
    path: 'disposalStatistics',
    name: 'DisposalStatistics',
    hidden: true,
    meta: {
      title: '处置超期统计',
      parentMenu: '交办处理'
    },
    component: () => import('@/views/assignedStatistics/disposal')
  },

  {
    path: 'smsConfig',
    name: 'SmsConfig',
    hidden: true,
    meta: {
      title: '配置',
      parentMenu: '交办处理'
    },
    component: () => import('@/views/assignedByProcessing/smsConfig')
  },
]

}, { path: '/sms', component: Layout, meta: { title: '警务访评', icon: 'menu7', role: ['警务访评'] }, children: [{ path: 'assign', name: 'Assign', hidden: true, meta: { title: '(一级)短信回访记录', role: ['(一级)短信回访记录'], parentMenu: '警务访评' }, component: () => import('@/views/policeReview/assign') }, { path: 'returnVisit', name: 'ReturnVisit', hidden: true, meta: { title: '(二级)部门负责人回访', role: ['(二级)部门负责人回访'], parentMenu: '警务访评' }, component: () => import('@/views/policeReview/returnVisit') }, { path: 'departVisit', name: 'DepartVisit', hidden: true, meta: { title: '(三级)督察部门回访', role: ['(三级)督察部门回访'], parentMenu: '警务访评' }, component: () => import('@/views/policeReview/departVisit') }, // { // path: 'handList', // name: 'HandList', // hidden: true, // meta: { // title: '访评交办单列表', // role: ['访评交办单列表'], // parentMenu: '警务访评' // }, // component: () => import('@/views/policeReview/handList') // }, { path: 'flowList', name: 'FlowList', hidden: true, meta: { title: '已流转列表', role: ['已流转列表'], parentMenu: '警务访评' }, component: () => import('@/views/policeReview/flowList') }, { path: 'smsCheck', name: 'SmsCheck', hidden: true, meta: { title: '短信回访满意抽查', role: ['短信回访满意抽查'], parentMenu: '警务访评' }, component: () => import('@/views/policeReview/smsCheck') }, { path: 'resultsChange', name: 'ResultsChange', hidden: true, meta: { title: '回访结果变更抽查', role: ['回访结果变更抽查'], parentMenu: '警务访评' }, component: () => import('@/views/policeReview/resultsChange') }, { path: 'sampleInput', name: 'SampleInput', hidden: true, meta: { title: '样本录入', role: ['样本录入'], parentMenu: '警务访评' }, component: () => import('@/views/policeReview/sampleInput') }, { path: 'satisfactionStatistics', name: 'SatisfactionStatistics', hidden: true, meta: { title: '满意度统计展示', role: ['满意度统计展示'], parentMenu: '警务访评' }, component: () => import('@/views/policeReview/satisfactionStatistics') }, { path: 'safetyStatistics', name: 'SafetyStatistics', hidden: true, meta: { title: '安全感统计展示', role: ['安全感统计展示'], parentMenu: '警务访评' }, component: () => import('@/views/policeReview/safetyStatistics') //没好 }, { path: 'reversionRateStatistics', name: 'ReversionRateStatistics', hidden: true, meta: { title: '回复率统计展示', role: ['回复率统计展示'], parentMenu: '警务访评' }, component: () => import('@/views/policeReview/reversionRateStatistics') },

  {
    path: 'unsatisfactoryConfig',
    name: 'UnsatisfactoryConfig',
    hidden: true,
    meta: {
      title: '不满意原因配置',
      role: ['不满意原因配置'],
      parentMenu: '警务访评'
    },
    component: () => import('@/views/policeReview/unsatisfactoryConfig')
  },
  {
    path: 'smsConfig',
    name: 'SmsConfig1',
    hidden: true,
    meta: {
      title: '短信模板配置',
      role: ['短信模板配置'],
      parentMenu: '警务访评'
    },
    component: () => import('@/views/policeReview/smsConfig')
  },
  {
    path: 'operatingDepartConfig',
    name: 'OperatingDepartConfig',
    hidden: true,
    meta: {
      title: '业务部门配置',
      role: ['业务部门配置'],
      parentMenu: '警务访评'
    },
    component: () => import('@/views/policeReview/operatingDepartConfig')
  },
  {
    path: 'secondaryVisit',
    name: 'SecondaryVisit',
    hidden: true,
    meta: {
      title: '二级回访短信',
      role: ['二级回访短信'],
      parentMenu: '警务访评'
    },
    component: () => import('@/views/policeReview/secondaryVisit')
  }

]

}, { path: '/system', component: Layout, meta: { title: '综合应用', icon: 'menu4', role: ['综合应用'] }, children: [{ path: 'taskManager', name: 'TaskManager', hidden: true, meta: { title: '定时任务管理', role: ['定时任务管理'], parentMenu: '综合应用' }, component: () => import('@/views/system/taskManage') // 毕 没有好 }, { path: 'organization', name: 'organization', hidden: true, meta: { title: '机构管理', role: ['机构管理'], parentMenu: '综合应用' }, component: () => import('@/views/system/organization') }, { path: 'roleManager', name: 'RoleManager', hidden: true, meta: { title: '角色管理', role: ['角色管理'], parentMenu: '综合应用' }, component: () => import('@/views/system/role') }, { path: 'userManager', name: 'UserManager', hidden: true, meta: { title: '用户管理', role: ['用户管理'], parentMenu: '综合应用' }, component: () => import('@/views/system/user') }, { path: 'menuManager', name: 'MenuManager', hidden: true, meta: { title: '菜单管理', role: ['菜单管理'], parentMenu: '综合应用' }, component: () => import('@/views/system/menu') }, { path: 'dutyCheck', name: 'DutyCheck', hidden: true, meta: { title: '值班信息查看', role: ['值班信息查看'], parentMenu: '综合应用' }, component: () => import('@/views/system/dutyInfo') // 毕 没有好 }, { path: 'log', name: 'InspectorLog', hidden: true, meta: { title: '督察行为日志', role: ['督察行为日志'], parentMenu: '综合应用' }, component: () => import('@/views/system/inspectorLog') }, { path: 'noticeManage', name: 'NoticeManage', hidden: true, meta: { title: '通知通告管理', role: ['通知通告管理'], parentMenu: '综合应用' }, component: () => import('@/views/system/noticeManage') }, { path: 'dictManager', name: 'DictManager', hidden: true, meta: { title: '数据字典管理', role: ['数据字典管理'], parentMenu: '综合应用' }, component: () => import('@/views/system/dictionariesConfig') }, { path: 'workReportList', name: 'WorkReportList', hidden: true, meta: { title: '日常人员管理工作报备', role: ['日常人员管理工作报备'], parentMenu: '综合应用' }, component: () => import('@/views/system/workReportList') }, { path: 'defendReportList', name: 'DefendReportList', hidden: true, meta: { title: '设备故障或维护报备', role: ['设备故障或维护报备'], parentMenu: '综合应用' }, component: () => import('@/views/system/defendReportList') },

]

},

]

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