notice.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. // pages/ucenter/notice/notice.js
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. userInfo: {},
  8. isLogin: false,
  9. noticeList: []
  10. },
  11. goInfo(e) {
  12. console.log(e);
  13. let {
  14. keywords
  15. } = e.currentTarget.dataset;
  16. //console.log(notice);
  17. let notice = JSON.stringify(keywords);
  18. //console.log(notice);
  19. let url = '/pages/ucenter/notice_info/notice_info?notice=' + notice;
  20. wx.navigateTo({
  21. url
  22. });
  23. },
  24. /**
  25. * 生命周期函数--监听页面加载
  26. */
  27. onLoad: function (options) {
  28. let that = this;
  29. let userInfo = wx.getStorageSync('userInfo');
  30. let isLogin = wx.getStorageSync('isLogin');
  31. //console.log(userInfo);
  32. wx.request({
  33. url: getApp().globalData.postHeadAgreement + '/restapi/wechat/noticeList',
  34. data: { loginName: userInfo.loginName },
  35. method: 'POST',
  36. success(res) {
  37. if (res.data) {
  38. that.setData({
  39. noticeList: res.data
  40. });
  41. }
  42. },
  43. fail(e) {
  44. console.log(e);
  45. }
  46. });
  47. },
  48. /**
  49. * 生命周期函数--监听页面初次渲染完成
  50. */
  51. onReady: function () {
  52. },
  53. /**
  54. * 生命周期函数--监听页面显示
  55. */
  56. onShow: function () {
  57. },
  58. /**
  59. * 生命周期函数--监听页面隐藏
  60. */
  61. onHide: function () {
  62. },
  63. /**
  64. * 生命周期函数--监听页面卸载
  65. */
  66. onUnload: function (e) {
  67. },
  68. /**
  69. * 页面相关事件处理函数--监听用户下拉动作
  70. */
  71. onPullDownRefresh: function () {
  72. },
  73. /**
  74. * 页面上拉触底事件的处理函数
  75. */
  76. onReachBottom: function () {
  77. },
  78. /**
  79. * 用户点击右上角分享
  80. */
  81. onShareAppMessage: function () {
  82. }
  83. })