C端小程序
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

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