删除上个版本的代码

Former-commit-id: 6bda49593a2b4816ad2b4b947fa353c6240b2a06
This commit is contained in:
liyang
2018-08-22 15:12:03 +08:00
parent 73b26812ef
commit e4a16cf07e
125 changed files with 0 additions and 7539 deletions
-50
View File
@@ -1,50 +0,0 @@
import Vue from 'vue'
import VueRouter from 'vue-router'
import util from '@/libs/util.js'
// 路由数据
import routes from './routes'
Vue.use(VueRouter)
// 导出路由 在 main.js 里使用
const router = new VueRouter({
routes
})
/**
* 路由拦截
* 权限验证
*/
router.beforeEach((to, from, next) => {
// 验证当前路由所有的匹配中是否需要有登陆验证的
if (to.matched.some(r => r.meta.requiresAuth)) {
// 这里暂时将cookie里是否存有token作为验证是否登陆的条件
// 请根据自身业务需要修改
const token = util.cookies.get('token')
if (token && token !== 'undefined') {
next()
} else {
// 没有登陆的时候跳转到登陆界面
next({
name: 'login'
})
}
} else {
// 不需要身份校验 直接通过
next()
}
})
router.afterEach(to => {
// 需要的信息
const app = router.app
const { name, params, query } = to
// 多页控制 打开新的页面
app.$store.commit('d2adminPageOpenNew', { name, params, query })
// 更改标题
util.title(to.meta.title)
})
export default router
-75
View File
@@ -1,75 +0,0 @@
// layout
import layoutHeaderAside from '@/layout/header-aside'
const meta = { requiresAuth: true }
/**
* 在主框架内显示
*/
const frameIn = [
{
path: '/',
redirect: { name: 'index' },
component: layoutHeaderAside,
children: [
{
path: 'index',
name: 'index',
meta,
component: () => import('@/pages/index')
},
{
path: '/page1',
name: 'page1',
component: () => import('@/pages/page1'),
meta: { meta, title: '页面 1' }
},
{
path: '/page2',
name: 'page2',
component: () => import('@/pages/page2'),
meta: { meta, title: '页面 2' }
},
{
path: '/page3',
name: 'page3',
component: () => import('@/pages/page3'),
meta: { meta, title: '页面 3' }
}
]
}
]
/**
* 在主框架之外显示
*/
const frameOut = [
// 登陆
{
path: '/login',
name: 'login',
component: () => import('@/pages/login')
}
]
/**
* 错误页面
*/
const errorPage = [
// 404
{
path: '*',
name: '404',
component: () => import('@/pages/error-page-404')
}
]
// 导出需要显示菜单的
export const frameInRoutes = frameIn
// 重新组织后导出
export default [
...frameIn,
...frameOut,
...errorPage
]