index.ts 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import { createRouter, createWebHistory } from 'vue-router';
  2. const router = createRouter({
  3. history: createWebHistory(import.meta.env.BASE_URL),
  4. routes: [
  5. { path: '/screen', name: 'screen', component: () => import('@/pages/screen.page.vue'), meta: { scan: true } },
  6. { path: '/register', component: () => import('@/pages/register.page.vue'), meta: { title: '建档', scan: true } },
  7. { path: '/pulse', component: () => import('@/modules/pulse/pulse.page.vue'), meta: { title: '脉诊' } },
  8. { path: '/pulse/result', component: () => import('@/modules/pulse/pulse-result.page.vue'), meta: { title: '脉象分析报告' } },
  9. { path: '/camera', component: () => import('@/modules/camera/camera.page.vue'), meta: { title: '拍摄' } },
  10. { path: '/camera/result', component: () => import('@/modules/report/report-analyse.page.vue'), meta: { title: '舌面象分析报告' } },
  11. { path: '/questionnaire', component: () => import('@/modules/questionnaire/page.vue'), meta: { title: '问卷' } },
  12. { path: '/alcohol/result', component: () => import('@/modules/alcohol/alcohol.page.vue'), meta: { title: '黄酒建议' } },
  13. { path: '/report/analysis', redirect: '/camera/result' },
  14. { path: '/report/:id/scheme', component: () => import('@/modules/report/scheme.page.vue'), meta: { title: '调理方案', toggle: true } },
  15. { path: '/report/:id(\\w+)?', component: () => import('@/modules/report/report.page.vue'), meta: { title: '健康分析报告' } },
  16. { path: '/scheme/:id(\\w+)?', component: () => import('@/modules/report/scheme.page.vue'), meta: { title: '调理方案', toggle: false } },
  17. { path: '/crossing/:flow(\\w+)?', component: () => import('@/pages/crossing.page.vue') },
  18. { path: '/', redirect: '/screen' },
  19. ],
  20. });
  21. export default router;
  22. export const flow_start = 'start';
  23. export const flow_router = {
  24. 'patient_file': '/register',
  25. 'pulse_upload': '/pulse',
  26. 'pulse_upload_result': '/pulse/result',
  27. 'tongueface_upload': '/camera',
  28. 'tongueface_analysis_result': '/camera/result',
  29. 'tongueface_analysis': '/questionnaire',
  30. 'alcohol_upload_result': '/alcohol/result',
  31. 'health_analysis': '/report',
  32. 'health_analysis_scheme': '/scheme',
  33. [flow_start]: '/screen',
  34. } as const;
  35. export function getRoutePath(key?: string) {
  36. key = key?.split('?')?.[0];
  37. return flow_router[key as keyof typeof flow_router];
  38. }