C端小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 line
1.4 KiB

  1. const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px'
  2. const util = require("../../utils/util.js");
  3. const Http = require("../../utils/HttpBasics");
  4. const config = require("../../config/config");
  5. let app = getApp();
  6. Page({
  7. /**
  8. * 页面的初始数据
  9. */
  10. data: {
  11. navigationBarHeight,
  12. showPage: false,
  13. showPage1:false,
  14. message:'',
  15. goHomeUrl: "",
  16. },
  17. /**
  18. * 生命周期函数--监听页面加载
  19. */
  20. onLoad: function (options) {
  21. this.setData({
  22. goHomeUrl: app.globalData.goHomeUrl
  23. })
  24. let that = this;
  25. if(options&&options.id){
  26. that.signIn(options.id);
  27. that.setData({
  28. id:options.id
  29. })
  30. }
  31. },
  32. signIn(id){
  33. let that = this;
  34. Http.post({
  35. url: config.api.activitySign,
  36. data: {
  37. activityId:id
  38. }
  39. }).then(res => {
  40. console.log(res)
  41. that.setData({
  42. showPage:true
  43. })
  44. }).catch(err=>{
  45. console.log(err);
  46. that.setData({
  47. showPage1: true,
  48. message: err.message
  49. })
  50. })
  51. },
  52. //跳转到报名详情页
  53. goSignUp(e) {
  54. let activityId = e.currentTarget.dataset.id;
  55. if (activityId){
  56. wx.navigateTo({
  57. url: `/pages/radetail/index?id=${activityId}`,
  58. })
  59. }else{
  60. wx.showToast({
  61. title: '此活动报名已结束',
  62. })
  63. }
  64. },
  65. goback: function () {
  66. let this_=this
  67. wx.switchTab({
  68. url: this_.data.goHomeUrl,
  69. })
  70. }
  71. })