myActive.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. const app = require('../../utils/util.js');
  2. const tool = require('../../utils/tool.js');
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. arr: []
  9. },
  10. goActive(e) {
  11. console.log(e.currentTarget.dataset.id)
  12. wx.redirectTo({
  13. url: '/pages/onSiteActivity/onSiteActivity?id=' + e.currentTarget.dataset.id,
  14. })
  15. },
  16. /**
  17. * 生命周期函数--监听页面加载
  18. */
  19. getActivies() {
  20. wx.request({
  21. url: app.globalData.publicUrl + '/wx/member/' + this.data.openid + '/myActive',
  22. method: "get",
  23. success: (res) => {
  24. console.log(res)
  25. if (res.data.code == 0) {
  26. this.setData({
  27. arr: res.data.actives
  28. })
  29. }
  30. }
  31. })
  32. },
  33. onLoad(options) {
  34. tool.openidStatus().then(result => {
  35. this.setData({
  36. openid: result[0],
  37. sessionkey: result[1]
  38. })
  39. this.getActivies();
  40. })
  41. // const getOpenid = await tool.openidStatus();
  42. // this.setData({
  43. // openid: getOpenid[0],
  44. // sessionkey: getOpenid[1]
  45. // })
  46. },
  47. /**
  48. * 生命周期函数--监听页面初次渲染完成
  49. */
  50. onReady: function () {
  51. },
  52. /**
  53. * 生命周期函数--监听页面显示
  54. */
  55. onShow: function () {
  56. },
  57. /**
  58. * 生命周期函数--监听页面隐藏
  59. */
  60. onHide: function () {
  61. },
  62. /**
  63. * 生命周期函数--监听页面卸载
  64. */
  65. onUnload: function () {
  66. },
  67. /**
  68. * 页面相关事件处理函数--监听用户下拉动作
  69. */
  70. onPullDownRefresh: function () {
  71. },
  72. /**
  73. * 页面上拉触底事件的处理函数
  74. */
  75. onReachBottom: function () {
  76. },
  77. /**
  78. * 用户点击右上角分享
  79. */
  80. onShareAppMessage: function () {
  81. }
  82. })