activeDetail.js 7.0 KB

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