classify.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // pages/classify/classify.js
  2. const app = getApp()
  3. import http from "../../utils/http"
  4. import util from "../../utils/util"
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. height: '',
  11. safehigh: '',
  12. activeKey: 0,
  13. menuH: '32px',
  14. safeTop: `40px`,
  15. active:0,
  16. cate: []
  17. },
  18. /**
  19. * 生命周期函数--监听页面加载
  20. */
  21. onLoad(options) {
  22. this.setData({
  23. safeTop: `${app.globalData.safeTop}px`,
  24. menuH: `${app.globalData.menuH}px`,
  25. })
  26. this.getInfo()
  27. },
  28. cateTap(e){
  29. util.skip('/service/catelist/catelist?two_category_id='+e.currentTarget.dataset.item.id+'&name='+e.currentTarget.dataset.item.label)
  30. },
  31. getInfo(){
  32. http.post('category/getlist', {type: 'all'}, true).then(res => {
  33. this.setData({
  34. cate: res.data
  35. })
  36. })
  37. },
  38. change(e){
  39. this.setData({
  40. active:e.currentTarget.dataset.index
  41. })
  42. },
  43. tosearchdetail(){
  44. wx.navigateTo({
  45. url: '/service/searchdetail/searchdetail',
  46. })
  47. },
  48. lowerthreshold(){
  49. },
  50. lookid(e){
  51. this.setData({
  52. active:e.currentTarget.dataset.id
  53. })
  54. },
  55. /**
  56. * 用户点击右上角分享
  57. */
  58. onShareAppMessage() {
  59. return {}
  60. }
  61. })