activeDetail.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  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,'22222222222')
  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. // tmplIds: ['OfeVQOfrOQyOEb-ipTiw6MRJiXs9vlvhv3SVRtrTgKc'],
  84. success: (res) => {
  85. wx.request({
  86. url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + this.data.id + '/enter',
  87. method: "get",
  88. success: (res) => {
  89. if (res.data.code == 0) {
  90. wx.redirectTo({
  91. url: '/pages/registrationSuccess/registrationSuccess',
  92. })
  93. }
  94. }
  95. })
  96. },
  97. fail: (res1) => {
  98. console.log(res1, '失败了')
  99. wx.request({
  100. url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + this.data.id + '/enter',
  101. method: "get",
  102. success: (res) => {
  103. if (res.data.code == 0) {
  104. wx.redirectTo({
  105. url: '/pages/registrationSuccess/registrationSuccess',
  106. })
  107. }
  108. }
  109. })
  110. }
  111. })
  112. },
  113. async onLoad(options) {
  114. console.log(options)
  115. tool.openidStatus().then(result => {
  116. this.setData({
  117. openid: result[0],
  118. sessionkey: result[1],
  119. activeOpenid: options.openId,
  120. isInit: true
  121. })
  122. this.isOk();
  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. posterUrl:res.data.activeRoll.posterUrl
  141. })
  142. console.log(this.data.isOpenid)
  143. }
  144. }
  145. })
  146. },
  147. /**
  148. * 生命周期函数--监听页面初次渲染完成
  149. */
  150. onReady: function () {
  151. },
  152. /**
  153. * 生命周期函数--监听页面显示
  154. */
  155. onShow: function () {
  156. },
  157. /**
  158. * 生命周期函数--监听页面隐藏
  159. */
  160. onHide: function () {
  161. },
  162. /**
  163. * 生命周期函数--监听页面卸载
  164. */
  165. onUnload: function () {
  166. },
  167. /**
  168. * 页面相关事件处理函数--监听用户下拉动作
  169. */
  170. onPullDownRefresh: function () {
  171. },
  172. /**
  173. * 页面上拉触底事件的处理函数
  174. */
  175. onReachBottom: function () {
  176. },
  177. /**
  178. * 用户点击右上角分享
  179. */
  180. onShareAppMessage: function () {
  181. }
  182. })