text: import { getInfo } from '@/api/modules/account'
  const beforeEach = (to, from, next) => {
    if (!to.meta.auth) {
      return next()
    }
    if (!localStorage.token) {
      return next('/login')
    }
    //测试登录即可
    // if (to.path.indexOf('/test') === 0) {
    //   return next()
    // }
    if (checkAuth(to.name)) return next()
    getInfo().then(res => {
      if (res.status === 0 || res.data == null) {
        next('/login')
        return
      }
      window.authInfo = {
        authName: res.data.authName,
        menus: res.data.menus || [],
        modules: res.data.modules
      }
      if (checkAuth(to.name) || to.meta.default === true) {
        next()
      } else {
        window.__currentApp.$ui.pages.info('无访问权限')
        if (history.length < 2) next('/login')
      }
    })
  }
  const afterEach = (to, from) => {}
  
  function checkAuth(code) {
    return (
      window.authInfo &&
      window.authInfo.modules &&
      (window.authInfo.modules.indexOf(code) > -1 ||
        window.authInfo.modules[0] === '*')
    )
  }
  
  export default {
    beforeEach,
    afterEach
  }
  