Fixiaobai
2023-08-29 809f8b1279bf84f28bccabc4f95a8eba6c22a24d
放行委托新增
已修改3个文件
17 ■■■■ 文件已修改
.env.production 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
.env.staging 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/router/index.js 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.env.production
@@ -3,5 +3,5 @@
# base api
# VUE_APP_BASE_API = '/prod-api'
VUE_APP_BASE_API = 'http://192.168.110.167:1234/'
VUE_APP_BASE_API = 'http://localhost:1234/'
.env.staging
@@ -5,6 +5,6 @@
# base api
# VUE_APP_BASE_API = '/stage-api'
VUE_APP_BASE_API = 'http://192.168.110.167:1234/'
VUE_APP_BASE_API = 'http://localhost:1234/'
src/router/index.js
@@ -590,7 +590,7 @@
    Routees = baseRouter
  }
  return new Router({
    // mode: 'history', // require service support
    mode: 'history', // require service support
    scrollBehavior: () => ({ y: 0 }),
    routes: Routees
  })
@@ -602,7 +602,14 @@
  let newRouter = createRouter(getRoutes())
  router.matcher =  newRouter.matcher
}
router.beforeEach(async (to, from, next) => {
router.beforeEach((to, from, next) => {
  /**
   * 委托新增  放行
   */
  if (to.path.indexOf("/addCommision/") === 0) {
    next()
    return
  }
  // 1. 判断是不是登录页面
  // 是登录页面
  if (to.path === '/login') {
@@ -612,7 +619,7 @@
    // 2. 判断 是否登录过
    let token = sessionStorage.getItem('user')
    if(token!=null&&token!=undefined){
      await resetRouter()
      resetRouter()
    }
    token ? next() : next('/login')
  }