//路由守卫
router.beforeEach(function (to, from, next) {
if (to.path === '/login') {
next(); //登陆页面直接放行
} else {
let token = local.get('token');//自己写的获取本地储存的方法
if (token) {
next(); //存在token 直接放行
} else {
alert('你被发现了,你的IP地址已记录,我们已报警...');
next({ path: '/login' });
}
}
});