activeDetail.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. const app = require('../../utils/util.js');
  2. const tool = require('../../utils/tool.js');
  3. Page({
  4. data: {},
  5. isOk() {
  6. tool.isFinishInfo().then(result => {
  7. console.log('我完善信息了')
  8. tool.isLogin().then(result2 => {
  9. tool.isFinishTargetInfo().then(redult3 => {
  10. this.baoming()
  11. }).catch(err => {
  12. wx.showModal({
  13. title: '您还未完善择偶信息',
  14. showCancel: false,
  15. success(res) {
  16. if (res.confirm) {
  17. wx.navigateTo({
  18. url: '/pages/targetInfo/targetInfo',
  19. })
  20. }
  21. }
  22. })
  23. return false;
  24. })
  25. }).catch(err => {
  26. wx.showModal({
  27. title: '您还未登陆',
  28. showCancel: false,
  29. success(res) {
  30. if (res.confirm) {
  31. wx.redirectTo({
  32. url: '/pages/personal/personal',
  33. })
  34. }
  35. }
  36. })
  37. return false;
  38. })
  39. }).catch(err => {
  40. wx.showModal({
  41. title: '您还未完善个人信息',
  42. showCancel: false,
  43. success(res) {
  44. if (res.confirm) {
  45. wx.navigateTo({
  46. url: '/pages/personInfo/personInfo',
  47. })
  48. }
  49. }
  50. })
  51. return false;
  52. })
  53. },
  54. baoming() {
  55. wx.request({
  56. url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + this.data.id + '/enter',
  57. method: "get",
  58. success: (res) => {
  59. if (res.data.code == 0) {
  60. wx.requestSubscribeMessage({
  61. tmplIds: ['YNGZW3voCNtjvTkhi2xbbVinJkjFKcILEG7uFC_xz2Y'],
  62. success(res) {
  63. console.log(res, '成功了');
  64. wx.redirectTo({
  65. url: '/pages/registrationSuccess/registrationSuccess',
  66. })
  67. },
  68. fail(res1) {
  69. console.log(res1, '失败了')
  70. wx.redirectTo({
  71. url: '/pages/registrationSuccess/registrationSuccess',
  72. })
  73. }
  74. })
  75. }
  76. }
  77. })
  78. },
  79. async onLoad(options) {
  80. console.log(options)
  81. tool.openidStatus().then(result => {
  82. this.setData({
  83. openid: result[0],
  84. sessionkey: result[1],
  85. activeOpenid: options.openId
  86. })
  87. this.getActivies(options.id);
  88. })
  89. },
  90. getActivies(id2) {
  91. wx.request({
  92. url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + id2 + '/detail',
  93. method: "get",
  94. success: (res) => {
  95. if (res.data.code == 0) {
  96. console.log(res, '查询活动详情')
  97. this.setData({
  98. id: res.data.activeRoll.id,
  99. actualCount: res.data.activeRoll.actualCount,
  100. planCount: res.data.activeRoll.planCount,
  101. activeStart: res.data.activeRoll.activeStart,
  102. address: res.data.activeRoll.address,
  103. remark: res.data.activeRoll.remark
  104. })
  105. console.log(this.data.isOpenid)
  106. }
  107. }
  108. })
  109. },
  110. /**
  111. * 生命周期函数--监听页面初次渲染完成
  112. */
  113. onReady: function () {
  114. },
  115. /**
  116. * 生命周期函数--监听页面显示
  117. */
  118. onShow: function () {
  119. },
  120. /**
  121. * 生命周期函数--监听页面隐藏
  122. */
  123. onHide: function () {
  124. },
  125. /**
  126. * 生命周期函数--监听页面卸载
  127. */
  128. onUnload: function () {
  129. },
  130. /**
  131. * 页面相关事件处理函数--监听用户下拉动作
  132. */
  133. onPullDownRefresh: function () {
  134. },
  135. /**
  136. * 页面上拉触底事件的处理函数
  137. */
  138. onReachBottom: function () {
  139. },
  140. /**
  141. * 用户点击右上角分享
  142. */
  143. onShareAppMessage: function () {
  144. }
  145. })