C端小程序
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

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