myActive.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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.showLoading();
  21. wx.request({
  22. url: app.globalData.publicUrl + '/wx/member/' + this.data.openid + '/myActive',
  23. method: "get",
  24. success: (res) => {
  25. console.log(res)
  26. if (res.data.code == 0) {
  27. this.setData({
  28. arr: res.data.actives
  29. })
  30. }
  31. },complete(){
  32. wx.hideLoading()
  33. }
  34. })
  35. },
  36. onLoad(options) {
  37. tool.openidStatus().then(result => {
  38. this.setData({
  39. openid: result[0],
  40. sessionkey: result[1]
  41. })
  42. this.getActivies();
  43. })
  44. // const getOpenid = await tool.openidStatus();
  45. // this.setData({
  46. // openid: getOpenid[0],
  47. // sessionkey: getOpenid[1]
  48. // })
  49. },
  50. /**
  51. * 生命周期函数--监听页面初次渲染完成
  52. */
  53. onReady: function () {
  54. },
  55. /**
  56. * 生命周期函数--监听页面显示
  57. */
  58. onShow: function () {
  59. },
  60. /**
  61. * 生命周期函数--监听页面隐藏
  62. */
  63. onHide: function () {
  64. },
  65. /**
  66. * 生命周期函数--监听页面卸载
  67. */
  68. onUnload: function () {
  69. },
  70. /**
  71. * 页面相关事件处理函数--监听用户下拉动作
  72. */
  73. onPullDownRefresh: function () {
  74. },
  75. /**
  76. * 页面上拉触底事件的处理函数
  77. */
  78. onReachBottom: function () {
  79. },
  80. /**
  81. * 用户点击右上角分享
  82. */
  83. onShareAppMessage: function () {
  84. }
  85. })