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.

63 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. // pages/index/searchbar/index
  25. signIn(id){
  26. let that = this;
  27. Http.post({
  28. url: config.api.activitySign,
  29. data: {
  30. activityId:id
  31. }
  32. }).then(res => {
  33. console.log(res)
  34. that.setData({
  35. showPage:true
  36. })
  37. }).catch(err=>{
  38. console.log(err);
  39. that.setData({
  40. showPage1: true
  41. })
  42. })
  43. },
  44. //跳转到报名详情页
  45. goSignUp(e) {
  46. let activityId = e.currentTarget.dataset.id;
  47. if (activityId){
  48. wx.navigateTo({
  49. url: `/pages/radetail/index?id=${activityId}`,
  50. })
  51. }else{
  52. wx.showToast({
  53. title: '此活动报名已结束',
  54. })
  55. }
  56. },
  57. goback: function () {
  58. wx.switchTab({
  59. url: '/pages/main/index',
  60. })
  61. },
  62. })