index.js 3.3 KB

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