C端小程序
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

130 lignes
3.4 KiB

  1. const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px';
  2. let config = require("../../config/config.js");
  3. let app = getApp();
  4. const Http = require("../../utils/HttpBasics");
  5. const util = require("../../utils/util");
  6. var WxParse = require('../../wxParse/wxParse.js');
  7. const imgurl = require("../../utils/imgurl");
  8. const extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {}
  9. let configUrls = extConfig.attr.configUrl;
  10. Page({
  11. data: {
  12. ifBtn:true,//是否能报名
  13. fenxiang: imgurl.fenxiang1.url,
  14. navigationBarHeight,
  15. data: {},
  16. // status: 1,
  17. activityStatus:'',
  18. joinStatus:'',
  19. couponId: null,
  20. orderId: "",
  21. question: [],
  22. day: "",
  23. hour: "",
  24. activityId: "",
  25. homeSelectedO: imgurl.homeSelectedO.url,
  26. wmhome: imgurl.wmhome.url,
  27. minute: "",
  28. nodes: '',
  29. },
  30. onLoad(options) {
  31. let that = this;
  32. wx.hideShareMenu();
  33. if(options&&options.id){
  34. that.setData({
  35. activityId: options.id
  36. })
  37. that.findById(options.id);
  38. }
  39. },
  40. findById(id) {
  41. let that = this;
  42. Http.get({
  43. url: config.api.acfindById,
  44. data: {
  45. id: id
  46. }
  47. }).then(res => {
  48. that.setData({
  49. status: res.data.status,
  50. activityStatus: res.data.activityStatus,
  51. joinStatus:res.data.joinStatus
  52. });
  53. if (res.data.activity.activityType==0){
  54. that.setData({
  55. ifBtn:false
  56. })
  57. }else{
  58. that.setData({
  59. ifBtn: true
  60. })
  61. }
  62. if (res && res.data && res.data.activity) {
  63. that.setData({
  64. data: res.data.activity
  65. })
  66. that.setData({
  67. activityStartTime: util.formatTime(res.data.activity.activityStartTime, "yyyy-MM-dd hh:mm:ss"),
  68. activityEndTime: util.formatTime(res.data.activity.activityEndTime, "yyyy-MM-dd hh:mm:ss"),
  69. startTime: util.formatTime(res.data.activity.startTime, "yyyy-MM-dd hh:mm:ss"),
  70. endTime: util.formatTime(res.data.activity.endTime, "yyyy-MM-dd hh:mm:ss")
  71. })
  72. if (res.data.activity.type == 2) {
  73. var temp = WxParse.wxParse('article', 'html', res.data.activity.html, that, 5);
  74. }
  75. }
  76. }).catch(err => {
  77. wx.showToast({
  78. title: err.errMsg,
  79. icon: 'none',
  80. duration: 2000,
  81. mask: false
  82. })
  83. })
  84. },
  85. //跳转到报名详情页
  86. goSignUp(e) {
  87. wx.showLoading({
  88. title: '报名中...',
  89. })
  90. let activityId = e.currentTarget.dataset.activityid;
  91. this.checkUserStatus(activityId);
  92. },
  93. checkUserStatus(activityId){
  94. let that = this;
  95. Http.get({
  96. url: config.api.checkPhoneStatus,
  97. data: {}
  98. }).then(res=>{
  99. wx.hideLoading()
  100. wx.navigateTo({
  101. url: `/pages/radetail/joinActivity/edit?activityId=${activityId}`,
  102. })
  103. }).catch(err=>{
  104. wx.hideLoading()
  105. app.globalData.activityId = activityId
  106. app.globalData.type = "hdrl"
  107. wx.navigateTo({
  108. url: '/pages/getuserinfo/index',
  109. })
  110. })
  111. },
  112. goback: function() {
  113. wx.switchTab({
  114. url: '/index/index',
  115. })
  116. },
  117. onShareAppMessage: function (options) {
  118. app.globalData.previewFlag = true
  119. var that = this;
  120. let shareObj = {};
  121. // 来自页面内的按钮的转发
  122. if (options.from == 'button') {
  123. var eData = options.target.dataset.id;
  124. shareObj.path = `/pages/index/index?id=${eData}&type=ra`;
  125. }
  126. return shareObj;
  127. },
  128. });