index.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. let app = getApp();
  2. const util = require("../../utils/util");
  3. Component({
  4. properties: {
  5. imgPath: {
  6. type: String,
  7. observer: function (newVal, oldVal) {
  8. console.log(newVal);
  9. this.setData({ imgPath: newVal });
  10. }
  11. },
  12. data: {
  13. type: Object,
  14. observer: function (newVal, oldVal) {
  15. console.log(newVal);
  16. this.setData({ activeData: newVal })
  17. }
  18. },
  19. history: {
  20. type: Number,
  21. observer: function (newVal, oldVal) {
  22. this.setData({ history: newVal })
  23. }
  24. }
  25. },
  26. data: {
  27. activeData: {},
  28. history: 0
  29. },
  30. methods: {
  31. goDetails(e) {
  32. wx.reportAnalytics('index_acitve', {
  33. aid: e.currentTarget.dataset.aid,
  34. title: e.currentTarget.dataset.title,
  35. });
  36. wx.navigateTo({
  37. url: '/pages/product/activity/index?aid=' + e.currentTarget.dataset.aid
  38. })
  39. },
  40. binderror(e) {
  41. var activeData = this.data.activeData, index = e.currentTarget.dataset.index;
  42. activeData[index].logo = '/images/noimg.png';
  43. this.setData({ activeData });
  44. },
  45. goenlist(e) {
  46. wx.reportAnalytics('index_pay', {
  47. aid: e.currentTarget.dataset.aid,
  48. title: e.currentTarget.dataset.title,
  49. });
  50. if (app.globalData.userInfo) {
  51. wx.navigateTo({
  52. url: '/pages/product/activity/buy?aid=' + e.currentTarget.dataset.aid
  53. })
  54. } else {
  55. // 静默登录
  56. util.silentLogin().then(res => {
  57. wx.navigateTo({
  58. url: '/pages/product/activity/buy?aid=' + e.currentTarget.dataset.aid
  59. })
  60. })
  61. }
  62. },
  63. }
  64. });