123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- // 请求列表数据
- var app = getApp();
- var initList = function (that, obj, page) {
- that.setData({hidden: false});
- var obj = obj || { amount: 0, is_hot: 1, is_new: 0, search: 0, term: 0, user_title: "不限" };
- obj['page'] = page || 1;
- obj['platform'] = app.globalData.platform
- var list = [];
- if (obj['page'] == 1){
- list = [];
- }else{
- list = that.data.dataList
- }
- const dataParam = Object.assign({}, obj, app.globalData.common)
- wx.request({
- url: app.globalData.HOST + '/user/product/searchSecond',
- method: "POST",
- data: dataParam,
- success: function (res) {
- var data = res.data.rst.data;
- if (res.data.errno == '0') {
- that.data.hasNext = res.data.rst.pageinfo.hasNext
- // console.log(that.data.hasNext)
- for (var i = 0; i < data.length;i++){
- list.push(data[i]);
- /*if (orient == 'top'){
- list.unshift(data[i]);
- }else{
- }*/
- }
- that.setData({ dataList: list});
- }
- },
- complete: function () {
- // complete
- that.setData({ hidden:true});//加载成功
- wx.stopPullDownRefresh() //停止下拉刷新
- }
- });
- }
- module.exports = {
- initList: initList
- }
|