repeat.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. import routeRoot from '../../../utils/routeRoot.js';
  2. Page({
  3. data: {
  4. nvabarData: {
  5. showCapsule: 1, //是否显示左上角图标 1表示显示 0表示不显示
  6. title: '设置重复', //导航栏 中间的标题
  7. },
  8. items: [{
  9. value: '0',
  10. name: '周日'
  11. },
  12. {
  13. value: '1',
  14. name: '周一'
  15. },
  16. {
  17. value: '2',
  18. name: '周二'
  19. },
  20. {
  21. value: '3',
  22. name: '周三'
  23. },
  24. {
  25. value: '4',
  26. name: '周四'
  27. },
  28. {
  29. value: '5',
  30. name: '周五'
  31. },
  32. {
  33. value: '6',
  34. name: '周六'
  35. }
  36. ],
  37. week_actives: [0, 0, 0, 0, 0, 0, 0],
  38. },
  39. action(e) {
  40. this.data.week_actives[e.currentTarget.dataset.index] = this.data.week_actives[e.currentTarget.dataset.index] === 0 ? 1 : 0;
  41. this.setData({
  42. week_actives: this.data.week_actives
  43. });
  44. getCurrentPages().map((v) => {
  45. if (v.route === routeRoot.deviceWake) {
  46. v.setRepeat(this.data.week_actives);
  47. };
  48. })
  49. },
  50. onLoad(options) {
  51. const week_actives = [];
  52. options.week_actives.split(",").map((v) => {
  53. week_actives.push(parseInt(v, 10));
  54. });
  55. this.setData({
  56. week_actives: week_actives
  57. })
  58. },
  59. /**
  60. * 生命周期函数--监听页面初次渲染完成
  61. */
  62. onReady() {
  63. },
  64. /**
  65. * 生命周期函数--监听页面显示
  66. */
  67. onShow() {
  68. },
  69. /**
  70. * 生命周期函数--监听页面隐藏
  71. */
  72. onHide() {
  73. },
  74. /**
  75. * 生命周期函数--监听页面卸载
  76. */
  77. onUnload() {
  78. },
  79. /**
  80. * 页面相关事件处理函数--监听用户下拉动作
  81. */
  82. onPullDownRefresh() {
  83. },
  84. /**
  85. * 页面上拉触底事件的处理函数
  86. */
  87. onReachBottom() {
  88. },
  89. /**
  90. * 用户点击右上角分享
  91. */
  92. onShareAppMessage() {
  93. }
  94. })