activeDetail.js 4.9 KB

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