lessonsList.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // pages/Components/lessonsList/lessonsList.js
  2. Component({
  3. lifetimes: {
  4. attached: function () {
  5. // 在组件实例进入页面节点树时执行
  6. },
  7. detached: function () {
  8. // 在组件实例被从页面节点树移除时执行
  9. },
  10. },
  11. /**
  12. * 组件的属性列表
  13. */
  14. properties: {
  15. list: {
  16. type: Array,
  17. value: []
  18. },
  19. showBtn: {
  20. type: Boolean,
  21. value: true,
  22. },
  23. showDate: {
  24. type: Boolean,
  25. value: true,
  26. },
  27. action: {
  28. type: String,
  29. value: '0'
  30. }
  31. },
  32. /**
  33. * 组件的初始数据
  34. */
  35. data: {
  36. },
  37. /**
  38. * 组件的方法列表
  39. */
  40. methods: {
  41. toPages: function (e) {
  42. let item = this.properties.list.filter(o => o.id == e.currentTarget.dataset.id)[0]
  43. let action = e.currentTarget.dataset.action
  44. if (action == 1) {
  45. item.curDate = item.beginTime.substring(0, 10)
  46. }
  47. wx.navigateTo({
  48. url: e.currentTarget.dataset.url + '?data=' + JSON.stringify({ source: item, action: (action ? action : 0), dayScope: 14 }),
  49. })
  50. },
  51. }
  52. })