血透系统pad前端

permission.js 374B

123456789101112131415161718192021
  1. import router from './router'
  2. import store from './store'
  3. const loginWhiteList = ['/'] // 登录验证白名单
  4. router.beforeEach((to, from, next) => {
  5. // 线上注释
  6. // next()
  7. // return
  8. if (store.getters.user.user.id == 0) {
  9. if (loginWhiteList.indexOf(to.path) !== -1) {
  10. next()
  11. } else {
  12. next({ path: '/'})
  13. }
  14. } else {
  15. next()
  16. }
  17. })