Commit 8b0c2a2d by 姜雷

Merge branch 'develop' into 'test'

添加静态路由方法以及扩展白名单参数 See merge request !19
parents e0632436 d55ca3aa
...@@ -24,16 +24,25 @@ class SystemShell { ...@@ -24,16 +24,25 @@ class SystemShell {
this.mixinModule = mixinModule; this.mixinModule = mixinModule;
this.utils = utilsModule; this.utils = utilsModule;
} }
createSystem = ({ basePath = '/', routers, routeFilter }) => { createSystem = ({
basePath = '/',
routers,
routeFilter,
constantRouter,
whiteList,
}) => {
const router = new VueRouter({ const router = new VueRouter({
mode: 'history', mode: 'history',
base: basePath, base: basePath,
scrollBehavior: () => ({ y: 0 }), scrollBehavior: () => ({ y: 0 }),
routes: constantRouterMap, routes:
constantRouter && constantRouter instanceof Array
? [...constantRouterMap, ...constantRouter]
: constantRouterMap,
}); });
routeStore.install(store); routeStore.install(store);
extendCom(Vue); extendCom(Vue);
configRoutePermission(router, store, routers); configRoutePermission(router, store, routers, whiteList);
Vue.config.productionTip = false; Vue.config.productionTip = false;
let app = new Vue({ let app = new Vue({
......
...@@ -4,10 +4,21 @@ import 'nprogress/nprogress.css'; // Progress 进度条样式 ...@@ -4,10 +4,21 @@ import 'nprogress/nprogress.css'; // Progress 进度条样式
import { getToken } from '@/utils/auth'; // 验权 import { getToken } from '@/utils/auth'; // 验权
import { getAuthRoute } from '../utils/route'; import { getAuthRoute } from '../utils/route';
const configRoutePermission = (router, store, allAasyncRouterMap) => { const configRoutePermission = (
router,
store,
allAasyncRouterMap,
addwhiteList
) => {
NProgress.configure({ showSpinner: false }); // NProgress Configuration NProgress.configure({ showSpinner: false }); // NProgress Configuration
const whiteList = process.env.VUE_APP_WHITE_LIST.split(','); // 不重定向白名单 const whiteList =
addwhiteList && typeof addwhiteList === 'string'
? [
...process.env.VUE_APP_WHITE_LIST.split(','),
...addwhiteList.split(','),
]
: process.env.VUE_APP_WHITE_LIST.split(','); // 不重定向白名单
const getRouteAdd = () => { const getRouteAdd = () => {
let allRoute = store.getters.asyncRoutes; let allRoute = store.getters.asyncRoutes;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment