|
|
|
@ -1,11 +1,25 @@
|
|
|
|
|
/*
|
|
|
|
|
* @Author: your name
|
|
|
|
|
* @Date: 2021-10-08 09:26:42
|
|
|
|
|
* @LastEditTime: 2021-10-23 17:40:41
|
|
|
|
|
* @LastEditors: Please set LastEditors
|
|
|
|
|
* @Description: In User Settings Edit
|
|
|
|
|
* @FilePath: /data-show/src/permission.js
|
|
|
|
|
*/
|
|
|
|
|
import router from "@/router"
|
|
|
|
|
import NProgress from "nprogress"
|
|
|
|
|
import "nprogress/nprogress.css"
|
|
|
|
|
|
|
|
|
|
const whitePath = ['/', '/login', '/industryDataExport','/index']
|
|
|
|
|
const token = sessionStorage.getItem('token');
|
|
|
|
|
router.beforeEach((to, from, next) => {
|
|
|
|
|
// console.log(to,from, next)
|
|
|
|
|
NProgress.start()
|
|
|
|
|
next()
|
|
|
|
|
if(!token && !whitePath.includes(to.path)) {
|
|
|
|
|
next('/login');
|
|
|
|
|
} else {
|
|
|
|
|
NProgress.start()
|
|
|
|
|
next()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
router.afterEach(() => {
|
|
|
|
|