activeDetail.js 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  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: false
  33. // })
  34. // })
  35. // },
  36. baoming() {
  37. tool.isLogin().then(result => {
  38. tool.isFinishInfo().then(result2 => {
  39. tool.isFinishTargetInfo().then(redult3 => {
  40. wx.requestSubscribeMessage({
  41. tmplIds: ['YNGZW3voCNtjvTkhi2xbbVinJkjFKcILEG7uFC_xz2Y'],
  42. success: (res) => {
  43. console.log(res,'订阅成功了')
  44. wx.request({
  45. url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + this.data.id + '/enter',
  46. method: "get",
  47. success: (res) => {
  48. if (res.data.code == 0) {
  49. wx.redirectTo({
  50. url: '/pages/registrationSuccess/registrationSuccess',
  51. })
  52. }
  53. }
  54. })
  55. },
  56. fail: (res1) => {
  57. console.log(res1, '订阅失败了')
  58. wx.request({
  59. url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + this.data.id + '/enter',
  60. method: "get",
  61. success: (res) => {
  62. if (res.data.code == 0) {
  63. wx.redirectTo({
  64. url: '/pages/registrationSuccess/registrationSuccess',
  65. })
  66. }
  67. }
  68. })
  69. }
  70. })
  71. }).catch(err => {
  72. wx.showModal({
  73. title: '您还未完善择偶信息',
  74. showCancel: false,
  75. success(res) {
  76. if (res.confirm) {
  77. wx.redirectTo({
  78. url: '/pages/targetInfo/targetInfo',
  79. })
  80. }
  81. }
  82. });
  83. })
  84. }).catch(err => {
  85. wx.showModal({
  86. title: '您还未完善个人信息',
  87. showCancel: false,
  88. success(res) {
  89. if (res.confirm) {
  90. wx.redirectTo({
  91. url: '/pages/personInfo/personInfo',
  92. })
  93. }
  94. }
  95. });
  96. })
  97. }).catch(err => {
  98. wx.showModal({
  99. title: '您还未登录',
  100. showCancel: false,
  101. success(res) {
  102. if (res.confirm) {
  103. wx.redirectTo({
  104. url: '/pages/personal/personal',
  105. })
  106. }
  107. }
  108. });
  109. })
  110. // if (!this.data.loginStatus) {
  111. // wx.showModal({
  112. // title: '您还未登录',
  113. // showCancel: false,
  114. // success(res) {
  115. // if (res.confirm) {
  116. // wx.redirectTo({
  117. // url: '/pages/personal/personal',
  118. // })
  119. // }
  120. // }
  121. // });
  122. // return false;
  123. // }
  124. // if (!this.data.infoStatus) {
  125. // wx.showModal({
  126. // title: '您还未完善个人信息',
  127. // showCancel: false,
  128. // success(res) {
  129. // if (res.confirm) {
  130. // wx.redirectTo({
  131. // url: '/pages/personInfo/personInfo',
  132. // })
  133. // }
  134. // }
  135. // });
  136. // return false;
  137. // }
  138. // if (!this.data.targetInfoStatus) {
  139. // wx.showModal({
  140. // title: '您还未完善择偶信息',
  141. // showCancel: false,
  142. // success(res) {
  143. // if (res.confirm) {
  144. // wx.redirectTo({
  145. // url: '/pages/targetInfo/targetInfo',
  146. // })
  147. // }
  148. // }
  149. // });
  150. // return false;
  151. // }
  152. // wx.requestSubscribeMessage({
  153. // tmplIds: ['YNGZW3voCNtjvTkhi2xbbVinJkjFKcILEG7uFC_xz2Y'],
  154. // success: (res) => {
  155. // wx.request({
  156. // url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + this.data.id + '/enter',
  157. // method: "get",
  158. // success: (res) => {
  159. // if (res.data.code == 0) {
  160. // wx.redirectTo({
  161. // url: '/pages/registrationSuccess/registrationSuccess',
  162. // })
  163. // }
  164. // }
  165. // })
  166. // },
  167. // fail: (res1) => {
  168. // console.log(res1, '失败了')
  169. // wx.request({
  170. // url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + this.data.id + '/enter',
  171. // method: "get",
  172. // success: (res) => {
  173. // if (res.data.code == 0) {
  174. // wx.redirectTo({
  175. // url: '/pages/registrationSuccess/registrationSuccess',
  176. // })
  177. // }
  178. // }
  179. // })
  180. // }
  181. // })
  182. },
  183. async onLoad(options) {
  184. wx.showLoading({
  185. title:'加载中',
  186. mask:true
  187. });
  188. console.log(options)
  189. tool.openidStatus().then(result => {
  190. this.setData({
  191. openid: result[0],
  192. sessionkey: result[1],
  193. activeOpenid: options.openId,
  194. isInit: true
  195. })
  196. // this.isOk();
  197. this.getActivies(options.id);
  198. wx.hideLoading();
  199. })
  200. },
  201. getActivies(id2) {
  202. wx.request({
  203. url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + id2 + '/detail',
  204. method: "get",
  205. success: (res) => {
  206. if (res.data.code == 0) {
  207. console.log(res, '查询活动详情')
  208. this.setData({
  209. id: res.data.activeRoll.id,
  210. actualCount: res.data.activeRoll.actualCount,
  211. planCount: res.data.activeRoll.planCount,
  212. activeStart: res.data.activeRoll.activeStart,
  213. address: res.data.activeRoll.address,
  214. remark: res.data.activeRoll.remark,
  215. posterUrl:res.data.activeRoll.posterUrl
  216. })
  217. console.log(this.data.isOpenid)
  218. }
  219. }
  220. })
  221. },
  222. /**
  223. * 生命周期函数--监听页面初次渲染完成
  224. */
  225. onReady: function () {
  226. },
  227. /**
  228. * 生命周期函数--监听页面显示
  229. */
  230. onShow: function () {
  231. },
  232. /**
  233. * 生命周期函数--监听页面隐藏
  234. */
  235. onHide: function () {
  236. },
  237. /**
  238. * 生命周期函数--监听页面卸载
  239. */
  240. onUnload: function () {
  241. },
  242. /**
  243. * 页面相关事件处理函数--监听用户下拉动作
  244. */
  245. onPullDownRefresh: function () {
  246. },
  247. /**
  248. * 页面上拉触底事件的处理函数
  249. */
  250. onReachBottom: function () {
  251. },
  252. /**
  253. * 用户点击右上角分享
  254. */
  255. onShareAppMessage: function () {
  256. }
  257. })