C端小程序
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

116 Zeilen
2.9 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. const imgurl = require("../../utils/imgurl");
  7. Page({
  8. data: {
  9. mouldType: 0,
  10. mouldConfig: {},
  11. navigationBarHeight,
  12. data: {
  13. bgColor: "#fff"
  14. },
  15. wmhome: imgurl.wmhome.url,
  16. couponId: null,
  17. orderId: "",
  18. day: "",
  19. hour: "",
  20. minute: "",
  21. nodes: '',
  22. id: '',
  23. goHomeUrl: "",
  24. winHeight: "100%"
  25. },
  26. onLoad(options) {
  27. this.setData({
  28. mouldType: app.globalData.mouldType,
  29. mouldConfig: app.globalData.mouldConfig,
  30. goHomeUrl: app.globalData.goHomeUrl,
  31. })
  32. console.log(options)
  33. if (options && options.id) {
  34. this.setData({
  35. id: options.id
  36. })
  37. this.topicShow(options.id)
  38. }
  39. },
  40. goback: function () {
  41. let this_ = this
  42. wx.switchTab({
  43. url: this_.data.goHomeUrl,
  44. })
  45. },
  46. topicShow(id) {
  47. let that = this;
  48. Http.get({
  49. url: config.api.topicFindById,
  50. data: {
  51. id: id
  52. }
  53. }).then(res => {
  54. console.log(res)
  55. if (res && res.data) {
  56. that.setData({
  57. data: res.data
  58. });
  59. /**
  60. * 获取屏幕的高度
  61. *
  62. */
  63. let query = wx.createSelectorQuery();
  64. query.select('.coupons').boundingClientRect();
  65. query.selectViewport().scrollOffset();
  66. query.exec((res) => {
  67. let listHeight = res[0].height; // 获取list高度
  68. let windowHeight = wx.getSystemInfoSync().windowHeight;
  69. if (windowHeight >= listHeight) {
  70. that.setData({
  71. winHeight: '100%'
  72. })
  73. }
  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. gotoDetail: function (e) {
  86. if (e.currentTarget.dataset.type == 9) {
  87. console.log("平团")
  88. wx.navigateTo({
  89. url: `/pages/spellGroup/mySpellGroup/index?couponChannelId=${e.currentTarget.dataset.couponchannelid}`,
  90. })
  91. } else {
  92. console.log("优惠卷")
  93. wx.navigateTo({
  94. url: `/pages/coupon/detail/index?couponChannelId=${e.currentTarget.dataset.couponchannelid}&couponId=${e.currentTarget.dataset.couponid}`,
  95. })
  96. }
  97. },
  98. onShareAppMessage: function (options) {
  99. var that = this;
  100. var shareObj = {
  101. title: "专题活动",
  102. path: `/pages/main/index?id=${that.data.id}&type=td`,
  103. success: function (res) {
  104. if (res.errMsg == 'shareAppMessage:ok') { }
  105. },
  106. fail: function (error) {
  107. if (res.errMsg == 'shareAppMessage:fail cancel') { } else if (res.errMsg == 'shareAppMessage:fail') { }
  108. }
  109. };
  110. console.log(shareObj)
  111. // 返回shareObj
  112. return shareObj;
  113. }
  114. });