classify.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. // pages/classify/classify.js
  2. const { getCategoryAPI } = require('../../API/appraise')
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. classifyList: []
  9. },
  10. //获取点击分类的id
  11. detailClassifyTo({ currentTarget }) {
  12. const id = currentTarget.dataset.num;
  13. const title = currentTarget.dataset.title;
  14. wx.navigateTo({
  15. url: '/pages/classify_detail/classify_detail?classify_id=' + id + '&title=' + title,
  16. })
  17. },
  18. /**
  19. * 生命周期函数--监听页面加载
  20. */
  21. onLoad(options) {
  22. this.getClassifyList()
  23. },
  24. getClassifyList() {
  25. getCategoryAPI(this.data)
  26. .then((res) => {
  27. const { code, data, mesage } = res.data;
  28. this.setData({
  29. classifyList: data
  30. })
  31. })
  32. },
  33. /**
  34. * 生命周期函数--监听页面初次渲染完成
  35. */
  36. onReady() {
  37. },
  38. /**
  39. * 生命周期函数--监听页面显示
  40. */
  41. onShow() {
  42. },
  43. /**
  44. * 生命周期函数--监听页面隐藏
  45. */
  46. onHide() {
  47. },
  48. /**
  49. * 生命周期函数--监听页面卸载
  50. */
  51. onUnload() {
  52. },
  53. /**
  54. * 页面相关事件处理函数--监听用户下拉动作
  55. */
  56. onPullDownRefresh() {
  57. },
  58. /**
  59. * 页面上拉触底事件的处理函数
  60. */
  61. onReachBottom() {
  62. },
  63. /**
  64. * 用户点击右上角分享
  65. */
  66. onShareAppMessage() {
  67. }
  68. })