activeDetail.js 7.1 KB

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