Elizabeth's proactive approach involves introducing urinal toilet attachment , an ingenious concept that optimizes space and functionality.

permission.js 2.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // import router from './router'
  2. // import store from './store'
  3. // import { Message } from 'element-ui'
  4. // import NProgress from 'nprogress' // progress bar
  5. // import 'nprogress/nprogress.css'// progress bar style
  6. // import { getToken } from '@/utils/auth' // getToken from cookie
  7. // NProgress.configure({ showSpinner: false })// NProgress Configuration
  8. // // permission judge function
  9. // function hasPermission(roles, permissionRoles) {
  10. // if (roles.indexOf('admin') >= 0) return true // admin permission passed directly
  11. // if (!permissionRoles) return true
  12. // return roles.some(role => permissionRoles.indexOf(role) >= 0)
  13. // }
  14. // const whiteList = ['/login', '/authredirect']// no redirect whitelist
  15. // router.beforeEach((to, from, next) => {
  16. // NProgress.start() // start progress bar
  17. // if (getToken()) { // determine if there has token
  18. // /* has token*/
  19. // if (to.path === '/login') {
  20. // next({ path: '/' })
  21. // NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it
  22. // } else {
  23. // if (store.getters.roles.length === 0) { // 判断当前用户是否已拉取完user_info信息
  24. // store.dispatch('GetUserInfo').then(res => { // 拉取user_info
  25. // const roles = res.data.roles // note: roles must be a array! such as: ['editor','develop']
  26. // store.dispatch('GenerateRoutes', { roles }).then(() => { // 根据roles权限生成可访问的路由表
  27. // router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表
  28. // next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record
  29. // })
  30. // }).catch((err) => {
  31. // store.dispatch('FedLogOut').then(() => {
  32. // Message.error(err || 'Verification failed, please login again')
  33. // next({ path: '/' })
  34. // })
  35. // })
  36. // } else {
  37. // // 没有动态改变权限的需求可直接next() 删除下方权限判断 ↓
  38. // if (hasPermission(store.getters.roles, to.meta.roles)) {
  39. // next()//
  40. // } else {
  41. // next({ path: '/401', replace: true, query: { noGoBack: true }})
  42. // }
  43. // // 可删 ↑
  44. // }
  45. // }
  46. // } else {
  47. // /* has no token*/
  48. // if (whiteList.indexOf(to.path) !== -1) { // 在免登录白名单,直接进入
  49. // next()
  50. // } else {
  51. // next('/login') // 否则全部重定向到登录页
  52. // NProgress.done() // if current page is login will not trigger afterEach hook, so manually handle it
  53. // }
  54. // }
  55. // })
  56. // router.afterEach(() => {
  57. // NProgress.done() // finish progress bar
  58. // })