// pages/Components/lessonsList/lessonsList.js
Component({
  lifetimes: {
    attached: function () {
      // 在组件实例进入页面节点树时执行
    },
    detached: function () {
      // 在组件实例被从页面节点树移除时执行
    },
  },
  /**
   * 组件的属性列表
   */
  properties: {
    list: {
      type: Array,
      value: []
    },
    showBtn: {
      type: Boolean,
      value: true,
    },
    showDate: {
      type: Boolean,
      value: true,
    },
    action: {
      type: String,
      value: '0'
    }
  },

  /**
   * 组件的初始数据
   */
  data: {

  },

  /**
   * 组件的方法列表
   */
  methods: {
    toPages: function (e) {
      let item = this.properties.list.filter(o => o.id == e.currentTarget.dataset.id)[0]
      let action = e.currentTarget.dataset.action
      if (action == 1) {
        item.curDate = item.beginTime.substring(0, 10)
      }
      wx.navigateTo({
        url: e.currentTarget.dataset.url + '?data=' + JSON.stringify({ source: item, action: (action ? action : 0), dayScope: 14 }),
      })
    },
  }
})