index.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. const _Http = getApp().globalData.http;
  2. Page({
  3. data: {
  4. loading: true,
  5. "content": {
  6. "version": 1,
  7. nocache: true,
  8. "pageNumber": 1,
  9. "pageTotal": 1,
  10. "where": {
  11. "condition": ""
  12. },
  13. sort: []
  14. }
  15. },
  16. onLoad(options) {
  17. this.getList()
  18. },
  19. /* 处理筛选 */
  20. handleFilter({
  21. detail
  22. }) {
  23. console.log(detail)
  24. },
  25. getList(init = false) {
  26. if (init.detail != undefined) init = init.detail;
  27. let content = this.data.content;
  28. if (init) content.pageNumber = 1;
  29. if (content.pageNumber > content.pageTotal) return;
  30. _Http.basic({
  31. "id": 20220103140003,
  32. content
  33. }).then(res => {
  34. console.log("活动列表", res)
  35. this.selectComponent('#ListBox').RefreshToComplete();
  36. this.setData({
  37. list: res.data,
  38. "content.pageNumber": res.pageNumber + 1,
  39. "content.pageTotal": res.pageTotal,
  40. "content.sort": res.sort,
  41. loading: false
  42. })
  43. })
  44. },
  45. /* 搜索 */
  46. onSearch({
  47. detail
  48. }) {
  49. this.setData({
  50. "content.where.condition": detail
  51. });
  52. this.getList(true)
  53. },
  54. onReady() {
  55. this.setListHeight()
  56. },
  57. /* 设置页面高度 */
  58. setListHeight() {
  59. this.selectComponent("#ListBox").setHeight(".division", this);
  60. },
  61. })