diff --git a/src/permission.js b/src/permission.js index 81f9d113..7913851f 100644 --- a/src/permission.js +++ b/src/permission.js @@ -4,6 +4,7 @@ import { Message } from 'element-ui' import NProgress from 'nprogress' // progress bar import 'nprogress/nprogress.css'// progress bar style import { getToken } from '@/utils/auth' // getToken from cookie +import settings from '@/settings' NProgress.configure({ showSpinner: false })// NProgress Configuration @@ -14,7 +15,7 @@ function hasPermission(roles, permissionRoles) { return roles.some(role => permissionRoles.indexOf(role) >= 0) } -const whiteList = ['/login', '/auth-redirect']// no redirect whitelist +const whiteList = settings.whiteList// no redirect whitelist router.beforeEach((to, from, next) => { NProgress.start() // start progress bar diff --git a/src/settings.js b/src/settings.js index b566ef1d..fa8d335a 100644 --- a/src/settings.js +++ b/src/settings.js @@ -35,7 +35,14 @@ export default { * The default is only used in the production env * If you want to use it in dev, you can pass ['production','development'] */ - errorLog: 'production' + errorLog: 'production', + + /** + * @type {array} ['/login', '/auth-redirect'] + * @description Set some pages, you can go in without logging in. + * Detail logic in permission.js + */ + whiteList: ['/login', '/auth-redirect'] // permission: true, // i18n: true diff --git a/src/utils/errorLog.js b/src/utils/errorLog.js index 7b33b542..c3c0597f 100644 --- a/src/utils/errorLog.js +++ b/src/utils/errorLog.js @@ -9,7 +9,6 @@ const { errorLog: needErrorLog } = settings function checkNeed(arg) { const env = process.env.NODE_ENV - console.log(needErrorLog) if (isString(needErrorLog)) { return env === needErrorLog }