| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
- import { ERouterName } from '/@/types/index'
- import CreatePlan from '/@/components/task/CreatePlan.vue'
- import WaylinePanel from '/@/pages/page-web/projects/wayline.vue'
- import DockPanel from '/@/pages/page-web/projects/dock.vue'
- const routes: Array<RouteRecordRaw> = [
- {
- path: '/',
- redirect: '/' + ERouterName.PROJECT
- },
- {
- path: '/' + ERouterName.PROJECT,
- name: ERouterName.PROJECT,
- component: () => import('/@/pages/page-web/index.vue')
- },
- {
- path: '/' + ERouterName.HOME,
- name: ERouterName.HOME,
- component: () => import('/@/pages/page-web/home.vue'),
- children: [
- {
- path: '/' + ERouterName.DEVICES,
- name: ERouterName.DEVICES,
- component: () => import('/@/pages/page-web/projects/devices.vue')
- },
- {
- path: '/' + ERouterName.WORKSPACE,
- name: ERouterName.WORKSPACE,
- component: () => import('/@/pages/page-web/projects/workspace.vue'),
- },
- {
- path: '/' + ERouterName.TASK,
- name: ERouterName.TASK,
- component: () => import('/@/pages/page-web/projects/task.vue'),
- children: [
- {
- path: ERouterName.CREATE_PLAN,
- name: ERouterName.CREATE_PLAN,
- component: CreatePlan,
- children: [
- {
- path: ERouterName.SELECT_PLAN,
- name: ERouterName.SELECT_PLAN,
- components: {
- WaylinePanel,
- DockPanel
- }
- }
- ]
- }
- ]
- },
- {
- path: '/' + ERouterName.MEDIA,
- name: ERouterName.MEDIA,
- component: () => import('/@/pages/page-web/projects/media/index/index.vue')
- },
- {
- path: '/' + ERouterName.MEDIA + '/:id',
- name: ERouterName.MEDIA + '/:id',
- component: () => import('/@/pages/page-web/projects/media/detail/index.vue')
- },
- {
- path: '/' + ERouterName.TRAJECTORY,
- name: ERouterName.TRAJECTORY,
- component: () => import('/@/pages/page-web/projects/trajectory/index.vue')
- },
- {
- path: '/' + ERouterName.MEMBER,
- name: ERouterName.MEMBER,
- component: () => import('/@/pages/page-web/projects/member/index.vue')
- },
- ]
- },
- {
- path: '/' + ERouterName.PILOT,
- name: ERouterName.PILOT,
- component: () => import('/@/pages/page-pilot/pilot-index.vue'),
- },
- {
- path: '/' + ERouterName.PILOT_HOME,
- component: () => import('/@/pages/page-pilot/pilot-home.vue')
- },
- {
- path: '/' + ERouterName.PILOT_MEDIA,
- component: () => import('/@/pages/page-pilot/pilot-media.vue')
- },
- {
- path: '/' + ERouterName.PILOT_LIVESHARE,
- component: () => import('/@/pages/page-pilot/pilot-liveshare.vue')
- },
- {
- path: '/' + ERouterName.PILOT_BIND,
- component: () => import('/@/pages/page-pilot/pilot-bind.vue')
- }
- ]
- const router = createRouter({
- history: createWebHistory(import.meta.env.BASE_URL),
- routes
- })
- router.beforeEach((to, from, next) => {
- const { sign, key, userCode } = from.query as any
- if (sign && key && userCode) {
- localStorage.setItem('sign', sign);
- localStorage.setItem('key', key);
- localStorage.setItem('userCode', userCode);
- next();
- } else {
- next();
- }
- })
- export default router
|