myNotice.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. const app = require('../../utils/util.js');
  2. const tools = require('../../utils/tools.js');
  3. Page({
  4. data: {
  5. active: 0,
  6. wdArr: [],
  7. ydArr: [],
  8. showNull: false,
  9. showNull1: false
  10. },
  11. getArr(sessionKey) {
  12. wx.request({
  13. url: app.globalData.publicUrl + '/wx/eduNoticeSee/list',
  14. method: "post",
  15. data: {
  16. sessionKey: sessionKey,
  17. isSee: 1
  18. // isNotice: 0
  19. },
  20. success: (res) => {
  21. if (res.data.code == 0) {
  22. if (res.data.list.length !== 0) {
  23. this.setData({
  24. showNull: false,
  25. wdArr: res.data.list
  26. })
  27. } else {
  28. this.setData({
  29. wdArr: res.data.list,
  30. showNull: true
  31. })
  32. }
  33. } else {
  34. this.setData({
  35. showNull: true
  36. })
  37. }
  38. },
  39. fail: () => {
  40. this.setData({
  41. showNull: true
  42. })
  43. }
  44. })
  45. },
  46. getArr1(sessionKey) {
  47. wx.request({
  48. url: app.globalData.publicUrl + '/wx/eduNoticeSee/list',
  49. method: "post",
  50. data: {
  51. sessionKey: sessionKey,
  52. isSee: 0
  53. // isNotice: 0
  54. },
  55. success: (res) => {
  56. if (res.data.code == 0) {
  57. if (res.data.list.length !== 0) {
  58. this.setData({
  59. showNull1: false,
  60. ydArr: res.data.list
  61. })
  62. } else {
  63. this.setData({
  64. ydArr: res.data.list,
  65. showNull1: true
  66. })
  67. }
  68. } else {
  69. this.setData({
  70. showNull1: true
  71. })
  72. }
  73. },
  74. fail: () => {
  75. this.setData({
  76. showNull1: true
  77. })
  78. }
  79. })
  80. },
  81. async onChange(event) {
  82. if (event.detail.index == 1) {
  83. const sessionKey = await tools.checkSessionAndLogin();
  84. this.getArr1(sessionKey);
  85. }
  86. },
  87. meRead(sessionKey, noticeId) {
  88. wx.request({
  89. url: app.globalData.publicUrl + '/wx/eduNoticeSee/edit',
  90. method: "post",
  91. data: {
  92. sessionKey: sessionKey,
  93. isSee: 0,
  94. noticeId: noticeId
  95. },
  96. success: () => {
  97. this.getArr(sessionKey)
  98. }
  99. })
  100. },
  101. async btn(e) {
  102. let noticeId = e.currentTarget.dataset.item.noticeId;
  103. const sessionKey = await tools.checkSessionAndLogin();
  104. this.meRead(sessionKey, noticeId);
  105. },
  106. async onLoad() {
  107. const sessionKey = await tools.checkSessionAndLogin();
  108. this.getArr(sessionKey);
  109. }
  110. })