index.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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. isInfo: false,
  9. isTargetInfo: false,
  10. letterStatus: true,
  11. lbArr: [{
  12. src: '../../images/lb2.png'
  13. },
  14. // {src:'../../images/lb2.png'},
  15. // {src:'../../images/lb2.png'}
  16. ]
  17. },
  18. // 轮播
  19. handleChange: function (e) {
  20. this.setData({
  21. currentIndex: e.detail.current
  22. })
  23. },
  24. // 关闭信件
  25. closeLetter() {
  26. console.log('1')
  27. this.setData({
  28. letterStatus: true
  29. })
  30. wx.setStorageSync('letterStatus', true)
  31. },
  32. goShare() {
  33. wx.navigateTo({
  34. url: '/pages/share/share',
  35. })
  36. },
  37. // 跳转活动详情页面
  38. goActive(e) {
  39. if(e.currentTarget.dataset.activestatus != -1) {
  40. let id = e.currentTarget.dataset.id
  41. let openId = e.currentTarget.dataset.openid
  42. wx.navigateTo({
  43. url: '/pages/activeDetail/activeDetail?id=' + id + '&openId=' + openId,
  44. })
  45. }else{
  46. wx.showModal({
  47. title: '活动已经结束啦',
  48. showCancel: false
  49. });
  50. }
  51. },
  52. goActiveDefault() {
  53. wx.navigateTo({
  54. url: '/pages/activeDefaultDetails/activeDefaultDetails',
  55. })
  56. },
  57. // 获取活动列表
  58. getActivies() {
  59. wx.request({
  60. url: app.globalData.publicUrl + '/wx/member/' + this.data.openid + '/actives',
  61. method: "get",
  62. // data: {
  63. // activeStatus: 0
  64. // },
  65. success: (res) => {
  66. console.log(res)
  67. if (res.data.code == 0) {
  68. this.setData({
  69. arr: res.data.actives
  70. })
  71. }
  72. },
  73. complete() {
  74. wx.hideLoading();
  75. }
  76. })
  77. // wx.request({
  78. // url: app.globalData.publicUrl + '/wx/member/' + this.data.openid + '/actives',
  79. // method: "get",
  80. // data: {
  81. // activeStatus: 1
  82. // },
  83. // success: (res) => {
  84. // if (res.data.code == 0) {
  85. // this.setData({
  86. // arr1: res.data.actives
  87. // })
  88. // }
  89. // },
  90. // complete() {
  91. // wx.hideLoading();
  92. // }
  93. // })
  94. },
  95. goMy() {
  96. wx.redirectTo({
  97. url: '/pages/personal/personal',
  98. })
  99. },
  100. getIntroduce(id) {
  101. wx.request({
  102. url: app.globalData.publicUrl + '/wx/member/' + this.data.openid + '/introduce',
  103. method: "get",
  104. data: {
  105. introduce: id
  106. },
  107. success: (res) => {
  108. console.log(res, '获取推荐人')
  109. }
  110. })
  111. },
  112. getletterStauts() {
  113. console.log(wx.getStorageSync('letterStatus'))
  114. if (wx.getStorageSync('letterStatus') == true) {
  115. console.log('我缓存里有值是1')
  116. this.setData({
  117. letterStatus: true
  118. })
  119. // this.closeLetter();
  120. } else {
  121. console.log('我没有缓存、')
  122. this.setData({
  123. letterStatus: false
  124. })
  125. }
  126. console.log(this.data.letterStatus)
  127. },
  128. onLoad(options) {
  129. this.getletterStauts();
  130. wx.showLoading();
  131. tool.openidStatus().then(result => {
  132. this.setData({
  133. openid: result[0],
  134. sessionkey: result[1],
  135. })
  136. this.getActivies();
  137. if (options.id) {
  138. this.getIntroduce(options.id);
  139. }
  140. })
  141. },
  142. onShow() {
  143. this.getActivies();
  144. this.getletterStauts();
  145. }
  146. })