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

71 lines
1.5 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.id);
  38. console.log(e.currentTarget.dataset.targetad);
  39. wx.navigateTo({
  40. url: `/pages/coupon/detail/index?id=${
  41. e.currentTarget.dataset.id
  42. }&couponId=${e.currentTarget.dataset.couponId}`
  43. });
  44. }
  45. },
  46. ready() {
  47. app.couponChannelListCallback = token => {
  48. Http.setToken(token);
  49. Http.get({
  50. url: config.api.couponChannelList,
  51. data: {
  52. pageNum: 1,
  53. pageSize: 5,
  54. targetAd: 2
  55. }
  56. }).then(res => {
  57. console.log(res);
  58. this.setData({
  59. list: res.data.list
  60. });
  61. });
  62. };
  63. if (app.globalData.token && app.globalData.token != null) {
  64. console.log("couponChannelList init 1");
  65. app.couponChannelListCallback(app.globalData.token);
  66. }
  67. }
  68. });