router.ts 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. export function toSchemePage(id?: string) {
  2. if (!id) {
  3. wx.showToast({ title: '暂无调理方案', icon: 'none' });
  4. return
  5. }
  6. const route = 'module/health/pages/scheme/scheme';
  7. const pages = getCurrentPages();
  8. const historyIndex = pages.reverse().findIndex(page => page.route === route);
  9. if (historyIndex !== -1 && pages[historyIndex].options?.id === id) {
  10. wx.navigateBack({ delta: historyIndex });
  11. } else {
  12. wx.navigateTo({ url: `/${route}?id=${id}` });
  13. }
  14. }
  15. export function toReportPage(id?: string) {
  16. if (!id) {
  17. wx.showToast({ title: '暂无分析报告', icon: 'none' });
  18. return
  19. }
  20. const route = 'module/health/pages/report/report';
  21. const pages = getCurrentPages();
  22. const historyIndex = pages.reverse().findIndex(page => page.route === route);
  23. if (historyIndex !== -1 && pages[historyIndex].options?.id === id) {
  24. wx.navigateBack({ delta: historyIndex });
  25. } else {
  26. wx.navigateTo({ url: `/${route}?id=${id}` });
  27. }
  28. }
  29. export function toPatientPage() {
  30. return wx.navigateTo({ url: `/module/user/pages/user-record/user-record` });
  31. }