// Hooks import { datasetsBeforeEnter } from 'new-dashboard/router/hooks/check-navigation'; import store from '../../store'; // Lazy Pages const Data = () => import('new-dashboard/pages/Data/Data'); const Datasets = () => import('new-dashboard/pages/Data/Datasets'); const Subscriptions = () => import('new-dashboard/pages/Data/Subscriptions'); const Catalog = () => import('new-dashboard/pages/Data/Catalog'); const CatalogDataset = () => import('new-dashboard/pages/Data/CatalogDataset'); const CatalogDatasetData = () => import('new-dashboard/pages/Data/CatalogDatasetData'); const CatalogDatasetSummary = () => import('new-dashboard/pages/Data/CatalogDatasetSummary'); const routes = [ { path: '/datasets/:filter?', component: Data, meta: { title: () => '数据 | 快点' }, children: [ { path: 'spatial-data-catalog', name: 'spatial-data-catalog', component: Catalog, meta: { title: () => '空间数据目录 | 快点' } }, { path: '', component: Datasets, name: 'datasets', props: (route) => ({ datasetId: route.query.id, createVis: /^true$/i.test(route.query.create) }), meta: { title: () => '数据 | 快点' }, beforeEnter: datasetsBeforeEnter } ] }, { path: '/datasets/spatial-data-catalog/:type/:datasetId', component: CatalogDataset, meta: { title: () => '空间数据目录 | 快点' }, children: [ { path: 'data', name: 'catalog-dataset-data', component: CatalogDatasetData, meta: { title: () => '空间数据目录 | 快点' } }, { path: '', name: 'catalog-dataset-summary', component: CatalogDatasetSummary, meta: { title: () => '空间数据目录 | 快点' } } ] } ]; if (store.state.user.do_enabled) { routes[0].children.unshift({ path: 'subscriptions', name: 'subscriptions', component: Subscriptions, meta: { title: () => '订阅 | 快点' } }); } export default routes;