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.

74 lines
1.6 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. success: function(res) {
  24. // success
  25. },
  26. fail: function() {
  27. // fail
  28. },
  29. complete: function() {
  30. // complete
  31. }
  32. });
  33. },
  34. gotodetail: function(e) {
  35. console.log(e);
  36. console.log("出错啦 大哥");
  37. console.log(e.currentTarget.dataset);
  38. wx.navigateTo({
  39. url: `/pages/coupon/detail/index?couponChannelId=${
  40. e.currentTarget.dataset.couponchannelid
  41. }&couponId=${
  42. e.currentTarget.dataset.couponid
  43. }&targetAd=${
  44. e.currentTarget.dataset.targetad
  45. }`
  46. });
  47. }
  48. },
  49. ready() {
  50. app.couponChannelListCallback = token => {
  51. Http.setToken(token);
  52. Http.get({
  53. url: config.api.couponChannelList,
  54. data: {
  55. pageNum: 1,
  56. pageSize: 5,
  57. targetAd: 2
  58. }
  59. }).then(res => {
  60. console.log(res);
  61. this.setData({
  62. list: res.data.list
  63. });
  64. });
  65. };
  66. if (app.globalData.token && app.globalData.token != null) {
  67. console.log("couponChannelList init 1");
  68. app.couponChannelListCallback(app.globalData.token);
  69. }
  70. }
  71. });