notice.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. const app = require('../../utils/util.js');
  2. var util = require('../../utils/md5.js')
  3. Page({
  4. data: {
  5. currentTabIndex: 0,
  6. readList: [{
  7. title: '重要通知',
  8. content: '萨达撒多会撒娇的挥洒健康的挥洒考究的挥洒的货架上',
  9. time: '2020/07/08'
  10. },
  11. {
  12. title: '重要通知222',
  13. content: 'wewewe',
  14. time: '2020/07/08'
  15. },
  16. {
  17. title: '重要通知222',
  18. content: 'wewewe',
  19. time: '2020/07/08'
  20. },
  21. {
  22. title: '重要通知222',
  23. content: 'wewewe',
  24. time: '2020/07/08'
  25. },
  26. {
  27. title: '重要通知222',
  28. content: 'wewewe',
  29. time: '2020/07/08'
  30. },
  31. {
  32. title: '重要通知',
  33. content: 'skdaskjd阿斯顿撒多撒多撒多萨迪克撒旦卡萨丁',
  34. time: '2020/07/08'
  35. },
  36. {
  37. tile: '重要通知',
  38. content: '所得税卡的挥洒考究的哈斯科技带回家卡萨的挥洒考究的哈斯卡接电话看手机啊都好看手机锕',
  39. time: '2020/07/08'
  40. },
  41. ],
  42. noreadList: [{
  43. title: '未读通知',
  44. content: '萨达撒多会撒娇的挥洒健康的挥洒考究的挥洒的货架上',
  45. time: '2020/07/08'
  46. },
  47. {
  48. title: '重要通知222',
  49. content: 'wewewe',
  50. time: '2020/07/08'
  51. },
  52. {
  53. title: '重要通知',
  54. content: 'skdaskjd阿斯顿撒多撒多撒多萨迪克撒旦卡萨丁',
  55. time: '2020/07/08'
  56. },
  57. {
  58. title: '重要通知',
  59. content: '所得税卡的挥洒考究的哈斯科技带回家卡萨的挥洒考究的哈斯卡接电话看手机啊都好看手机锕',
  60. time: '2020/07/08'
  61. },
  62. ],
  63. },
  64. onTabsItemTap: function (event) {
  65. let index = event.currentTarget.dataset.index;
  66. this.setData({
  67. currentTabIndex: index
  68. })
  69. console.log(index, "sss");
  70. //..............................................................
  71. if (index == 0) {
  72. this.noRead();
  73. } else {
  74. this.read();
  75. }
  76. //..............................................................
  77. },
  78. read() {
  79. wx.request({
  80. url: app.globalData.publicUrl + '/appletNotice/listForApplets',
  81. method: "GET",
  82. header: {
  83. appletsId: wx.getStorageSync('openId')
  84. },
  85. success: (res) => {
  86. console.log(res, "000");
  87. this.setData({
  88. readList: res.data.data
  89. })
  90. }
  91. })
  92. },
  93. noRead() {
  94. wx.request({
  95. url: app.globalData.publicUrl + '/appletNotice/listForAppletsNoread ',
  96. method: "GET",
  97. header: {
  98. appletsId: wx.getStorageSync('openId')
  99. },
  100. success: (res) => {
  101. console.log(res, "000");
  102. this.setData({
  103. noreadList: res.data.data
  104. })
  105. }
  106. })
  107. },
  108. know(e) {
  109. console.log(e.currentTarget.dataset.infos._id);
  110. wx.request({
  111. url: app.globalData.publicUrl + '/readNotice/add',
  112. method: "POST",
  113. header: {
  114. appletsId: wx.getStorageSync('openId')
  115. },
  116. data: {
  117. noticeId: e.currentTarget.dataset.infos._id
  118. },
  119. success: (res) => {
  120. console.log(res, "000");
  121. if (res.data.code == 0) {
  122. this.noRead();
  123. }
  124. }
  125. })
  126. },
  127. onLoad: function () {
  128. this.read();
  129. this.noRead();
  130. },
  131. })