123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- var app = getApp();
- var util = require("../../utils/util.js")
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- bottomLeft: app.bottomLeft,
- appAssetsUrl2: app.appAssetsUrl2,
- nodata: util.nodata(),
- query: {
- page: 1,
- limit: 10
- },
- noMore: false,
- currPage: 1,
- totalPage: 1,
- listData: [],
- load: false
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function(options) {
- this.getList()
- },
- getList() {
- let that = this
- that.setData({
- load: false
- })
- app._get(`campusagent/page`, {
- ...this.data.query
- }, res => {
- if (res.code === 0) {
- let listData = that.data.listData;
- listData.push(...res.page.list);
- that.setData({
- listData,
- currPage: res.page.currPage,
- totalPage: res.page.totalPage,
- noMore: res.page.totalPage == res.page.currPage,
- load: true
- })
- }
- })
- },
- detail(e) {
- console.log(e)
- wx.navigateTo({
- url: '/expert/agentdetail/agentdetail?id=' + e.currentTarget.dataset.id + '&type=校园代理人'
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function() {
-
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function() {
-
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function() {},
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function() {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function() {
- let that = this
- if(this.data.currPage >= this.data.totalPage) {
- wx.showToast({
- title: '没有更多了~',
- icon: 'none'
- })
- return false;
- }
- this.setData({
- currPage: that.data.currPage + 1
- })
- this.getList()
- },
- showShareMenu: function() {
- wx.showShareMenu();
- },
- hideShareMenu() {
- wx.hideShareMenu();
- }
- })
|