list.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. // pages/list/list.js
  2. const app = getApp()
  3. var host = app.globalData.host;
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. list:[],
  10. subject_id:'',
  11. organizer_id:'',
  12. keyword:''
  13. },
  14. /**
  15. * 生命周期函数--监听页面加载
  16. */
  17. onLoad: function (options) {
  18. this.setData({
  19. subject_id: options.subject_id,
  20. organizer_id: options.organizer_id
  21. })
  22. wx.setNavigationBarTitle({
  23. title: options.title,
  24. })
  25. this.getData();
  26. },
  27. getData(){
  28. var that = this, data = { keyword:this.data.keyword};
  29. wx.showNavigationBarLoading()
  30. if (this.data.subject_id){
  31. data.subject_id = this.data.subject_id
  32. }
  33. if (this.data.organizer_id) {
  34. data.organizer_id = this.data.organizer_id
  35. }
  36. wx.request({
  37. url: host + '/api/journals/list',
  38. method: 'GET',
  39. data:data,
  40. success: function (res) {
  41. wx.hideNavigationBarLoading()
  42. var nowx = res.data.data.list.filter(item => !item.wxcode)
  43. that.setData({
  44. list: res.data.data.list,
  45. nowx: nowx
  46. })
  47. }
  48. })
  49. },
  50. search: function (e) {
  51. this.setData({
  52. keyword: e.detail.value
  53. })
  54. this.getData();
  55. },
  56. /**
  57. * 生命周期函数--监听页面初次渲染完成
  58. */
  59. onReady: function () {
  60. },
  61. /**
  62. * 生命周期函数--监听页面显示
  63. */
  64. onShow: function () {
  65. },
  66. /**
  67. * 生命周期函数--监听页面隐藏
  68. */
  69. onHide: function () {
  70. },
  71. /**
  72. * 生命周期函数--监听页面卸载
  73. */
  74. onUnload: function () {
  75. },
  76. /**
  77. * 页面相关事件处理函数--监听用户下拉动作
  78. */
  79. onPullDownRefresh: function () {
  80. },
  81. /**
  82. * 页面上拉触底事件的处理函数
  83. */
  84. onReachBottom: function () {
  85. },
  86. /**
  87. * 用户点击右上角分享
  88. */
  89. onShareAppMessage: function () {
  90. }
  91. })