router.ts 1.1 KB

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