const app = require('../../utils/util.js'); const tool = require('../../utils/tool.js'); Page({ /** * 页面的初始数据 */ data: { }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { console.log(options) tool.openidStatus().then(result => { this.setData({ openid: result[0], sessionkey: result[1], activeId: options.activeId, name: options.activeName }) }) }, sure() { wx.showLoading({ title: '加载中', }) wx.request({ url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + this.data.activeId + '/confirm', method: "get", success: (res) => { console.log(res) if (res.data.code == 0) { wx.showModal({ title: '您已确认参与活动啦', content: '请按照规定时间前来参加活动呦', showCancel: false, success(res) { if (res.confirm) { wx.redirectTo({ url: '/pages/index/index', }) } } }) } }, complete() { wx.hideLoading({}) } }) }, esc() { wx.showLoading({ title: '加载中', }) wx.request({ url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + this.data.activeId + '/cancel', method: "get", data: { enterStatus: 0 }, success: (res) => { console.log(res) if (res.data.code == 0) { wx.hideLoading() wx.showModal({ title: '下次再见啦', content: '很遗憾您不想参加此次活动', showCancel: false, success(res) { if (res.confirm) { wx.redirectTo({ url: '/pages/index/index', }) } } }) } }, complete() { wx.hideLoading() } }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })