myNotice.js 2.5 KB

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