1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- var app = getApp();
- var util = require('../../utils/util.js');
- Page({
-
- data: {
- list: [],
- noData: 0,
- tip: '加载中',
- isHideLoadMore: true,
- level: ''
- },
- page: 1,
- hasMore: true,
-
- onLoad: function (options) {
- let level = options.level || '';
- this.setData({ level });
- if (!util.check_login()) {
- wx.redirectTo({
- url: '/lionfish_comshop/pages/user/me',
- })
- }
- wx.showLoading();
- this.getList();
- },
-
- onShow: function () {
- },
- getList() {
- var token = wx.getStorageSync('token');
- var that = this;
- if (!that.hasMore) { return; }
- this.setData({ isHideLoadMore: false })
- app.util.request({
- 'url': 'entry/wxapp/user',
- 'data': {
- controller: 'community.get_head_child_headlist',
- token: token,
- page: that.page,
- level: that.data.level
- },
- dataType: 'json',
- success: function (res) {
- wx.hideLoading();
- if (res.data.code == 0) {
- let oldList = that.data.list;
- let list = oldList.concat(res.data.data);
- that.setData({ list, isHideLoadMore: true })
- } else {
- if (that.data.list.length == 0 && that.page == 1) that.setData({ noData: 1 })
- that.hasMore = false;
- }
- }
- })
- },
-
- onPullDownRefresh: function () {
- },
-
- onReachBottom: function () {
- this.page++;
- this.getList();
- }
- })
|