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.

62 lines
1.2 KiB

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