activeDetail.js 4.3 KB

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