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. this.queryNoticeList(0); //获取通告列表
  36. },
  37. /* 查看通告详情 */
  38. toAnnunciateDetails(e) {
  39. const {
  40. item
  41. } = e.currentTarget.dataset;
  42. wx.navigateTo({
  43. url: '/pages/annunciate/details?item=' + JSON.stringify(item),
  44. })
  45. },
  46. /* 获取通告列表 */
  47. queryNoticeList(i) {
  48. if (i == 5) return;
  49. _Http.basic({
  50. "classname": "saletool.notice.notice",
  51. "method": "queryNoticeList",
  52. "content": {
  53. "pageNumber": 1,
  54. "pageSize": 3
  55. }
  56. }).then(res => {
  57. console.log("通告列表", res)
  58. if (res.msg != '成功') return this.queryNoticeList(i + 1);
  59. this.setData({
  60. annunciateList: res.data
  61. })
  62. })
  63. },
  64. /* 更新站点信息 */
  65. refreshData(item) {
  66. this.setData({
  67. user: item
  68. })
  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. })