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.

63 lignes
1.3 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. Component({
  6. /**
  7. * 组件的属性列表
  8. */
  9. properties: {},
  10. /**
  11. * 组件的初始数据
  12. */
  13. data: {
  14. list: []
  15. },
  16. /**
  17. * 组件的方法列表
  18. */
  19. methods: {
  20. gotomore: function() {
  21. wx.navigateTo({
  22. url: "/pages/rushToBuy/index"
  23. });
  24. },
  25. gotodetail: function(e) {
  26. console.log(e);
  27. wx.navigateTo({
  28. url: `/pages/coupon/detail/index?couponChannelId=${
  29. e.currentTarget.dataset.couponchannelid
  30. }&couponId=${
  31. e.currentTarget.dataset.couponid
  32. }&targetAd=${
  33. e.currentTarget.dataset.targetad
  34. }`
  35. });
  36. }
  37. },
  38. ready() {
  39. app.couponChannelListCallback = token => {
  40. Http.setToken(token);
  41. Http.get({
  42. url: config.api.couponChannelList,
  43. data: {
  44. pageNum: 1,
  45. pageSize: 5,
  46. targetAd: 2
  47. }
  48. }).then(res => {
  49. console.log(res);
  50. this.setData({
  51. list: res.data.list
  52. });
  53. });
  54. };
  55. if (app.globalData.token && app.globalData.token != null) {
  56. console.log("couponChannelList init 1");
  57. app.couponChannelListCallback(app.globalData.token);
  58. }
  59. }
  60. });