index.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. const _Http = getApp().globalData.http;
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. user: {},
  8. annunciateList: [], //通告列表
  9. gridList: [{
  10. name: "通告",
  11. path: "/pages/annunciate/index",
  12. icon: "icon-a-shouyejingangqutonggao",
  13. }, {
  14. name: "推广素材",
  15. path: "/pages/promotional/index",
  16. icon: "icon-a-shouyejingangqutuiguangsucai",
  17. }, {
  18. name: "商学院",
  19. path: "/pages/college/index",
  20. icon: "icon-a-shangxueyuanxuexi",
  21. }, {
  22. name: "提报",
  23. path: "/pages/submission/index",
  24. icon: "icon-a-tibaoguanlitibao",
  25. }]
  26. },
  27. /**
  28. * 生命周期函数--监听页面加载
  29. */
  30. onLoad(options) {
  31. this.refreshData(wx.getStorageSync('userMsg'))
  32. this.setData({ //获取胶囊位置信息
  33. capsule: wx.getMenuButtonBoundingClientRect()
  34. })
  35. },
  36. /* 查看通告详情 */
  37. toAnnunciateDetails(e) {
  38. const {
  39. item
  40. } = e.currentTarget.dataset;
  41. wx.navigateTo({
  42. url: '/pages/annunciate/details?id=' + item.sat_noticeid,
  43. })
  44. },
  45. /* 获取通告列表 */
  46. queryNoticeList(i) {
  47. if (i == 5) return;
  48. _Http.basic({
  49. "classname": "saletool.notice.notice",
  50. "method": "queryNoticeList",
  51. "content": {
  52. "pageNumber": 1,
  53. "pageSize": 3
  54. }
  55. }).then(res => {
  56. console.log("通告列表", res)
  57. if (res.msg != '成功') return this.queryNoticeList(i + 1);
  58. this.setData({
  59. annunciateList: res.data
  60. })
  61. })
  62. },
  63. /* 更新站点信息 */
  64. refreshData(item) {
  65. this.setData({
  66. user: item
  67. })
  68. this.queryNoticeList(0); //获取通告列表
  69. },
  70. /* 宫格区域应用程序 */
  71. applications(e) {
  72. const {
  73. name
  74. } = e.currentTarget.dataset;
  75. /* switch (name) {
  76. case "通告":
  77. wx.navigateTo({
  78. url: '/pages/annunciate/index'
  79. })
  80. break;
  81. default:
  82. break;
  83. } */
  84. },
  85. /* 去通告 */
  86. toAnnunciate() {
  87. wx.navigateTo({
  88. url: '/pages/annunciate/index'
  89. })
  90. },
  91. /**
  92. * 生命周期函数--监听页面初次渲染完成
  93. */
  94. onReady() {
  95. },
  96. /**
  97. * 生命周期函数--监听页面显示
  98. */
  99. onShow() {
  100. this.getTabBar().init();
  101. },
  102. /**
  103. * 生命周期函数--监听页面隐藏
  104. */
  105. onHide() {
  106. },
  107. /**
  108. * 生命周期函数--监听页面卸载
  109. */
  110. onUnload() {
  111. },
  112. /**
  113. * 页面相关事件处理函数--监听用户下拉动作
  114. */
  115. onPullDownRefresh() {
  116. },
  117. /**
  118. * 页面上拉触底事件的处理函数
  119. */
  120. onReachBottom() {
  121. },
  122. /**
  123. * 用户点击右上角分享
  124. */
  125. onShareAppMessage() {
  126. }
  127. })