//权限控制 import router from '@/router' import CacheUtils from '@/assets/js/utils/cacheUtils' // import NProgress from 'nprogress' // Progress 进度条 // import 'nprogress/nprogress.css' // Progress 进度条样式 export function permission() { router.beforeEach((to, from, next) => { //修改title const title = to.meta && to.meta.title if (title) { document.title = title } if(from.path == '/sale/signatureConfirmation' && to.path == '/sale/attachmentManagement'){ window.location.href = window.location.origin + '#' + from.path + '?orderNo=' + from.query.orderNo } //判断是否登录 let token = CacheUtils.getLocItem('token') if (!token) { CacheUtils.setLocItem('token','') //无token,判断是否需要登录 if (to.meta.auth) { if (window.WebViewJavascriptBridge) { //eslint-disable-next-line EWebBridge.webCallAppInJs('bridge', { flag: 'login' }) } else { next(`/login?redirect=${to.path}`) } } else { next() } } else { if (to.path == '/login') { next({ path: '/' }) } else { next() } } }) // 结束Progress router.afterEach(() => { // NProgress.done() }) }