notice.js 1.7 KB

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