join.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. const app = getApp();
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. list: [],
  8. page: 1,
  9. no_more: false,
  10. },
  11. /**
  12. * 生命周期函数--监听页面加载
  13. */
  14. onLoad: function (options) {
  15. if (options.keyword) {
  16. this.setData({keyword:options.keyword});
  17. }
  18. this.getList();
  19. },
  20. /**
  21. * 页面相关事件处理函数--监听用户下拉动作
  22. */
  23. onPullDownRefresh: function () {
  24. this.setData({list:[],page:1,no_more:false});
  25. this.getList();
  26. wx.stopPullDownRefresh();
  27. },
  28. /**
  29. * 页面上拉触底事件的处理函数
  30. */
  31. onReachBottom: function () {
  32. this.getList();
  33. },
  34. /**
  35. * 用户点击右上角分享
  36. */
  37. onShareAppMessage() {
  38. return {
  39. title: "晋爱人才",
  40. path: "/pages/home/home/home",
  41. };
  42. },
  43. //列表
  44. getList() {
  45. var self = this;
  46. if (self.data.no_more) {
  47. return false;
  48. }
  49. app.post('activity/activity/joinList',{
  50. page:self.data.page,
  51. },function(res){
  52. if (res.length < 10) {
  53. self.setData({no_more:true});
  54. }
  55. let list = self.data.list;
  56. list = list.concat(res);
  57. let page = self.data.page;
  58. page++;
  59. self.setData({list:list,page:page});
  60. });
  61. }
  62. })