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.

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