index.js 770 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // index.js
  2. const mockData = require('../../utils/mockData.js')
  3. Page({
  4. data: {
  5. banners: mockData.banners,
  6. hospitals: mockData.hospitals
  7. },
  8. onLoad() {
  9. console.log('首页加载完成')
  10. },
  11. // 导航到下单页面
  12. navigateToOrder() {
  13. wx.switchTab({
  14. url: '/pages/order/order'
  15. })
  16. },
  17. // 导航到智能诊断页面
  18. navigateToDiagnosis() {
  19. wx.switchTab({
  20. url: '/pages/diagnosis/diagnosis'
  21. })
  22. },
  23. // 导航到我的页面
  24. navigateToProfile() {
  25. wx.switchTab({
  26. url: '/pages/profile/profile'
  27. })
  28. },
  29. // 导航到医院详情
  30. navigateToHospital(e) {
  31. const hospital = e.currentTarget.dataset.hospital
  32. wx.navigateTo({
  33. url: `/pages/hospital/hospital?id=${hospital.id}`
  34. })
  35. }
  36. })