|
@@ -1,7 +1,7 @@
|
|
|
import Vue from 'vue'
|
|
import Vue from 'vue'
|
|
|
import Router from 'vue-router'
|
|
import Router from 'vue-router'
|
|
|
Vue.use(Router)
|
|
Vue.use(Router)
|
|
|
-import { canIShow } from '@/permission'
|
|
|
|
|
|
|
+
|
|
|
import Layout from '@/layout'
|
|
import Layout from '@/layout'
|
|
|
export const constantRoutes = [
|
|
export const constantRoutes = [
|
|
|
{
|
|
{
|
|
@@ -527,19 +527,4 @@ const createRouter = () => new Router({
|
|
|
routes: constantRoutes
|
|
routes: constantRoutes
|
|
|
})
|
|
})
|
|
|
const router = createRouter()
|
|
const router = createRouter()
|
|
|
-router.beforeEach((to, from, next) => {
|
|
|
|
|
- canIShow(to.meta.roles).then((res) => {
|
|
|
|
|
- if (res) {
|
|
|
|
|
- next()
|
|
|
|
|
- } else {
|
|
|
|
|
- if (to.name === 'login' || to.name === 'userRegister' || to.name === 'userForm' || to.name === 'thirdLogin') {
|
|
|
|
|
- next()
|
|
|
|
|
- } else {
|
|
|
|
|
- next({
|
|
|
|
|
- name: '401'
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
-})
|
|
|
|
|
export default router
|
|
export default router
|