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

104 lines
2.7 KiB

  1. let config = require("../../config/config.js");
  2. let app = getApp();
  3. const Http = require("../../utils/HttpBasics");
  4. const util = require("../../utils/util");
  5. var WxParse = require('../../wxParse/wxParse.js');
  6. const imgurl = require("../../utils/imgurl");
  7. const extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {}
  8. let configUrls = extConfig.attr.configUrl;
  9. Page({
  10. data: {
  11. data: {},
  12. status: 1,
  13. couponId: null,
  14. orderId: "",
  15. question: [],
  16. day: "",
  17. hour: "",
  18. activityId: "",
  19. wmhome: imgurl.wmhome.url,
  20. minute: "",
  21. nodes: ''
  22. },
  23. onLoad(options) {
  24. let that = this;
  25. if(options&&options.id){
  26. that.setData({
  27. activityId: options.id
  28. })
  29. that.findById(options.id);
  30. }
  31. },
  32. findById(id) {
  33. let that = this;
  34. Http.get({
  35. url: config.api.acfindById,
  36. data: {
  37. id: id
  38. }
  39. }).then(res => {
  40. if (res && res.data && res.data.activity) {
  41. that.setData({
  42. data: res.data.activity
  43. })
  44. that.setData({
  45. activityStartTime: util.formatTime(res.data.activity.activityStartTime, "yyyy-MM-dd hh:mm:ss"),
  46. activityEndTime: util.formatTime(res.data.activity.activityEndTime, "yyyy-MM-dd hh:mm:ss"),
  47. startTime: util.formatTime(res.data.activity.startTime, "yyyy-MM-dd hh:mm:ss"),
  48. endTime: util.formatTime(res.data.activity.endTime, "yyyy-MM-dd hh:mm:ss")
  49. })
  50. if (res.data.activity.type == 2) {
  51. wx.request({
  52. url: configUrls + config.api.acPrintHtmlById,
  53. data: {
  54. id: options.id,
  55. date: new Date(),
  56. token: app.globalData.token,
  57. },
  58. header: {
  59. 'content-type': 'application/html'
  60. },
  61. success: function(res) {
  62. var temp = WxParse.wxParse('article', 'html', res.data, that, 5);
  63. }
  64. })
  65. }
  66. }
  67. if (res && res.data && res.data.status) {
  68. that.setData({
  69. status: res.data.status
  70. });
  71. }
  72. }).catch(err => {
  73. wx.showToast({
  74. title: err.errMsg,
  75. icon: 'none',
  76. duration: 2000,
  77. mask: false
  78. })
  79. })
  80. },
  81. //跳转到报名详情页
  82. goSignUp(e) {
  83. let activityId = e.currentTarget.dataset.activityid;
  84. wx.navigateTo({
  85. url: `/pages/radetail/joinActivity/edit?activityId=${activityId}`,
  86. })
  87. },
  88. goback: function() {
  89. wx.switchTab({
  90. url: '/pages/main/index',
  91. })
  92. },
  93. gotoactdetail: function() {
  94. let that = this;
  95. console.log(that.data.data.detail)
  96. wx.navigateTo({
  97. url: `/pages/actdetail/actdetail?detail=${that.data.data.detail}`,
  98. })
  99. }
  100. });