|
@@ -13,6 +13,13 @@ const routes = [
|
|
|
path: '/screen',
|
|
|
component: () => import('@/views/screen/index.vue'),
|
|
|
},
|
|
|
+ {
|
|
|
+ path: '/map',
|
|
|
+ component: () => import('@/views/map/index.vue'),
|
|
|
+ meta: {
|
|
|
+ noLogin: true
|
|
|
+ }
|
|
|
+ },
|
|
|
]
|
|
|
|
|
|
const router = createRouter({
|
|
@@ -21,12 +28,17 @@ const router = createRouter({
|
|
|
});
|
|
|
|
|
|
router.beforeEach((to, from, next) => {
|
|
|
- if (localStorage.getItem('sc_token')) {
|
|
|
- store.dispatch('app/LOAD_USER_INFO').then(() => {
|
|
|
- next()
|
|
|
- })
|
|
|
- } else {
|
|
|
+ if (to.meta.noLogin) {
|
|
|
next()
|
|
|
+ } else {
|
|
|
+ if (localStorage.getItem('sc_token')) {
|
|
|
+ store.dispatch('app/LOAD_USER_INFO').then(() => {
|
|
|
+ next()
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ next()
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
})
|
|
|
export default router;
|