C端小程序
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

77 рядки
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. list: [],
  18. total:''
  19. },
  20. /**
  21. * 组件的方法列表
  22. */
  23. methods: {
  24. gotomore: function() {
  25. wx.navigateTo({
  26. url: "/pages/spellGroup/spellGroup"
  27. });
  28. },
  29. gotodetail: function(e) {
  30. wx.navigateTo({
  31. url: `/pages/spellGroup/mySpellGroup/index?couponChannelId=${
  32. e.currentTarget.dataset.couponchannelid
  33. }&couponId=${
  34. e.currentTarget.dataset.couponid
  35. }&targetAd=${
  36. e.currentTarget.dataset.targetad
  37. }`
  38. });
  39. },
  40. getList(){
  41. Http.get({
  42. url: config.api.couponChannelList,
  43. data: {
  44. pageNum: 1,
  45. pageSize: 4,
  46. targetAd: 7
  47. }
  48. }).then(res => {
  49. this.setData({
  50. list: res.data.list,
  51. total: res.data.total
  52. });
  53. })
  54. .catch(err => {
  55. console.log(err)
  56. wx.showToast({
  57. title: err.errMsg,
  58. icon: 'none',
  59. duration: 2000,
  60. mask: false
  61. });
  62. })
  63. }
  64. },
  65. ready() {
  66. app.couponChannelListCallback = token => {
  67. Http.setToken(token);
  68. this.getList();
  69. };
  70. if (app.globalData.token && app.globalData.token != null) {
  71. app.couponChannelListCallback(app.globalData.token);
  72. }
  73. }
  74. });