activeDetail.js 4.4 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(result)
  10. this.setData({
  11. loginStatus: true
  12. })
  13. tool.isFinishInfo().then(result2 => {
  14. this.setData({
  15. infoStatus: true
  16. })
  17. tool.isFinishTargetInfo().then(redult3 => {
  18. this.setData({
  19. targetInfoStatus: true
  20. })
  21. }).catch(err => {
  22. this.setData({
  23. targetInfoStatus: false
  24. })
  25. })
  26. }).catch(err => {
  27. this.setData({
  28. infoStatus: false
  29. })
  30. })
  31. }).catch(err => {
  32. console.log(err)
  33. this.setData({
  34. loginStatus: false
  35. })
  36. })
  37. },
  38. baoming() {
  39. if (!this.data.loginStatus) {
  40. wx.showModal({
  41. title: '您还未登录',
  42. showCancel: false,
  43. success(res) {
  44. if (res.confirm) {
  45. wx.redirectTo({
  46. url: '/pages/personal/personal',
  47. })
  48. }
  49. }
  50. });
  51. return false;
  52. }
  53. if (!this.data.infoStatus) {
  54. wx.showModal({
  55. title: '您还未完善个人信息',
  56. showCancel: false,
  57. success(res) {
  58. if (res.confirm) {
  59. wx.redirectTo({
  60. url: '/pages/personInfo/personInfo',
  61. })
  62. }
  63. }
  64. });
  65. return false;
  66. }
  67. if (!this.data.targetInfoStatus) {
  68. wx.showModal({
  69. title: '您还未完善择偶信息',
  70. showCancel: false,
  71. success(res) {
  72. if (res.confirm) {
  73. wx.redirectTo({
  74. url: '/pages/targetInfo/targetInfo',
  75. })
  76. }
  77. }
  78. });
  79. return false;
  80. }
  81. wx.requestSubscribeMessage({
  82. tmplIds: ['YNGZW3voCNtjvTkhi2xbbVinJkjFKcILEG7uFC_xz2Y'],
  83. success: (res) => {
  84. wx.request({
  85. url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + this.data.id + '/enter',
  86. method: "get",
  87. success: (res) => {
  88. if (res.data.code == 0) {
  89. wx.redirectTo({
  90. url: '/pages/registrationSuccess/registrationSuccess',
  91. })
  92. }
  93. }
  94. })
  95. },
  96. fail: (res1) => {
  97. console.log(res1, '失败了')
  98. wx.request({
  99. url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + this.data.id + '/enter',
  100. method: "get",
  101. success: (res) => {
  102. if (res.data.code == 0) {
  103. wx.redirectTo({
  104. url: '/pages/registrationSuccess/registrationSuccess',
  105. })
  106. }
  107. }
  108. })
  109. }
  110. })
  111. },
  112. async onLoad(options) {
  113. console.log(options)
  114. tool.openidStatus().then(result => {
  115. this.setData({
  116. openid: result[0],
  117. sessionkey: result[1],
  118. activeOpenid: options.openId,
  119. isInit: true
  120. })
  121. this.isOk();
  122. this.getActivies(options.id);
  123. })
  124. },
  125. getActivies(id2) {
  126. wx.request({
  127. url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + id2 + '/detail',
  128. method: "get",
  129. success: (res) => {
  130. if (res.data.code == 0) {
  131. console.log(res, '查询活动详情')
  132. this.setData({
  133. id: res.data.activeRoll.id,
  134. actualCount: res.data.activeRoll.actualCount,
  135. planCount: res.data.activeRoll.planCount,
  136. activeStart: res.data.activeRoll.activeStart,
  137. address: res.data.activeRoll.address,
  138. remark: res.data.activeRoll.remark,
  139. posterUrl:res.data.activeRoll.posterUrl
  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. })