C端小程序
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

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