index.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. const getHeight = require("../../utils/getRheRemainingHeight");
  2. const _Http = getApp().globalData.http;
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. scrollHeight: 0,
  9. "content": {
  10. "pageNumber": 1,
  11. "pageSize": 20,
  12. pageTotal: 1,
  13. "where": {
  14. "condition": ""
  15. }
  16. }
  17. },
  18. /**
  19. * 生命周期函数--监听页面加载
  20. */
  21. onLoad(options) {
  22. this.getList()
  23. },
  24. getList(init = false) {
  25. if (init.detail != undefined) init = init.detail;
  26. if (init) this.setData({
  27. ['content.pageNumber']: 1
  28. })
  29. if (this.data.content.pageNumber > this.data.content.pageTotal) return;
  30. _Http.basic({
  31. "classname": "saletool.notice.notice",
  32. "method": "queryNoticeList",
  33. content: this.data.content
  34. }).then(res => {
  35. console.log("列表", res)
  36. this.selectComponent('#ListBox').RefreshToComplete();
  37. if (res.msg != '成功') return wx.showToast({
  38. title: res.data,
  39. icon: "none"
  40. })
  41. this.setData({
  42. list: (res.pageNumber == 1) ? res.data : this.data.list.concat(res.data),
  43. ['content.pageNumber']: res.pageNumber + 1,
  44. ['content.pageTotal']: res.pageTotal
  45. })
  46. })
  47. },
  48. /**
  49. * 生命周期函数--监听页面初次渲染完成
  50. */
  51. onReady() {
  52. getHeight.getHeight('.top', this).then(res => {
  53. this.setData({
  54. scrollHeight: res
  55. })
  56. })
  57. },
  58. /**
  59. * 生命周期函数--监听页面显示
  60. */
  61. onShow() {
  62. },
  63. /**
  64. * 生命周期函数--监听页面隐藏
  65. */
  66. onHide() {
  67. },
  68. /**
  69. * 生命周期函数--监听页面卸载
  70. */
  71. onUnload() {
  72. },
  73. /**
  74. * 页面相关事件处理函数--监听用户下拉动作
  75. */
  76. onPullDownRefresh() {
  77. },
  78. /**
  79. * 页面上拉触底事件的处理函数
  80. */
  81. onReachBottom() {
  82. },
  83. /**
  84. * 用户点击右上角分享
  85. */
  86. onShareAppMessage() {
  87. }
  88. })