isAgree.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. const app = require('../../utils/util.js');
  2. const tool = require('../../utils/tool.js');
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. },
  9. /**
  10. * 生命周期函数--监听页面加载
  11. */
  12. onLoad: function (options) {
  13. console.log(options)
  14. tool.openidStatus().then(result => {
  15. this.setData({
  16. openid: result[0],
  17. sessionkey: result[1],
  18. activeId: options.activeId,
  19. name: options.activeName
  20. })
  21. })
  22. },
  23. sure() {
  24. wx.showLoading({
  25. title: '加载中',
  26. })
  27. wx.request({
  28. url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + this.data.activeId + '/confirm',
  29. method: "get",
  30. success: (res) => {
  31. console.log(res)
  32. if (res.data.code == 0) {
  33. wx.showModal({
  34. title: '您已确认参与活动啦',
  35. content: '请按照规定时间前来参加活动呦',
  36. showCancel: false,
  37. success(res) {
  38. if (res.confirm) {
  39. wx.redirectTo({
  40. url: '/pages/index/index',
  41. })
  42. }
  43. }
  44. })
  45. }
  46. },
  47. complete() {
  48. wx.hideLoading({})
  49. }
  50. })
  51. },
  52. esc() {
  53. wx.showLoading({
  54. title: '加载中',
  55. })
  56. wx.request({
  57. url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + this.data.activeId + '/cancel',
  58. method: "get",
  59. data: {
  60. enterStatus: 0
  61. },
  62. success: (res) => {
  63. console.log(res)
  64. if (res.data.code == 0) {
  65. wx.hideLoading()
  66. wx.showModal({
  67. title: '下次再见啦',
  68. content: '很遗憾您不想参加此次活动',
  69. showCancel: false,
  70. success(res) {
  71. if (res.confirm) {
  72. wx.redirectTo({
  73. url: '/pages/index/index',
  74. })
  75. }
  76. }
  77. })
  78. }
  79. },
  80. complete() {
  81. wx.hideLoading()
  82. }
  83. })
  84. },
  85. /**
  86. * 生命周期函数--监听页面初次渲染完成
  87. */
  88. onReady: function () {
  89. },
  90. /**
  91. * 生命周期函数--监听页面显示
  92. */
  93. onShow: function () {
  94. },
  95. /**
  96. * 生命周期函数--监听页面隐藏
  97. */
  98. onHide: function () {
  99. },
  100. /**
  101. * 生命周期函数--监听页面卸载
  102. */
  103. onUnload: function () {
  104. },
  105. /**
  106. * 页面相关事件处理函数--监听用户下拉动作
  107. */
  108. onPullDownRefresh: function () {
  109. },
  110. /**
  111. * 页面上拉触底事件的处理函数
  112. */
  113. onReachBottom: function () {
  114. },
  115. /**
  116. * 用户点击右上角分享
  117. */
  118. onShareAppMessage: function () {
  119. }
  120. })