1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- var api = require('../../utils/api.js');
- var app = getApp()
- Page({
- data: {
- list: []
- },
- onLoad: function () {
- this.loadMoreAnnouncesList();
- },
- onReachBottom: function () {
- this.loadMoreAnnouncesList();
- // is_no_more || this.loadMoreGoodsList();
- },
- loadMoreAnnouncesList: function() {
- var that = this;
- wx.showLoading({
- title: '加载中',
- })
- wx.request({
- url: api.getAnnouncesUrl,
- method: 'GET',
- data: {
- 'offset': that.data.list.length
- },
- success: res => {
- if (res.data.list.length > 0) {
- var new_list = that.data.list.concat(res.data.list);
- that.setData({
- list: new_list
- });
- } else {
- wx.showToast({
- title: '到底了',
- icon: 'none',
- duration: 800
- })
- }
- },
- complete: res => {
- wx.hideLoading()
- }
- })
- },
- redirectToAnnounce: function(e) {
- let id = e.currentTarget.dataset.id;
- wx.navigateTo({
- url: '/pages/announce-detail/index?id=' + id
- })
- }
- })
|