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.

78 lines
1.7 KiB

  1. // pages/index/sw/index.js
  2. let config = require("../../../config/config.js");
  3. let Http = require("../../../utils/HttpBasics");
  4. // let Http = require("../../../utils/HttpBasics");
  5. const app = getApp();
  6. const imgurl = require("../../../utils/imgurl");
  7. Component({
  8. /**
  9. * 组件的属性列表
  10. */
  11. properties: {},
  12. /**
  13. * 组件的初始数据
  14. */
  15. data: {
  16. jianUrl: imgurl.jian.url,
  17. pintuan: imgurl.pintuan.url,
  18. list: [],
  19. total:''
  20. },
  21. /**
  22. * 组件的方法列表
  23. */
  24. methods: {
  25. gotomore: function() {
  26. wx.navigateTo({
  27. url: "/pages/spellGroup/spellGroup"
  28. });
  29. },
  30. gotodetail: function(e) {
  31. wx.navigateTo({
  32. url: `/pages/spellGroup/mySpellGroup/index?couponChannelId=${
  33. e.currentTarget.dataset.couponchannelid
  34. }&couponId=${
  35. e.currentTarget.dataset.couponid
  36. }&targetAd=${
  37. e.currentTarget.dataset.targetad
  38. }`
  39. });
  40. },
  41. getList(){
  42. Http.get({
  43. url: config.api.couponChannelList,
  44. data: {
  45. pageNum: 1,
  46. pageSize: 4,
  47. targetAd: 7
  48. }
  49. }).then(res => {
  50. this.setData({
  51. list: res.data.list,
  52. total: res.data.total
  53. });
  54. })
  55. .catch(err => {
  56. console.log(err)
  57. wx.showToast({
  58. title: err.errMsg,
  59. icon: 'none',
  60. duration: 2000,
  61. mask: false
  62. });
  63. })
  64. }
  65. },
  66. ready() {
  67. app.couponChannelListCallback = token => {
  68. Http.setToken(token);
  69. this.getList();
  70. };
  71. if (app.globalData.token && app.globalData.token != null) {
  72. app.couponChannelListCallback(app.globalData.token);
  73. }
  74. }
  75. });