index.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. const app = require('../../utils/util.js');
  2. const tool = require('../../utils/tool.js');
  3. Page({
  4. data: {
  5. currentIndex: 0,
  6. arr: [],
  7. arr1: []
  8. },
  9. handleChange: function (e) {
  10. this.setData({
  11. currentIndex: e.detail.current
  12. })
  13. },
  14. goActive(e) {
  15. console.log(e)
  16. let id = e.currentTarget.dataset.id
  17. let openId = e.currentTarget.dataset.openid
  18. wx.navigateTo({
  19. url: '/pages/activeDetail/activeDetail?id=' + id + '&openId=' + openId,
  20. })
  21. },
  22. async onLoad() {
  23. const getOpenid = await tool.openidStatus();
  24. this.setData({
  25. openid: getOpenid[0],
  26. sessionkey: getOpenid[1]
  27. })
  28. wx.request({
  29. url: app.globalData.publicUrl + '/wx/member/' + this.data.openid + '/actives',
  30. method: "get",
  31. data: {
  32. activeStatus: 0
  33. },
  34. success: (res) => {
  35. console.log(res)
  36. if (res.data.code == 0) {
  37. this.setData({
  38. arr1: res.data.actives
  39. })
  40. }
  41. }
  42. })
  43. wx.request({
  44. url: app.globalData.publicUrl + '/wx/member/' + this.data.openid + '/actives',
  45. method: "get",
  46. data: {
  47. activeStatus: 1
  48. },
  49. success: (res) => {
  50. console.log(res)
  51. if (res.data.code == 0) {
  52. this.setData({
  53. arr: this.data.arr1.concat(res.data.actives)
  54. })
  55. }
  56. }
  57. })
  58. }
  59. })