myActive.js 1.8 KB

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