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.

139 regels
3.6 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. mouldType: 0,
  30. mouldConfig: {},
  31. goHomeUrl: "",
  32. },
  33. onLoad(options) {
  34. let that = this;
  35. that.setData({
  36. mouldType: app.globalData.mouldType,
  37. mouldConfig: app.globalData.mouldConfig,
  38. goHomeUrl: app.globalData.goHomeUrl,
  39. })
  40. wx.hideShareMenu();
  41. if(options&&options.id){
  42. that.setData({
  43. activityId: options.id
  44. })
  45. that.findById(options.id);
  46. }
  47. },
  48. findById(id) {
  49. let that = this;
  50. Http.get({
  51. url: config.api.acfindById,
  52. data: {
  53. id: id
  54. }
  55. }).then(res => {
  56. that.setData({
  57. status: res.data.status,
  58. activityStatus: res.data.activityStatus,
  59. joinStatus:res.data.joinStatus
  60. });
  61. if (res.data.activity.activityType==0){
  62. that.setData({
  63. ifBtn:false
  64. })
  65. }else{
  66. that.setData({
  67. ifBtn: true
  68. })
  69. }
  70. if (res && res.data && res.data.activity) {
  71. that.setData({
  72. data: res.data.activity
  73. })
  74. that.setData({
  75. activityStartTime: util.formatTime(res.data.activity.activityStartTime, "yyyy-MM-dd hh:mm:ss"),
  76. activityEndTime: util.formatTime(res.data.activity.activityEndTime, "yyyy-MM-dd hh:mm:ss"),
  77. startTime: util.formatTime(res.data.activity.startTime, "yyyy-MM-dd hh:mm:ss"),
  78. endTime: util.formatTime(res.data.activity.endTime, "yyyy-MM-dd hh:mm:ss")
  79. })
  80. if (res.data.activity.type == 2) {
  81. var temp = WxParse.wxParse('article', 'html', res.data.activity.html, that, 5);
  82. }
  83. }
  84. }).catch(err => {
  85. wx.showToast({
  86. title: err.errMsg,
  87. icon: 'none',
  88. duration: 2000,
  89. mask: false
  90. })
  91. })
  92. },
  93. //跳转到报名详情页
  94. goSignUp(e) {
  95. wx.showLoading({
  96. title: '报名中...',
  97. })
  98. let activityId = e.currentTarget.dataset.activityid;
  99. this.checkUserStatus(activityId);
  100. },
  101. checkUserStatus(activityId){
  102. let that = this;
  103. Http.get({
  104. url: config.api.checkPhoneStatus,
  105. data: {}
  106. }).then(res=>{
  107. wx.hideLoading()
  108. wx.navigateTo({
  109. url: `/pages/radetail/joinActivity/edit?activityId=${activityId}&phone=${res.data.phone}`,
  110. })
  111. }).catch(err=>{
  112. wx.hideLoading()
  113. app.globalData.activityId = activityId
  114. app.globalData.type = "hdrl"
  115. wx.navigateTo({
  116. url: '/pages/getuserinfo/index',
  117. })
  118. })
  119. },
  120. goback: function() {
  121. let this_ = this
  122. wx.switchTab({
  123. url: this_.data.goHomeUrl,
  124. })
  125. },
  126. onShareAppMessage: function (options) {
  127. app.globalData.previewFlag = true
  128. var that = this;
  129. let shareObj = {};
  130. // 来自页面内的按钮的转发
  131. if (options.from == 'button') {
  132. var eData = options.target.dataset.id;
  133. shareObj.path = `/pages/index/index?id=${eData}&type=ra`;
  134. }
  135. return shareObj;
  136. },
  137. });