C端小程序
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

85 lignes
1.9 KiB

  1. // pages/index/sw/index.js
  2. let config = require("../../config/config.js");
  3. let Http = require("../../utils/HttpBasics");
  4. const app = getApp();
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. list: []
  11. },
  12. /**
  13. * 生命周期函数--监听页面加载
  14. */
  15. onLoad: function(options) {},
  16. //列表
  17. getList: function(page) {
  18. app.couponChannelListCallback = token => {
  19. Http.setToken(token);
  20. Http.get({
  21. url: config.api.couponChannelList,
  22. data: {
  23. pageNum: page,
  24. pageSize: 2,
  25. targetAd: 2
  26. }
  27. }).then(res => {
  28. console.log(res);
  29. console.log("限时抢购页面");
  30. this.setData({
  31. list: res.data.list
  32. });
  33. });
  34. };
  35. if (app.globalData.token && app.globalData.token != null) {
  36. console.log("couponChannelList init 1");
  37. app.couponChannelListCallback(app.globalData.token);
  38. }
  39. },
  40. onReady: function() {
  41. let that = this;
  42. that.getList(2);
  43. },
  44. //限时抢购的强请页面
  45. gotodetail: function(e) {
  46. console.log(e);
  47. console.log("姐姐在测试");
  48. console.log(e.currentTarget.dataset.couponid);
  49. console.log(e.currentTarget.dataset.targetad);
  50. wx.navigateTo({
  51. url: `/pages/coupon/detail/index?id=${
  52. e.currentTarget.dataset.couponid
  53. }&targetAd=${e.currentTarget.dataset.targetad}`,
  54. success: function(res) {
  55. // success
  56. },
  57. fail: function() {
  58. // fail
  59. },
  60. complete: function() {
  61. // complete
  62. }
  63. });
  64. },
  65. /**
  66. * 页面相关事件处理函数--监听用户下拉动作
  67. */
  68. onPullDownRefresh: function() {
  69. console.log("000");
  70. },
  71. /**
  72. * 页面上拉触底事件的处理函数
  73. */
  74. onReachBottom: function() {
  75. console.log("姐姐在搞上啦加载");
  76. },
  77. /**
  78. * 用户点击右上角分享
  79. */
  80. onShareAppMessage: function() {}
  81. });