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.

113 lines
3.0 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. fenxiang: imgurl.fenxiang1.url,
  13. navigationBarHeight,
  14. data: {},
  15. status: 1,
  16. couponId: null,
  17. orderId: "",
  18. question: [],
  19. day: "",
  20. hour: "",
  21. activityId: "",
  22. homeSelectedO: imgurl.homeSelectedO.url,
  23. wmhome: imgurl.wmhome.url,
  24. minute: "",
  25. nodes: '',
  26. },
  27. onLoad(options) {
  28. let that = this;
  29. wx.hideShareMenu();
  30. if(options&&options.id){
  31. that.setData({
  32. activityId: options.id
  33. })
  34. that.findById(options.id);
  35. }
  36. },
  37. findById(id) {
  38. let that = this;
  39. Http.get({
  40. url: config.api.acfindById,
  41. data: {
  42. id: id
  43. }
  44. }).then(res => {
  45. that.setData({
  46. status: res.data.status
  47. });
  48. if (res && res.data && res.data.activity) {
  49. that.setData({
  50. data: res.data.activity
  51. })
  52. that.setData({
  53. activityStartTime: util.formatTime(res.data.activity.activityStartTime, "yyyy-MM-dd hh:mm:ss"),
  54. activityEndTime: util.formatTime(res.data.activity.activityEndTime, "yyyy-MM-dd hh:mm:ss"),
  55. startTime: util.formatTime(res.data.activity.startTime, "yyyy-MM-dd hh:mm:ss"),
  56. endTime: util.formatTime(res.data.activity.endTime, "yyyy-MM-dd hh:mm:ss")
  57. })
  58. if (res.data.activity.type == 2) {
  59. var temp = WxParse.wxParse('article', 'html', res.data.activity.html, that, 5);
  60. }
  61. }
  62. }).catch(err => {
  63. wx.showToast({
  64. title: err.errMsg,
  65. icon: 'none',
  66. duration: 2000,
  67. mask: false
  68. })
  69. })
  70. },
  71. //跳转到报名详情页
  72. goSignUp(e) {
  73. wx.showLoading({
  74. title: '报名中...',
  75. })
  76. let activityId = e.currentTarget.dataset.activityid;
  77. this.checkUserStatus(activityId);
  78. },
  79. checkUserStatus(activityId){
  80. let that = this;
  81. Http.get({
  82. url: config.api.checkPhoneStatus,
  83. data: {}
  84. }).then(res=>{
  85. wx.hideLoading()
  86. wx.navigateTo({
  87. url: `/pages/radetail/joinActivity/edit?activityId=${activityId}`,
  88. })
  89. }).catch(err=>{
  90. wx.hideLoading()
  91. wx.navigateTo({
  92. url: `/pages/getphoneInfo/index?signActivity=${activityId}`,
  93. })
  94. })
  95. },
  96. goback: function() {
  97. wx.switchTab({
  98. url: '/index/index',
  99. })
  100. },
  101. onShareAppMessage: function (options) {
  102. var that = this;
  103. let shareObj = {};
  104. // 来自页面内的按钮的转发
  105. if (options.from == 'button') {
  106. var eData = options.target.dataset.id;
  107. shareObj.path = `/pages/index/index?id=${eData}&type=ra` + (wx.getStorageSync('tenantId') ? '&tenantId=' + wx.getStorageSync('tenantId') : '');
  108. }
  109. return shareObj;
  110. },
  111. });