report.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. // pages/report/report.js
  2. import { myReportList, getReport } from '../../api/my'
  3. const app = getApp()
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. reportList: [],
  10. showPage: true
  11. },
  12. /**
  13. * 生命周期函数--监听页面显示
  14. */
  15. onShow() {
  16. app.globalData.selectedInex = 1
  17. this.getMyReportList()
  18. },
  19. // 我的报告
  20. getMyReportList () {
  21. var that = this
  22. wx.showLoading({
  23. title: '加载中...',
  24. mask: true
  25. })
  26. myReportList({}).then(res => {
  27. wx.hideLoading()
  28. var response = res.data || []
  29. that.setData({
  30. reportList: response
  31. })
  32. }).catch(e => {
  33. wx.hideLoading()
  34. wx.showModal({
  35. content: e,
  36. confirmColor: '#333',
  37. showCancel: false
  38. })
  39. })
  40. },
  41. /**
  42. * 立即预约
  43. */
  44. handleAppoint() {
  45. wx.navigateTo({
  46. url: '/pages/appointment/appointment',
  47. })
  48. },
  49. /**
  50. * 生命周期函数--监听页面卸载
  51. */
  52. onUnload() {
  53. },
  54. /**
  55. * 页面相关事件处理函数--监听用户下拉动作
  56. */
  57. onPullDownRefresh() {
  58. },
  59. /**
  60. * 页面上拉触底事件的处理函数
  61. */
  62. onReachBottom() {
  63. },
  64. /**
  65. * 点击报告进入详情
  66. */
  67. handleDetail(e) {
  68. var reportId = e.currentTarget.dataset.reportid
  69. console.log(e.currentTarget.dataset.reportid);
  70. wx.navigateTo({
  71. url: '/pages/reportDetail/reportDetail?reportid=' + reportId
  72. })
  73. /* var data = {
  74. name: '循环系统',
  75. reportId: reportId
  76. }
  77. getReport(data).then(res => {
  78. console.log(res);
  79. })
  80. return
  81. */
  82. }
  83. })