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 line
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. },
  14. /**
  15. * 生命周期函数--监听页面加载
  16. */
  17. onLoad: function (options) {
  18. let that = this;
  19. if(options&&options.id){
  20. that.signIn(options.id);
  21. that.setData({
  22. id:options.id
  23. })
  24. }
  25. },
  26. // pages/index/searchbar/index
  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. })
  44. })
  45. },
  46. //跳转到报名详情页
  47. goSignUp(e) {
  48. let activityId = e.currentTarget.dataset.id;
  49. if (activityId){
  50. wx.navigateTo({
  51. url: `/pages/radetail/index?id=${activityId}`,
  52. })
  53. }else{
  54. wx.showToast({
  55. title: '此活动报名已结束',
  56. })
  57. }
  58. },
  59. goback: function () {
  60. wx.switchTab({
  61. url: '/pages/main/index',
  62. })
  63. },
  64. })