// packageI/newMedia/components/adLiveRecord/adLiveRecord.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    allLivelistData:{
      value:[],
      type:Array
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    allLivelistData_activitys1:[],
    allLivelistData_activitys2:[],

    all_colOneHeight: 0,
    all_colTwoHeight: 0,
  },

  /**
   * 组件的方法列表
   */
  methods: {
    golistPage(e) {
      let status = e.currentTarget.dataset.status;
      let id = e.currentTarget.dataset.id;
      let backid = e.currentTarget.dataset.backid;
      if (status == 3) {
        wx.navigateTo({
          url:
            "/packageD/directSeeding/livePage/livePage?id=" +
            id +
            "&playerType=live",
        });
      } else if (status == 2) {
        wx.navigateTo({
          url: "/packageD/directSeeding/foreshow/foreshow?id=" + id,
        });
      } else if (status == 4) {
        wx.navigateTo({
          url:
            "/packageD/directSeeding/livePage/livePage?id=" +
            id +
            "&playerType=video" +
            "&backid=" +
            backid,
        });
      }
    },
    onImageLoad(options) {
      let index = options.target.dataset.index;
      let seltype = options.target.dataset.seltype;
      let imageWidth = options.detail.width; // 图片宽度
      let imageHeight = options.detail.height; // 图片高度
      let activityObj = null;
      let scle = imageWidth / imageHeight;
      if (seltype == "AllLivelist") {
        let activitys = this.data.allLivelistData; // 获取所有的数据资源
        activityObj = activitys[index];
        let activitys1 = this.data.allLivelistData_activitys1;
        let activitys2 = this.data.allLivelistData_activitys2;
        if (this.data.all_colOneHeight <= this.data.all_colTwoHeight) {
          this.data.all_colOneHeight += 176 / scle + 60;
          activitys1.push(activityObj);
        } else {
          this.data.all_colTwoHeight += 176 / scle + 60;
          activitys2.push(activityObj);
        }
       
        this.setData({
          allLivelistData_activitys1: activitys1,
          allLivelistData_activitys2: activitys2,
        });
      } 
    },
  }
});
