index.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. const getHeight = require("../../utils/getRheRemainingHeight");
  2. const _Http = getApp().globalData.http;
  3. Page({
  4. data: {
  5. scrollHeight: 0,
  6. list: [],
  7. "content": {
  8. nocache: true,
  9. "pageNumber": 1,
  10. "pageSize": 20,
  11. "pageTotal": 1,
  12. "where": {
  13. "condition": ""
  14. }
  15. },
  16. unreadNum: 0
  17. },
  18. onLoad(options) {
  19. this.getList();
  20. },
  21. getList(init = false) {
  22. if (init.detail != undefined) init = init.detail;
  23. if (init) this.setData({
  24. ['content.pageNumber']: 1
  25. })
  26. if (this.data.content.pageNumber > this.data.content.pageTotal) return;
  27. _Http.basic({
  28. "classname": "saletool.notice.notice",
  29. "method": "queryNoticeList",
  30. content: this.data.content
  31. }).then(res => {
  32. console.log("通告列表", res)
  33. this.selectComponent('#ListBox').RefreshToComplete();
  34. if (res.msg != '成功') return wx.showToast({
  35. title: res.msg,
  36. icon: "none"
  37. })
  38. this.setData({
  39. total: res.total,
  40. list: (res.pageNumber == 1) ? res.data : this.data.list.concat(res.data),
  41. ['content.pageNumber']: res.pageNumber + 1,
  42. ['content.pageTotal']: res.pageTotal,
  43. unreadNum: res.total - res.tips.readNum
  44. })
  45. })
  46. },
  47. onReady() {
  48. getHeight.getHeight('.top', this).then(res => {
  49. this.setData({
  50. scrollHeight: res
  51. })
  52. })
  53. }
  54. })