myNotice.js 2.5 KB

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