repeat.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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. /**
  51. * 生命周期函数--监听页面加载
  52. */
  53. onLoad(options) {
  54. const week_actives = [];
  55. options.week_actives.split(",").map((v) => {
  56. week_actives.push(parseInt(v, 10));
  57. });
  58. this.setData({
  59. week_actives: week_actives
  60. })
  61. },
  62. /**
  63. * 生命周期函数--监听页面初次渲染完成
  64. */
  65. onReady() {
  66. },
  67. /**
  68. * 生命周期函数--监听页面显示
  69. */
  70. onShow() {
  71. },
  72. /**
  73. * 生命周期函数--监听页面隐藏
  74. */
  75. onHide() {
  76. },
  77. /**
  78. * 生命周期函数--监听页面卸载
  79. */
  80. onUnload() {
  81. },
  82. /**
  83. * 页面相关事件处理函数--监听用户下拉动作
  84. */
  85. onPullDownRefresh() {
  86. },
  87. /**
  88. * 页面上拉触底事件的处理函数
  89. */
  90. onReachBottom() {
  91. },
  92. /**
  93. * 用户点击右上角分享
  94. */
  95. onShareAppMessage() {
  96. }
  97. })