| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- import { modeFlags, ModeFlag } from "@/store/sys";
- import { ComputedRef } from "vue";
- import { RouteRecordRaw } from "vue-router";
- import {
- RouteNameRaw,
- RouteMetaRaw,
- readyRouteMeta,
- readyRouteName,
- defRouteName,
- } from "./constant";
- export type RouteAtom<
- T extends ModeFlag = any,
- key = RouteNameRaw<T>[keyof RouteNameRaw<T>]
- > = {
- path: string;
- name: key;
- meta: key extends keyof RouteMetaRaw<T> ? RouteMetaRaw<T>[key] : never;
- component: RouteRecordRaw["component"];
- redirect?: string;
- children?: RoutesRaw<T>;
- };
- export type RoutesRaw<T extends ModeFlag = any> = RouteAtom<T>[];
- export const writeRoutesRaw: RoutesRaw<typeof modeFlags.LOGIN> =
- import.meta.env.VITE_APP_SDK === "true"
- ? [
- {
- path: "/scene",
- name: readyRouteName.scene,
- meta: readyRouteMeta.scene,
- component: () => import("@/views/scene/scene.vue"),
- },
- ]
- : [
- {
- path: "/graphic/:mode/:action/:id",
- name: readyRouteName.graphic,
- meta: readyRouteMeta.graphic,
- component: () => import("@/views/graphic/index.vue"),
- },
- {
- path: "/scene",
- name: readyRouteName.scene,
- meta: readyRouteMeta.scene,
- component: () => import("@/views/scene/index.vue"),
- },
- {
- path: "/photos",
- name: readyRouteName.photos,
- meta: readyRouteMeta.photos,
- component: () => import("@/views/photos/index.vue"),
- },
- {
- path: "/accidents",
- name: readyRouteName.accidents,
- meta: readyRouteMeta.accidents,
- component: () => import("@/views/accidents/index.vue"),
- },
- {
- path: "/gena4/:id1/:id2",
- name: readyRouteName.gena4,
- meta: readyRouteMeta.gena4,
- component: () => import("@/views/accidents/print.vue"),
- },
- {
- path: "/roads",
- name: readyRouteName.roads,
- meta: readyRouteMeta.roads,
- component: () => import("@/views/roads/index.vue"),
- },
- {
- path: "/tabulation/:id",
- name: readyRouteName.tabulation,
- meta: readyRouteMeta.tabulation,
- component: () => import("@/views/roads/tabulation.vue"),
- },
- {
- path: "/tables/:name",
- name: readyRouteName.tables,
- meta: readyRouteMeta.tables,
- component: () => import("@/views/tables/index.vue"),
- },
- {
- path: "/demo/:id",
- name: readyRouteName.demo,
- meta: readyRouteMeta.demo,
- component: () => import("@/views/tables/demo.vue"),
- },
- ];
- export type RoutesRef<T extends ModeFlag = any> = ComputedRef<{
- list: RoutesRaw<T>;
- default: typeof defRouteName;
- }>;
|