
var app = getApp()
var that;
Page({
  data: {
    showRuleTwo: false,//显示规则组件
    ruleVal: "规则分类",

    page:1,
  },
  onLoad(e) {
    that = this;
    dd.setNavigationBar({ title: "排名" });
    if (e.item) {
      this.setData({
        item: JSON.parse(e.item)
      })
      this.setData({
        item_obj: that.data.item.item
      })
      this.getData();
    }
  },
    //上啦加载
  onScrollToLower() {
    if (!that.data.isData) {
      this.setData({ page: ++that.data.page })
      this.getData(true);
    }
  },
  getData(is) {
    var item=this.data.item;
    item.page=this.data.page;
    item.page_size="10";
    app.$post('api/ad/event',item).then((res) => {
      var data = res.data.data.list;
      if (is) {
        if (data.length == 0) {
          this.setData({
            isData: true
          })
          return;
        }
        var list = that.data.list;
        this.setData({
          list: list.concat(data)
        })
      } else {
        this.setData({ list: [] });
        this.setData({
          list: data,
          isData: false
        })
      }
    })
  },
    //显示规则组件
  selectRule() {
    this.setData({
      showRuleTwo: true
    })
  },
});
