export default function (context) { const { route, store, redirect } = context const isClient = process.client let path // console.log('token', token); // console.log("cookies", cook); // 在服务端 // 在客户端判读是否需要登陆 if (isClient) { path = route.path } // console.log("path:"+path); const mainPath = path.split('?')[0] // console.log('mainPath', mainPath); if (store.state.user.role !== 'ADMIN' && mainPath.indexOf('/admin') >= 0) { redirect('/unauthorized') } }