purchasehistory.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. Page({
  2. data: {
  3. role: "teacher",
  4. historyList: [
  5. {
  6. image: 'https://img1.baidu.com/it/u=2052658756,3021621759&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500',
  7. title: '趣味识字卡片',
  8. date: '2023-10-15 14:30',
  9. checked: false
  10. },
  11. {
  12. image: 'https://img1.baidu.com/it/u=2052658756,3021621759&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500',
  13. title: '趣味识字卡片',
  14. date: '2023-10-15 14:30',
  15. checked: false
  16. },
  17. {
  18. image: 'https://img1.baidu.com/it/u=2052658756,3021621759&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500',
  19. title: '趣味识字卡片',
  20. date: '2023-10-15 14:30',
  21. checked: false
  22. },
  23. {
  24. image: 'https://img1.baidu.com/it/u=2052658756,3021621759&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500',
  25. title: '趣味识字卡片',
  26. date: '2023-10-15 14:30',
  27. checked: false
  28. },
  29. {
  30. image: 'https://img1.baidu.com/it/u=2052658756,3021621759&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500',
  31. title: '趣味识字卡片',
  32. date: '2023-10-15 14:30',
  33. checked: false
  34. },
  35. {
  36. image: 'https://img1.baidu.com/it/u=2052658756,3021621759&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500',
  37. title: '趣味识字卡片',
  38. date: '2023-10-15 14:30',
  39. checked: false
  40. },
  41. {
  42. image: 'https://img1.baidu.com/it/u=2052658756,3021621759&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500',
  43. title: '趣味识字卡片',
  44. date: '2023-10-15 14:30',
  45. checked: false
  46. },
  47. {
  48. image: 'https://img1.baidu.com/it/u=2052658756,3021621759&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500',
  49. title: '趣味识字卡片',
  50. date: '2023-10-15 14:30',
  51. checked: false
  52. },
  53. {
  54. image: 'https://img1.baidu.com/it/u=2052658756,3021621759&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500',
  55. title: '趣味识字卡片',
  56. date: '2023-10-15 14:30',
  57. checked: false
  58. },
  59. {
  60. image: 'https://img1.baidu.com/it/u=2052658756,3021621759&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500',
  61. title: '趣味识字卡片',
  62. date: '2023-10-15 14:30',
  63. checked: false
  64. },
  65. {
  66. image: 'https://img1.baidu.com/it/u=2052658756,3021621759&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500',
  67. title: '趣味识字卡片',
  68. date: '2023-10-15 14:30',
  69. checked: false
  70. },
  71. {
  72. image: 'https://img1.baidu.com/it/u=2052658756,3021621759&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500',
  73. title: '趣味识字卡片',
  74. date: '2023-10-15 14:30',
  75. checked: false
  76. },
  77. // 其他列表项...
  78. ],
  79. isManaging: false
  80. },
  81. onLoad(options) {
  82. // 页面加载时的初始化操作
  83. },
  84. onReachBottom() {
  85. // 上拉触底事件的处理函数
  86. this.loadMore();
  87. },
  88. loadMore() {
  89. // 加载更多数据的逻辑
  90. console.log('加载更多');
  91. },
  92. toggleManageMode() {
  93. const { isManaging, historyList } = this.data;
  94. if (isManaging) {
  95. if (historyList && historyList.length > 0) {
  96. historyList.forEach(item => item.checked = false);
  97. }
  98. this.setData({ isManaging: false });
  99. } else {
  100. this.setData({ isManaging: true });
  101. }
  102. },
  103. selectAll() {
  104. const { historyList } = this.data;
  105. if (historyList && historyList.length > 0) {
  106. const allChecked = historyList.every(item => item.checked);
  107. historyList.forEach(item => item.checked = !allChecked);
  108. this.setData({ historyList });
  109. }
  110. },
  111. deleteItems() {
  112. const { historyList } = this.data;
  113. if (historyList && historyList.length > 0) {
  114. const newList = historyList.filter(item => !item.checked);
  115. this.setData({ historyList: newList });
  116. }
  117. }
  118. });