loulijun2021
2023-05-23 00a4538b06beaf8b21dfdc6c4cec25e61ebc0ee5
src/permission.js
@@ -1,16 +1,16 @@
import router from './router'
import store from './store'
import { Message } from 'element-ui'
import {Message} from 'element-ui'
import NProgress from 'nprogress' // progress bar
import 'nprogress/nprogress.css' // progress bar style
import { getCookie, getToken } from '@/utils/auth' // get token from cookie
import {getCookie, getToken} from '@/utils/auth' // get token from cookie
import getPageTitle from '@/utils/get-page-title'
NProgress.configure({ showSpinner: false }) // NProgress Configuration
NProgress.configure({showSpinner: false}) // NProgress Configuration
const whiteList = ['/login', '/jgcj','/zpcj','/ckgl'] // no redirect whitelist
const whiteList = ['/login', '/jgcj', '/zpcj', '/ckgl', '/zp1', '/zp2', '/zp3'] // no redirect whitelist
router.beforeEach(async(to, from, next) => {
router.beforeEach(async (to, from, next) => {
  // start progress bar
  NProgress.start()
@@ -23,7 +23,7 @@
  if (hasToken) {
    if (to.path === '/login') {
      // if is logged in, redirect to the home page
      next({ path: '/' })
      next({path: '/'})
      NProgress.done()
    } else {
      const hasGetUserInfo = store.getters.name
@@ -42,7 +42,7 @@
          router.addRoutes(store.getters.addRouters)
          // hack方法 确保addRoutes已完成
          next({ ...to, replace: true })
          next({...to, replace: true})
          // next()
        } catch (error) {